top of page

Minimizing taxes on stock sales

You've got shares of an individual stock worth a hefty chunk of change, held in a standard taxable account that's gone up in value -- maybe an inheritance, maybe a gift, maybe employer stock. Huzzah! But if you sell, you'll have to pay taxes on the sale. Booooooo. And while "a tax deferred is a tax avoided", you'd kind of like to actually spend your wealth. So: what do you do?

First, a quick review

How much are you taxed on sale of stock? 99% of the time, it comes down to this formula: capital_gains_tax_rate * (sale_price - cost_basis). (You C++ jockeys can change the variables to camel case if you like.) In other words: you pay capital gains tax on the difference between the cost basis and the sale price.

Let's break down the variables:

  • capital_gains_tax_rate depends on whether the sale counts as "short-term" or "long-term". The sale is short-term if you sell a year or sooner after getting the asset, and long-term if otherwise. (Mnemonic: "wait a year and a day", like in those old stories about fairy curses.) Short-term capital gains are counted as ordinary income, and taxed as such. As of this writing in 2019, the long-term capital gains tax rate is 0%, 15%, or 20%, depending on your income. And no, it's not a progressive rate like income tax: every dime of your long-term capital gains in a given year is taxed at the same rate.

  • sale_price is the value you sold the stock for (though you'd guessed that already).

  • cost_basis is the tax term for the amount you invested into the stock -- generally, the price you paid for it. There are occasionally things that can modify this, some of which we'll talk about below.

For example: let's say you buy 100 shares of stock at $10/share, and then a year and a day later sell at $20/share, in a year that you're in the 15% tax bracket. Your tax is 15% * ($2000 - $1000) = $150. Not awful, but not nothing, either. Let's see what we can do to mitigate this.

Plan A: sell immediately

There are plenty of times when selling immediately actually works quite well.

Example: an inheritance. Let's say you inherit a bunch of stock from your grandmother, including some shares of Amazon that she bought at $10 a share. Well, because that stock is (theoretically) subject to estate tax, the IRS kindly provides a step-up in cost basis, so you don't get taxed twice: the cost basis is set to the value at her date of death.

(Why "theoretically"? Because in 2019, an individual's estate would have to be valued at over $11.4 million in order to be subject to estate tax -- double that for a married couple! This is why people get annoyed at the phrase "death tax" -- death is universal, but the estate tax is decidedly not.)

Now, there are a few exceptions on the cost basis step-up. For example: if the assets were placed in an irrevocable trust before death, then in most cases it doesn't get the step-up, because they're no longer owned by the person who "gifted" them to the trust. Among the other exceptions is one related to a strategy called "reverse gifting", which I'll talk about a little later.

All this means that if you sell the stock immediately upon inheritance, chances are that the tax consequences will be very low, due to the cost-basis step-up. Also, to make things even better, the tax is automatically counted as a long-term capital gains, even if it was bought the day before death and sold the day after. (Mnemonic: "death is long-term.")

So if, for example, you're a little nervous that your entire inheritance came in the form of a single stock that's shot up in price over the last decade, rest at ease: you can generally "cash in the chips" here and diversify out with minimal tax impact. Just consider doing it sooner rather than later -- long-term the market goes up more than it goes down!

(And yes, the above paragraphs were littered with hedges like "generally" and "often" and "chances are". Estate law can be subtle, especially when trusts enter the picture. It's worth double-checking with your CFP®, CPA, and/or estate lawyer before selling off those assets!)

Another example: employer RSU's (restricted stock units). RSU's are an increasingly popular alternative to stock option grants, especially in publicly-traded tech companies.

The idea is relatively straightforward: as part of your compensation, whether as a sign-on bonus or as part of a performance-based compensation plan, you're given shares of the company stock. There's no vesting or anything like that; you're effectively just given the shares. If the price goes down to $0.01, they're still worth something. Not bad!

How do the taxes work here? They're not terribly complicated: the total value of the RSU's on the day you receive them is treated as ordinary income, and is used to determine your cost basis. In other words, they're treated exactly as if your employer had given you a bonus, which you then immediately used to purchase as much of your employer's stock as possible. In fact, your employer is required to withhold some of your RSU's for state and federal tax purposes, kind of like they do with your regular paycheck.

In this case, you've already paid the taxes (depending on how accurate the withholding is -- it's worth double-checking your RSU statement!), and the cost basis is equal to the current value, so you may as well just sell immediately and diversify!

(And please don't say, "but I like my employer!" If you like them enough to put in your blood, sweat, and tears every week, that's plenty of loyalty. Your paycheck is dependent on them; you don't need to tie even more of your financial life to them than you already do!)

While we're talking about employer stock: ESPP's and stock options are interesting beasts, tax-wise, and deserve their own discussions.

So in the case of many situations, such as inheritance and RSU's, selling immediately is often the best strategy. But what if, for whatever reason, you've had the stock for a while, and selling immediately would cause a nasty tax hit?

Optimizing charity donations: donate-and-replace

If you currently donate a decent chunk of your cash to charity, this is a great opportunity for optimization. Why? Because if you donate stock to an official blessed-by-the-IRS 501(c)(3) charity, the following things happen:

  1. You aren't taxed. (You didn't sell the stock, so this makes sense.)

  2. The charitable organization gets a step-up in basis. If they want to sell immediately, they can with no tax consequences.

  3. If you're itemizing deductions, you get a deduction equal to the fair market value of the stock, just as you would with a cash donation, assuming you've held it for a year and a day (see above re: long-term capital gains).

Pretty cool, huh? So let's say you generally donate $3,000 out of your cash flow to your church each year. You could instead donate $3,000 of the most highly-appreciated stock you own, and use the extra $3K in your cash flow to replace the outflow from your portfolio -- effectively diversifying out of that stock with no tax hit! (Nearly all mid- to large-sized 501(c)(3) charities have a system for accepting stocks, for precisely this reason.)

Gaming the system: reverse gifting (warning: here there be dragons! Consult an expert first!)

(Seriously, this strategy could blow up in your face, and I debated not mentioning it at all, but I'd rather you hear about it from me than at a cocktail party.)

Reverse gifting is a way to take advantage of that step-up in basis that I mentioned earlier. What if you're pretty sure that you're not going to need the stock anytime in the near future, but would like access to it maybe someday before you die? In theory, you can gift it to your parents (or some other older relative), and then when they pass away and you inherit it, you get the step-up in basis. You see how it could work, right? In practice, though, there are several issues.

For one, the IRS is keenly aware of this hack, and has taken steps to limit its abuse. Specifically, if a gift is made to someone less than a year before they pass away, no step-up in basis occurs.

For another, this is assuming their estate is small enough to avoid estate tax, once you add your reverse gift. I'd rather pay 15% capital gains tax than 40% estate tax, thank you!

And this assumes your relative plays along. Once you give them the stock, it's theirs to do with as they wish. Moreover, they might not conveniently die when you want them to.

Finally, let's be real here: estate planning based on a relative dying at a time that's convenient for you? No. Just no. They're your family, not an estate planning tool.

When all else fails, create a system

If you've gotten this far and nothing has jumped out as a good tax mitigation strategy, then you're likely just going to have to bite the bullet and pay the taxes. I know, paying taxes hurts, and it's tempting to put off the pain until later. Which is fine...until the stock pulls an Enron and you lose it all. Congratulations, you've paid $0 in taxes...because the stock is worth nothing!

Rather, it's best to take emotions out of it by coming up with a system. Here are some thoughts on what that might look like.

Consider setting a timeline for diversifying out. If you take the tax hit now, it might be really painful...but what if you spread it out over a year, or two, or three? If it's the difference between the 20% and 15% (or 0%!) capital gains tax bracket, or the difference between paying the Net Investment Income Tax or not, then spreading it out could make sense. Run some numbers, set a timeline, and stick to it.

Sell periodically over the timeline. Maybe you do the year's sale all at once, at the beginning of the year. The market goes up more than it goes down, so this is a reasonable bet. Or you might sell quarterly, or monthly, so that if there's a short-term dip, you can take advantage of it. Speaking of:

Watch for opportunities. If the market takes a downturn and the cost basis of at least some of your shares is high enough, they may go "underwater" (with the current value less than the cost basis). In this case, you can sell all of the underwater shares and actually get a tax break! (And yes, you get to determine which shares you sold, when the time comes to report the sale to the IRS.)

Help -- I can't decide!

Some of you read this and thought, "okay, excellent -- I know exactly what I want to do!" Awesome -- mission accomplished! I'd love to hear about your plan in the comments below, as would your fellow nerds!

Others may have thought, "Great. Now I've got more questions than I did before I came!" Or alternately, "I've got some ideas on a path forward, but a mistake might be costly." I get it. The good news is that this is meant to be the beginning of the conversation, not the end! Drop a comment, or shoot me an e-mail, and let's figure this thing out!

Britton is an engineer-turned-financial-planner in Austin, Texas. As such, he shies away from suits and commissions, and instead tends towards blue jeans, data-driven analysis, and a fee-only approach to financial planning.

bottom of page