The stock market provides investors with a great opportunity, but if you don't understand how holding periods work, you may also give up a lot of your gains through taxes.

The holding period is the amount of time you've owned a stock, and this time frame can be the difference between paying no taxes or giving up thousands of dollars to the IRS. To clear up any confusion around holding periods and how it may impact your tax bill, here are some points to remember as you prepare to file your tax return

Shot of a young woman using a laptop and calculator while working from home.

Image source: Getty Images.

Short-term capital gains

When you sell stock investments and earn a profit, you step into the world of capital gains. All this means is that you've made some money in the market and as a result, you owe the IRS a piece of your earnings. Your tax bill is partially determined by how long you've held the stock. 

If you kept your position for a year or less, you're subject to short-term capital gains tax rates. These rates can be pretty high, going up to 37% for higher-income earners. It's the same rate that you pay on your regular income from a job. When you are quick to sell your investments, you miss out on the favorable tax rates that come with long-term capital gains rates. 

Long-term capital gains 

If you are seeking to lower your tax bill, you want to unlock long-term capital gains rates, which give you access to 0%, 15%, or 20% tax brackets. These special rates require that you hold on to your stock for over a year. 

Let's say you bought 100 shares of Microsoft on Aug. 12, 2019, for $136 per share. Then, you sell 50 shares of this stock on Aug. 13, 2020, for $210 per share. Your return would be $74 per share, so in total, you would have a long-term capital gain of $3,700 that would fall into one of three favorable rate buckets, because you held your investment for just over a year.  

That's the secret to paying less in taxes. It's the magic time period in order to save money on your tax bill. As you can see from the table below, you can pay no taxes on long-term capital gains if your taxable income is less than $40,400 (as a single filer) or $80,800 (married, filing jointly). 

2021 long-term capital gains tax brackets

Single Filers; Taxable
Income of:

Married Filing Jointly;
Taxable Income of:

Heads of Households;
Taxable Income of:

Long-Term Capital
Gains Rate

$0 to $40,400

$0 to $80,800

$0 to $54,100

0%

$40,401 to $445,850

$80,801 to $501,600

$54,101 to $473,750

15%

Over $445,851 

Over $501,601

Over $473,751

20%

Data source: IRS.

The magic formula to calculate the holding period 

To calculate the holding period of your stock investments, begin counting on the day after you acquired the stock. Your holding period ends on the day you sell the shares. 

So if you bought 100 shares of stock on Jan. 1, 2019, start counting your holding period from Jan. 2, 2019. Therefore, this date becomes the basis for every new month no matter how many days are in the month. If you sold your shares on Jan. 1, 2020, you are hit with a short-term capital gains tax because your holding period is considered a year or less. On the other hand, if you sell your shares on Jan. 2, 2020, you've hit the long-term capital gains threshold. 

As you can see, one day can make a difference in the tax rates you qualify for and what you pay in taxes. Make sure you are calculating your holding period correctly so you aren't stuck with an unexpected tax bill when your broker sends you Form 1099-B with all your stock transactions for the year. 

Time is one of the greatest assets you have, and it can save you thousands of dollars during tax time. 

This article represents the opinion of the writer, who may disagree with the “official” recommendation position of a Motley Fool premium advisory service. We’re motley! Questioning an investing thesis -- even one of our own -- helps us all think critically about investing and make decisions that help us become smarter, happier, and richer.