Most people know that holding on to their investments longer gives them preferential tax treatment. While short-term capital gains are taxed at your marginal income tax rate, long-term capital gains play by their own rules. And knowing one particular aspect of those rules could potentially save you up to $15,720 in taxes in any given year.

The 0% tax bracket

There are three tax brackets for long-term capital gains based on your total adjusted gross income. For 2020, the tax brackets look like this:

Tax Rate

Married Filing Jointly

Head of Household

Single

0%

Up to $80,000

Up to $53,600

Up to $40,000

15%

$80,001 to $496,600 

$53,601 to $469,050

$40,001 to $441,450

20%

Over $496,000

Over $469,050

Over $441,450

Data source: IRS.gov

Staying within that 0% tax bracket is the goal, but it requires careful planning. 

A person cutting a piece of paper with the word Taxes written on it.

Image source: Getty Images.

A couple making six figures in wages doesn't really have any room to take capital gains at 0% while they're working. But if they wait until retirement, when their work income drops to $0, they could theoretically realize capital gains up to $104,800 per year and pay absolutely no federal taxes on them. That number accounts for the $80,000 in the 0% long-term capital gains tax bracket and $24,800 for the standard deduction in 2020.

Paying the more typical 15% tax rate on that amount of gains would result in a $15,720 increase to the couple's federal income tax bill.

It's important to note that many states do not have preferential tax rates on long-term capital gains. You'll still owe state taxes on your gains at your state tax rate even if you're in the 0% federal income tax bracket.

Practical applications of the 0% tax bracket

It's unlikely any household will be able to max out the full $104,800 opportunity for 0% tax on long-term capital gains. It would require absolutely no other income and a lot of capital gains. But there is a more practical way to take advantage of the government's lowest tax bracket.

Investors should look to realize capital gains in years they know their income will be below the threshold for the 0% long-term capital gains tax bracket. For example, if near the end of the year, you expect to have about $60,000 in taxable income between you and your spouse after accounting for all your deductions, you could sell holdings with about $20,000 worth of gains and pay no additional federal taxes.

It's worth noting you can buy back those holdings immediately after selling them, permanently increasing your cost-basis. There's no wash-sale rule when selling holdings for a gain like there is when you take a loss. So, even if you don't need the income this year, you should look at selling some long-term holdings.

The impact on Social Security

Many people won't be able to start taking advantage of the 0% long-term capital gains tax bracket until they're retired and potentially taking Social Security benefits. Unfortunately, capital gains count toward your adjusted gross income, and therefore impact your "provisional income" (your AGI plus 50% of your Social Security benefits), which determines how much of your Social Security income is taxed.

For 2020, the provisional income limits are as follows:

Percent of Social Security Taxed

Married

Single

0%

Up to $32,000

Up to $25,000

50%

$32,001 to $44,000

$25,001 to $34,000

85%

Over $44,000

Over $34,000

Data source: IRS

To keep taxes as low as possible, you can take several steps. Before claiming Social Security benefits, increase your cost basis on taxable investments as much as possible by following the advice above.

In early years of retirement, try to balance IRA and 401(k) withdrawals with capital gains to keep taxes low. Once you start taking Social Security, try to manage your provisional income (which includes capital gains and traditional IRA and 401(k) withdrawals) to stay below the thresholds where your income gets taxed. Consider tapping your Roth accounts to supplement income if needed.

There are lots of ways to strategize and keep your taxes low, but the most important thing is to understand your options: when you'll owe extra taxes and when you won't. You can't make a plan if you don't know the rules. And in this case, knowing the rules can save you thousands of dollars.