A combine harvest a field of grain
Ruslan Khismatov/Shutterstock.com

Kiss your poor investment goodbye and get a tax break for doing it – that’s the idea behind tax-loss harvesting. And it can be a smart move to make as the year ends, as the potential to realize a gain on your underperforming investment wanes.

Here’s how to maximize your upside when tax-loss harvesting and what to watch out for so that you don’t run afoul of IRS rules on the practice.

How tax-loss harvesting works

Tax-loss harvesting is the process of writing off the losses on your investments in order to claim a tax deduction. To claim a loss on your current year’s taxes, you’ll have to sell the investment before the year ends, and then report the action when you file taxes for that year.

The IRS allows you to claim a net loss of up to $3,000 each year (for single filers and married filing jointly) from busted investments — and it’s usually a good idea to take full advantage. That $3,000 net loss could save you $720 in taxes at the 24 percent marginal tax bracket.

A write-off reduces any other capital gains you’ve earned during the tax year, and it’s important to note that the deduction is a “net” loss. For example, you can earn $5,000 on one investment and lose $8,000 on another, and you can still claim the maximum $3,000 deduction.

Even if you can’t claim the maximum $3,000 net loss, you can still reduce the value of your gains and save on taxes that way. So if you have $4,000 gain and a $1,000 loss, you’d have net earnings of $3,000, saving you taxes on the additional thousand dollars that you wrote off.

And if your losses spill over that $3,000 maximum? The IRS lets you push those extra losses into future tax years. So if your investments perform well next year and you realize some capital gains at that time, you can use prior unused losses to offset those future gains.

Tax-loss harvesting is valuable only in taxable accounts, not special tax-advantaged accounts such as IRAs and 401(k)s, where capital gains aren’t taxed annually (or sometimes at all – in the case of the Roth IRA.)

[READ: 10 steps you can take right now to reduce your tax bill]

Many robo-advisers will automate the process for you

Maximizing the tax break from your capital losses can require an extra level of effort, but it still can make a lot of sense for investors to do. But if you use a robo-adviser to manage your accounts – and robo-advisers do offer many benefits at a surprisingly low cost – then you can usually get tax-loss harvesting for no additional fee.

Robo-advisers can turbocharge tax-loss harvesting, doing more than most human advisers would be able to do. For example, robo-advisers use an automated process for maximizing your tax savings, and they may be checking daily to see if they can realize a loss on any fund. Then the robo-adviser buys a different but similar fund that mimics the performance of the original, so you end up with a tax benefit but still own a similar fund.

That’s one of the major benefits of a robo-adviser and many offer automatic rebalancing.

[READ: Top robo-advisers for your portfolio]

Three things to watch out for when harvesting a loss

Here are three things you’ll want to watch out for as you use this tax break.

1. Wash sales

Of course, the IRS has some restrictions in place to prevent you from gaming the rules on tax-loss harvesting. The most notable of these caveats is the “wash-sale rule,” which prevents you from claiming a taxable loss and then immediately rebuying the security. And it holds for your spouse, too – one can’t sell and claim the loss while the partner is buying in their own account.

Instead, if you want to report a loss on your taxes, then you (and your spouse) will have to avoid repurchasing the losing security for at least 30 days. If you do buy the security again within the 30 days, you must forgo the tax benefit. However, you won’t lose the tax benefit forever. When you do eventually sell the security again, you’ll be able to recover the tax benefit and write off the loss.

2. Long-term losses vs. short-term losses

The IRS insists that you offset like with like. That is, your long-term capital losses first offset long-term capital gains, while short-term losses first offset short-term gains. It’s an important distinction because capital gains are taxed based on how long you’ve owned the security. Only after you’ve summed up your results can you then offset short-term gains with long-term losses.

Long-term capital gains are taxed at special rates than can be lower than what you would otherwise pay for your ordinary income – 0, 15 and 20 percent, depending on your income. These rates apply to assets that you’ve held for more than one year.

Short-term capital gains are taxed at your ordinary income rate, which can run as high as 37 percent. These rates apply to assets that you’ve held for less than one year.

Brokerages will report your gains and losses to you and the IRS. However, their figures aren’t always right, especially in complicated tax situations, so it can be worthwhile to keep good records of your transactions.

3. Avoid selling just to get the tax break

It can be easy to sell an asset such as a stock only to get the tax break — a sure thing — while the future gain on the stock is anything but certain. That’s especially true since stocks can be quite volatile in the short term. But if you’re holding the stock for its long-term potential, not just for this tax year, you might reconsider whether it’s smart to sell for a capital loss.

Stocks are investments that tend to do well over long periods, and claiming a loss right now may mean you sell the stock just as it’s about to rebound. If there’s nothing fundamentally wrong about the investment, you might consider holding the investment rather than selling.

Bottom line

Tax-loss harvesting gives you an opportunity to score a tax break on a poor investment, and it’s a good opportunity to offset other taxable gains, especially if you think the investment will never recover. Consider taking maximum advantage in order to lessen your tax burden in any year.

Create a free Bankrate account to get expert advice, personalized lending offers and other resources tailored to your unique financial goals.

Learn more: