The stock market has had a wild ride in 2020, and with three months left in the year, there's no guarantee that there won't be even more craziness to come. As the end of the year approaches, more people will start looking at tax planning in order to pay as little as possible to Uncle Sam in early 2021.

One great way to cut your tax bill is to harvest tax losses. However, investors never like to sell a stock when its price is low, especially if they think that it can bounce back.

What you'd like to do is sell the stock, take the loss, and then immediately buy it back so you can own it when it recovers. Can you do that?

Unfortunately, the answer is usually no. That's because of what are known as the wash sale rules -- what could be the most important tax rules for investors in 2020.

Pen, glasses, calculator, and cash with tax forms on a flat surface.

Image source: Getty Images.

Why wash sales are a problem

One of the biggest benefits of the U.S. tax laws is that most taxpayers don't have to recognize any increase in the value of their investments until they actually sell them. No matter how high a stock price goes, you're in the clear from a tax perspective as long as you don't cash out. Sell the shares, though, and you'll trigger a big capital gain that could send your tax bill higher.

But you also don't get to claim capital losses until you sell your stock. Even if the share price plunges, you won't get to take a tax loss until you sell.

What lawmakers realized, though, was that there's potential for some tax trickery. If you sell a stock to claim a loss but then immediately buy it back, then from an economic standpoint, it's almost as if you'd never sold it at all. Tax officials wanted to avoid that gamesmanship, so they created the wash sale rules.

The wash sale rules, explained

The most basic aspects of the wash sale rules are simple to understand. If you sell a stock or other investment at a loss and then buy it back within 30 days of the sale, then your capital loss will be disallowed. Instead, the loss will be wrapped into the tax basis for the newly purchased shares.

Plenty of investors have tried to get around the wash sale rules with more complex transactions. However, the rules generally prohibit those workarounds as well. Consider:

  • If you buy shares of stock within 30 days before you sell your original losing shares, then the wash sale rules will also prevent you from claiming a loss. That prevents you from temporarily doubling up on your position before selling.
  • If you buy an option to purchase the same stock you just sold, it triggers the wash sale rules the same way buying the shares outright would.
  • If you sell the stock in your regular brokerage account but buy it back in your IRA, the wash sale rules still disallow the loss.
  • If you buy shares of a "substantially identical stock" after selling, wash sale rules can also apply. This would likely be the case with a company that has two classes of common stock.

Some have argued that it should also apply to different ETFs that track the same benchmark. For instance, selling the SPDR S&P 500 ETF (SPY -0.05%) at a loss and immediately rebuying iShares S&P 500 ETF (IVV -0.04%) is as close to a substantially identical replacement as you're ever going to find. However, it doesn't fall quite as clearly under the wash sale rules -- even though it's easy to understand why it should.

Why it matters in 2020

The reason the wash sale rules will be so important in 2020 is that there are many people sitting on losses in individual stocks. Even though the overall market has held up well, much of the gains for the major benchmarks have come from just a handful of stocks. Many companies have seen their shares languish for much of the year.

In many cases, you'll feel like those companies have good long-term prospects. You won't want to sell forever. However, waiting 30 days can cause you to miss out on a big bounce.

Weigh your options

That's the choice you're faced with in dealing with the wash sale rules. Tax planning  isn't always easy, but your best course of action is to know the rules thoroughly and then to decide whether the tax loss is worth the risk of missing a move upward. There's no one right answer for everyone, and what you should do depends on your own individual situation.