The U.S. tax code is extremely complex, which explains why there's such a perpetual need for accountants and tax preparers despite the abundance of software that lets us file taxes and do bookkeeping with ease. And while there's no need to spend your free time reading up on random tax laws, there are certain rules it definitely pays to follow. One rule, in fact, could end up saving you a world of money in the course of your investing career.

What you need to know about capital gains

Whenever you sell a stock at a price that's higher than what you bought it for, the IRS gets a share of your profits in the form of capital gains taxes. For example, if you buy a share of stock for $100 and its price increases to $150 over time, you don't get to keep that $50 to yourself. Rather, the IRS gets a chunk of it. But the amount of money the IRS is allowed to collect will depend on how long you hold that stock before selling it.

And that leads to our very important tax rule: Always aim to hold stocks for at least a year and a day before selling them.

Man at laptop with serious expression

Image source: Getty Images.

If you hold stocks for a year or less, you'll be liable for short-term capital gains taxes. Short-term capital gains are taxed like ordinary income, so the amount of money you'll lose to short-term gains will depend on the tax bracket you fall into.

Low and moderate earners are subject to a lower marginal tax rate than higher ones. For example, if you're single earning $50,000 a year, you'll land in the 22% tax bracket, which means that's the rate of tax you pay on your highest dollars of earnings. It also means that's the tax rate you'll pay on short-term capital gains.

On the other hand, if you hold stocks for at least a year and a day before selling them, you'll be propelled into the long-term capital gains category. And long-term gains come with a much more favorable rate, no matter your income.

Here's what long-term capital gains tax rates look like:

Income Range: Single Tax Filers

Income Range: Joint Tax Filers

Tax Rate on Long-Term Capital Gains

$0 to $40,000

$0 to $80,000

0%

$40,000 to $441,450

$80,000 to $496,600

15%

Over $441,550

Over $496,600

20%

Data source: IRS.

Now, going back to our example, if you're single earning $50,000 a year, your long-term capital gains tax rate will be 15%. That's lower than the 22% tax rate you'll pay on short-term gains. And that's why it's crucial to hold into your investments for a while before selling them. While the difference between a 15% tax rate and a 22% tax rate may not be substantial in the context of a $50 profit, if we're talking about thousands of dollars in profits, the stakes get a lot higher.

Chart showing how capital gains taxes work

Image source: Author.

Of course, you won't always be in a position to hold stocks a year and a day or longer. But if your goal is to keep your tax bill to a minimum, then it definitely pays to try.