Understanding long-term capital gains taxes when you sell investments

Market downturns can be a good time to adjust your portfolio to minimize current or future taxes. Here’s how to calculate the best ways to do that – now and in the future.

Stocks or funds you own in taxable accounts (not retirement accounts like an IRA) longer than a year incur long-term capital gains taxes when you sell the investment. At the time of sale you realize losses or gains which are recorded on your taxes. Typically, you aim to sell the fund at a gain. In doing so, long-term capital gains are taxed at preferred rates compared to ordinary income brackets. The rates are determined by your income level, and will be 0%, 15% or 20%.

Long-term Capital Gains Tax Rates



15% RATE

20% RATE


Up to $40,400

$40,401 – $445,850

Over $445,850

Married filing jointly

Up to $80,800

$80,801 – $501,600

Over $501,600

Married filing separately

Up to $40,400

$40,401 – $250,800

Over $250,800

Head of household

Up to $54,100

$54,101 – $473,750

Over $473,750

The Benefit of Taking the Loss

So what does this all mean during a downturn?

As mentioned above, typically we aim to sell funds at a gain. That’s the whole point of investing, right? BUT, sometimes it makes sense to sell at a loss.

  1. The stock or fund is a dog and it’s time to call it a day. You’re moving on!
  2. The fund has lost money in a downturn, or it’s just a particularly challenging time for that asset class. Long-term you want to remain invested, but short-term you want to “harvest the loss.” 

The benefit? Losses can be netted against your gains, which offsets any tax due on gains helping to decrease your tax bill. And at a minimum, it helps take the sting out of the loss itself.

For example: 

  • Fund A has a long-term loss of $10,000
  • Fund B has a long-term gain of $20,000
  • Both funds are sold in 2022. 

In 2022, you would report a net gain of $10,000 vs $20,000 which would be taxed at the above referenced rates.

If your losses exceed gains, you can use the excess to reduce your ordinary income up to $3,000 per year ($1,500 if filing separately), carrying over any remaining losses to future years.

  • Fund A has a long-term loss of $20,000
  • Fund B has a long-term gain of $10,000
  • Both funds are sold in 2022. 

In 2022, you would have no gain to report and if married could report a $3,000 loss. 

$20,000 loss – $10,000 (toward gain) – $3,000 (maximum allowed in 2022) = $7,000 to roll over for use in future years. 

The ability to rollover the losses allows you to be more strategic with how you want to realize gains in the future.  And if you’re not expecting a single year with material gains, you could apply the rollover to multiple years to even out your tax bill or stay beneath certain thresholds. 

More about Tax Loss Harvesting 

Tax Loss Harvesting is certainly something to consider this year, or in years where a certain asset class is struggling. 

If you’re like me and invested some cash at the beginning of the year – you’re experiencing losses across the board on those contributions. However, I’m a long-term investor and not really focused on the performance given it’s been just a handful of months. BUT, those losses are just sitting there and there are plenty of similar funds I could buy to keep me invested while locking in the loss to offset against future gains.

Therefore, the strategy in this case would be to sell the existing fund at a loss and buy something relatively similar so if the market rebounds I’m not missing out. For example:

  • Sell my Vanguard S&P 500 Fund at $10,000 loss.
  • Buy iShares S&P 500 Fund with proceeds. 
  • Recognize loss on tax return to be applied toward any recognized gains for the year or rollover for future years.

It’s important to note a few things:

  • Don’t simply just transfer to a different share class. IE) Vanguard SP500 Mutual Fund to Vanguard SP500 ETF, or Admiral Shares to Investor Shares. That’s considered substantially the same fund and your basis in the original fund will simply transfer under wash sale rules.
  • If you prefer your original fund to the substitute, don’t buy it back too soon. You must hold the new fund for a good 30 days before switching back, otherwise you’ll again trigger wash sale rules.
  • You’re lowering your basis which could be the reason for a gain in the future.
    • You bought Vanguard S&P for $10,000, it’s now at $5,000. You harvest the loss. 
    • You buy iShares S&P500 for $5,000. This is now your new basis.
    • In the future you sell iShares S&P500 for $15,000, you owe tax on the $10,000 gain, whereas if you had just kept Vanguard and sold for $15,000, you’d only be paying tax on a $5,000 gain.

The benefit in harvesting the loss really comes down to the flexibility in how you’ll be able to apply the loss.

In years where there isn’t a general downturn but just one asset class is suffering, you can certainly apply this strategy depending on your investment style. Wealth managers typically use a number of funds that pinpoint specific asset classes and take advantage of this strategy whenever possible. For example, you would see a list of fund descriptions like large-cap value, mid-cap growth, emerging markets, international, real estate, commodities, US Bonds, etc.

But robo-advisors tend to buy a handful of broader funds or may even buy just a single target-date fund. While the allocation is typically still well diversified as the broader funds capture multiple asset classes, it’s difficult to harvest losses of any specific asset class. IE: a well performing S&P500 index may outweigh the drag of a poorly performing commodity index within a broad based fund. 

This post is about long-term gains, but you may be wondering about short-term

You’d go about harvesting losses the same way. Short-term losses (investment owned less than 1 year) first offset short-term gains just as long-term losses offset long-term gains. However, once losses in one term category exceed the same type, you can then use them to offset the other category.  The main difference between the types of gains are that short-term gains are taxed at ordinary income brackets vs the preferred capital gains brackets.

There are some other things to consider as well which I’ve put together in this guide: 

What Issues Should I Consider With Tax Loss Harvesting