If there's a single word that could describe not just the stock market in 2020, but 2020 in general, it's "volatile." In March, stocks plunged when news of the COVID-19 pandemic broke, and while they subsequently staged a comeback, September has already gotten off to a rocky start with a massive sell-off that hit the tech sector particularly hard.

As an investor, you're probably aware that it's important to stay calm when stocks bounce around. It's generally a good idea to avoid selling off stocks the moment their values decline because that's how you lock in permanent losses.

But in some cases, unloading a losing stock pays. If there's a specific investment in your portfolio that's underperforming, selling it at a loss could work to your advantage.

Downward-pointing arrows on a digital graph.

Image source: Getty Images.

How tax loss harvesting works

When you invest in an account that's not tax-advantaged -- meaning a traditional brokerage account, as opposed to a retirement plan like an IRA or 401(k) -- the moves you make in that account will directly impact your taxes. When you sell investments at a profit, you'll be hit with capital gains taxes that add to your IRS burden for the year. But when you sell investments at a loss, you can then use that loss to offset your capital gains, thereby reducing your tax burden.

How do you know which stocks to unload and which to keep? That's a complicated question, but a rough rule of thumb is that you shouldn't sell a stock that's generally been performing well, but is down because of a broad market decline. But if you have a stock that's been doing poorly when others have been holding steady, you may want to unload it before its value declines even more. Similarly, if you're concerned about certain market segments, and own stocks within them that are underperforming, those might be good candidates for a sale -- especially if you're looking at gains in your portfolio.

But offsetting capital gains isn't the only benefit of tax loss harvesting. If your losses exceed your gains, you can then use the remainder to offset up to $3,000 of ordinary income, which is taxed at your highest marginal tax rate). If you're still left with a loss after that, you can carry it forward to the following year and use it to your advantage then.

Don't wait too long to sell losing stocks

While it's a bad idea to panic-sell the moment your portfolio drops in value, you should pay attention to outliers in your portfolio that aren't as likely to recover. Accepting a loss isn't easy, but if there's a specific stock of yours that's only headed for disaster, you're better off unloading it when it's a little bit down, as opposed to waiting until it gets totally annihilated. While your goal should be to make money in your portfolio, remember that if you have to sell investments at a loss, your consolation prize is a tax break.