Making money on investments is great news. Paying a portion of your profits to the IRS is less fun. But many investors can avoid paying taxes on most or all of their gains, while others can ensure they're taxed at a rate well below what they pay on ordinary income. 

How can you make sure the IRS doesn't take a big piece of your investment returns? There are two secrets to successfully keeping more money in your pockets and out of the government's coffers. 

Man completing tax paperwork with laptop and phone.

Image source: Getty Images.

1. Hold your investments for at least 12 months

First and foremost, the best and easiest way to avoid owing taxes on investments (or at least to substantially reduce the amount you owe) is to hold your investments for at least a year before selling them.

If you meet this milestone, you'll be taxed at the long-term capital gains rate, which is 0% for millions of Americans and much lower than the standard tax rate for others. The table below shows the long-term capital gains rates for 2020, which is the rate you'll pay in taxes on most investments held for at least a year. 

For single filers with taxable income of...

For married joint filers with taxable income of...

For heads of households with taxable income of...

...this is the long-term capital gains rate

$0 to $40,000

$0 to $80,000

$0 to $53,600


$40,000 to $441,450

$80,000 to $496,600

$53,600 to $469,050


Over $441,550

Over $496,600

Over $469,050


Data source: IRS.

If you don't hold your investments for at least 12 months, though, any profits will be considered short-term capital gains. And short-term capital gains aren't subject to the same favorable tax rules. Instead, if you sell an investment after holding it for less than a year, you'll generally be taxed at your ordinary income tax rate. That's much higher for most people, and is almost assuredly above 0%. 

2. Harvest your losses

While paying a 0% long-term capital gains rate on investment income is the easiest way to ensure the IRS doesn't share any of your investment profits, this isn't always possible. Your income may be too high or you may end up having to sell investments at a profit even when less than 12 months have passed (perhaps because you've lost confidence in the company's leadership or some other fundamental shift means holding the stock no longer makes sense). 

If you're going to owe taxes on gains, there's another technique to reduce your tax bill: tax loss harvesting. This involves strategically timing the sale of a losing investment to generate capital losses you can use to offset gains. Under the tax code, short-term or long-term losses must first be used to offset the same kind of gain, so consider this when employing this strategy. But any excess losses can be applied to reduce gains of the other type.

To employ tax loss harvesting successfully, you need to follow the rules, including not buying back the investment you sold for at least 30 days. And you don't want to sell investments at a loss if you think they could recover. But if you have some underperforming investments you want to off-load, strategically harvesting your losses could help you to keep that investment tax rate as close to 0% as possible -- especially in combination with an investing strategy that maximizes long-term gains rather than short-term ones.