# How To Calculate Taxes On Stock Capital Gains With Examples I was recently attempting to determine the best time to sell some of my stocks based on capital gains tax rates. I knew that you generally want to wait to sell until after holding for at least one year to take advantage of lower tax rates for long-term capital gains, but I was unsure how exactly these lower rates worked. I tried looking up some articles online about calculating these taxes and filled out the Qualified Dividends and Capital Gain Tax Worksheet in the 2020 Instructions for Form 1040 (page 35) with hypothetical values, but the numbers were not making sense to me. After several hours of research, I finally figured out the problem: many of the websites I had looked at had oversimplified capital gains tax rates. To prevent others from facing the same difficulties, I have decided to share what I have found and make it easier for you to calculate these taxes.

I should preface this be noting that I am not a tax professional and that you should consult with a tax professional about your personal situation and any questions or problems that may arise when filling out your tax returns. That said, I hope this information is helpful and can clear up any confusion.

## What are capital gains?

Capital gains are profits that result from selling an asset, such as shares of a stock, real estate, collectibles, etc. There are different rules (and exceptions) for different assets, so I’m just going to focus on stocks here. For more information, see the 2020 Instructions for Schedule D.

## What is the difference between short-term and long-term capital gains?

Capital gains are split into two types based on the length of time you held the asset (in this case, stock) before selling. Short-term gains are those that occur within 1 year of purchasing the asset. Long-term gains are those that occur after 1 year. This means that if you sell a stock before holding it for a year, this is a short-term gain. If you sell it after holding it for a year, this is a long-term gain. Long-term capital gains are taxed at lower rates than short-term gains.

## How do you calculate taxes on short-term capital gains?

Taxes on short-term capital gains are based on tax rates for ordinary taxable income. These tax rates are as follows for 2020, depending on your filing status:

To calculate how much tax you will pay, you add up all of your taxable income (after deductions) including your short-term capital gains and then break that value into parts according to the thresholds in the table. You then apply the tax rate to each part as necessary and add up the taxes for each tax bracket to determine your total taxes.

Keep in mind that for calculating taxes for your actual return, you will need to use the IRS Tax Tables (in the Instructions for Form 1040) for taxable income under \$100,000.

### Example

• Filing status: single
• Ordinary taxable income: \$70,000
• Short-term capital gains: \$20,000
1. Calculate total taxable income: \$70,000 + \$20,000 = \$90,000
2. Break total into parts according to the tax rates table:
1. Multiply each part by the corresponding tax rate to get the tax for each tax bracket.
1. Add up the taxes for each tax bracket to calculate the total taxes: \$987.50 + \$3,630 + \$9,988 + \$1,074 = \$15,679.50

To calculate the effective tax rate, calculate what percentage the total taxes are out of the total taxable income: \$15,679.50/\$90,000 x 100 = 17.4%

If you are curious what the taxes are on only the short-term capital gains, separate the total income back into income and short-term capital gains and determine how much of the short-term capital gains are subject to each tax rate. Generally you would consider the capital gains on top of your normal income, which means that they are subject to the higher rates. This is how that would look in the previous tables with capital gains shown in bold:

Based on the tables, you can see that the taxes on the short-term capital gains are: \$3,415.50 + \$1,074 = \$4,489.50

This means that the effective tax rate on the short-term capital gains are: \$4,489.50/\$20,000 x 100 = 22.4%

## How do you calculate taxes on long-term capital gains?

Calculating taxes on long-term capital gains is somewhat different. Here are the long-term capital gains tax rates for 2020, based on filing status:

As you can see, the tax rates on long-term capital gains are much lower than tax rates on ordinary income and short-term capital gains. However, it’s not as simple as it appears. The dollar values in the table are not based on investment income; they are your total taxable income: ordinary income plus long-term capital gains. This means that the tax rate is not 0% for the first \$40,000 of long-term capital gains for a single filer, a common misconception. Instead, it is only 0% if the total taxable income is \$40,000 or less.

The calculation is simple if your ordinary income and your total taxable income are both in the same tax bracket. Then you can just multiply your long-term capital gains by the appropriate tax rate (see Example 1 below). Most articles on the internet that I came upon with a quick search assume this is always the case, which can be quite misleading because often your long-term capital gains can push your total taxable income into the next tax bracket. In that case, the capital gains will be split between tax brackets (see Examples 2 and 3 below).

### Example 1 – Simple Case

• Filing status: married filing jointly
• Ordinary taxable income: \$90,000
• Long-term capital gains: \$30,000
1. Calculate total taxable income: \$90,000 + \$30,000 = \$120,000
2. Check to see which tax bracket the ordinary income and total income fall into: both \$90,000 and \$120,000 are in the 15% tax bracket
3. Multiply the long-term capital gains by the appropriate tax rate: \$30,000 x 0.15 = \$4,500

Note: To calculate the total taxes owed, you calculate the taxes on ordinary income as shown above for short-term capital gains and then add the taxes for long-term capital gains. In this case, the taxes on ordinary income would be: (\$19,750 x 0.1) + (\$60,500 x 0.12) + (\$9,750 x 0.22) = \$1,975 + \$7,260 + \$2,145 = \$11,380. The total taxes would be: \$11,380 + \$4,500 = \$15,880. The effective tax rate would be: \$15,880/\$120,000 x 100 = 13.2%. For comparison, with short-term capital gains instead, the total taxes would have been \$17,980 and the effective tax rate would have been 15.0%. As you can see, waiting to sell an asset in order to have long-term capital gains rather than short-term capital gains can save you a lot of money.

### Example 2 – Complex Case 1

• Filing status: married filing jointly
• Ordinary taxable income: \$50,000
• Long-term capital gains: \$70,000
1. Calculate total taxable income: \$50,000 + \$70,000 = \$120,000
2. Check to see which tax bracket the ordinary income and total income fall into: \$50,000 is in the 0% tax bracket and \$120,000 is in the 15% tax bracket
3. Separate the long-term capital gains into appropriately sized amounts on either side of the tax bracket cutoff:
• 0%: \$80,000 – \$50,000 = \$30,000
• 15%: \$120,000 – \$80,000 = \$40,000
4. Multiply the long-term capital gains parts by the appropriate tax rates:
• 0%: \$30,000 x 0 = \$0
• 15%: \$40,000 x 0.15 = \$6,000
5. Add up the taxes from the different tax brackets: \$0 + \$6,000 = \$6,000

The effective tax rate on the long-term capital gains is: \$6,000/\$70,000 x 100 = 8.6%

Note: Again, to calculate the total taxes owed, you calculate the taxes on ordinary income as shown above for short-term capital gains and then add the taxes for long-term capital gains. In this case, the taxes on ordinary income would be: (\$19,750 x 0.1) + (\$30,250 x 0.12) = \$1,975 + \$3,630 = \$5,605. The total taxes would be: \$5,605 + \$6,000 = \$11,605. The effective tax rate would be: \$11,605/\$120,000 x 100 = 9.7%. You’ll notice that this is much lower than in Example 1 even though the total taxable income is the same because more of the total taxable income was long-term capital gains rather than ordinary income.

### Example 3 – Complex Case 2

• Filing status: married filing jointly
• Ordinary taxable income: \$50,000
• Long-term capital gains: \$500,000
1. Calculate total taxable income: \$50,000 + \$500,000 = \$550,000
2. Check to see which tax bracket the ordinary income and total income fall into: \$50,000 is in the 0% tax bracket and \$550,000 is in the 20% tax bracket
3. Separate the long-term capital gains into appropriately sized amounts on each side of the tax bracket cutoffs:
• 0%: \$80,000 – \$50,000 = \$30,000
• 15%: \$496,600 – \$80,000 = \$416,600
• 20%: \$550,000 – \$496,600 = \$53,400
4. Multiply the long-term capital gains parts by the appropriate tax rates:
• 0%: \$30,000 x 0 = \$0
• 15%: \$416,600 x 0.15 = \$62,490
• 20%: \$53,400 x 0.2 = \$10,680
5. Add up the taxes from the different tax brackets: \$0 + \$62,490 + \$10,680 = \$73,170

The effective tax rate on the long-term capital gains is: \$73,170/\$500,000 x 100 = 14.6%

Note: Again, to calculate the total taxes owed, you calculate the taxes on ordinary income as shown above for short-term capital gains and then add the taxes for long-term capital gains. In this case, the taxes on ordinary income would be: (\$19,750 x 0.1) + (\$30,250 x 0.12) = \$1,975 + \$3,630 = \$5,605. The total taxes would be: \$5,605 + \$73,170 = \$78,775. The effective tax rate would be: \$78,775/\$5500,000 x 100 = 14.3%. This does not include additional taxes on high-income taxpayers, which are described below.

## Other taxes on investment gains

Keep in mind that the percentages indicated above do not include additional taxes on high-income taxpayers, such as the Net Investment Income Tax (NIIT) and the additional Medicare tax.

Taxpayers will need to pay the NIIT when their modified adjusted gross income is greater than \$200,000 for single or head or household, \$250,000 for married filing jointly or qualifying widow(er), or \$125,000 for married filing separately. This tax is equal to 3.8% of the lesser of net investment income or the excess modified adjusted gross income (MAGI) over the threshold. (For Example 3 above, the tax would be equal to 3.8% of the excess MAGI over the threshold because \$550,000 – \$250,000 = \$300,000 is less than \$500,000. The tax would be: \$300,000 x 0.038 = \$11,400.)

The additional Medicare tax is required if your income is over \$200,000 for single, head of household, or qualifying widow(er), \$250,000 for married filing jointly, or \$125,000 for married filing separately. This tax is equal to 0.9% of the income exceeding the threshold. (For Example 3 above, the tax would be equal to 0.9% of \$550,000 – \$250,000 = \$300,000. The tax would be: \$300,000 x 0.009 = \$2,700.)

## Capital gains tax calculator

If you are still confused about how the taxes are calculated on capital gains, try out this 2020-2021 capital gains tax calculator.