Explore All Topics

How to calculate capital gains tax

7 min read

7 min read

At a glance

The first step in how to calculate capital gains tax is generally to find the difference between what you paid for your asset or property and how much you sold it for — adjusting for commissions or fees. Depending on your income level, and how long you held the asset, your capital gain on your investment income will be taxed federally between 0% to 37%.


When you sell a capital asset like a mutual fund, exchange-traded fund (ETF), or stock, there’s a tax implication. But knowing what tax rate applies depends on several factors. In this post, we’ll outline capital gains taxes and how to calculate them for tax purposes.
What is capital gains tax?

First, let’s define what a capital gain or loss is. A capital gain or loss is the difference between what you paid for a capital asset (like bonds, mutual funds, ETFs, real property, or stocks) and what you sold it for. If you sell your investment assets (for example, assets that make investment income such as dividend paying stocks) for more than you bought it, you’ll have a capital gain — If the opposite is true and you sell the asset for less than you bought it, you’ll have a capital loss.

Capital gains tax is the taxation of capital assets. Your capital gains tax rate is determined by:

• The length of time you own the asset (called the holding period), and
• your level of taxable income.

We’ll outline how your taxable income relates to short-term and long-term capital gains in detail below.

Take note: You don’t have to pay capital gains tax for an unrealized gain on an investment capital asset you own but haven’t sold yet. (An unrealized gain or loss is the change in an investment asset’s value that hasn’t been sold yet.)

How to calculate capital gains tax — step-by-step

The basics of a capital gain calculation is to find the difference between what you paid for your investment asset or property and what you sold it for. Let’s take it step-by-step and find out the answer to “How does capital gains tax work?”

Capital gain calculation in four steps

  1. Determine your basis. This is generally the purchase price plus any commissions or fees paid. Basis may also be increased by reinvested dividends on stocks and other capital assets.
  2. Determine your realized amount. This is the sale price minus any commissions or fees paid.
  3. Subtract your basis (what you paid) from the realized amount (how much you sold it for) to determine the difference.
    ○ If you sold your assets for more than you paid, you have a capital gain.
    ○ If you sold your assets for less than you paid, you have a capital loss. Learn how you can use capital losses to offset capital gains tax.
  4. Review the descriptions in the section below to know which tax rate may apply to your capital gains.
    Looking for a capital gains tax calculator? When you file with H&R Block Premium, your capital gains calculation is built in and your gains are factored in to your overall taxes. Of course, you could also get help from our tax pros when you file.

File with H&R Block to get your max refund

The capital gains tax rate: Short vs. long

capital gains tax

At this point, you may know you have a gain (or a loss). But you may also be wondering how much is capital gains tax?  Well, that will depend on if it’s a short- or long-term capital gain. Here, we’ll outline the differences. 

Short-term capital gain tax

Short-term capital gains are gains that apply to assets or property you held for one year or less. They are subject to ordinary income tax rates meaning they’re taxed federally at either 10%, 12%, 22%, 24%, 32%, 35%, or 37%.

Long-term capital gains tax

Long-term capital gains apply to assets that you held for over one year and are taxed differently. The federal tax rate for your long-term capital gains depends on where your taxable income falls in relation to three cut-off points, as outlined in the tables below.

2023 long-term capital gains tax rate  by filing status

Tax filing status0% tax rate15% tax rate20% tax rate
SingleUp to $44,625$44,626 to $492,300$492,301 and up
Married Filing SeparatelyUp to $44,625$44,626 to $276,900$276,901 and up
Head of HouseholdUp to $59,750$59,751 to $523,050$523,051 and up
Married Filing JointlyUp to $89,250$89,251 to $553,850$553,851 and up

2024 long-term capital gains tax rate by filing status

Tax filing status0% tax rate15% tax rate20% tax rate
SingleUp to $47,025$47,026 to $518,900$518,901 and up
Married Filing SeparatelyUp to $47,025$47,026 to $291,850$291,851 and up
Head of HouseholdUp to $63,000$63,001 to $551,350$551,351 and up
Married Filing JointlyUp to $94,050$94,051 to $583,750$583,751 and up

Source: IRS

Note: Gains on the sale of unexcluded qualified small business stock and collectibles (antiques, works of art, rugs, gems, metals (like gold, silver, and platinum bullion), coins, alcoholic beverages, and stamps that are capital assets) are taxed at a maximum rate of 28%. Also, gains attributable to depreciation on Section 1250 real property (also called unrecaptured Section 1250 gain) are taxed at a maximum rate 25%. The numbers above don’t include the net investment income tax of 3.8%.

How to avoid capital gains tax — or minimize capital gains

If you’re looking to reduce or avoid capital gain taxes altogether, there are some smart (and fully acceptable) strategies to pursue. Here are some best practices, broken down by scenario:

Minimizing capital gains for homeowners

  • Selling your home? If you’re selling your primary residence, the home sale exclusion (Section 121 Exclusion) can help you save on taxes. The exclusion amount is $250,000 if you’re filing status is Single and $500,000 if your filing status is Married Filing Jointly. 

Minimizing capital gains for investors

  • Consider the timing of selling off your assets. While the length of time the asset has been held shouldn’t solely drive investment decisions, know that if you keep them for more than a year, your assets could be subject to less tax. This is because long-term capital gains generally have a more favorable tax rate. Additionally, qualifying expenses, such as fees and commissions, on capital investments can help reduce taxes, too. Investors with a loss may also be able to take advantage of a strategy called tax loss harvesting. Investment losses can be deducted from gains in a process called netting.
    • Your long-term gains and losses are combined (or netted).
    • Your short-term gains and losses are netted.  
    • Your long-term and short-term gains, losses, or both are combined.
    • If the resulting number is positive, you are taxed on your gains at the appropriate short-term or long-term rates.
    • If the resulting number is negative, the excess loss amount you incur can lower your ordinary income by a maximum of $3,000 per year (or $1,500 if Married Filing Separately). If the loss exceeds $3,000, you can carry over the loss and deduct it from capital gains in future tax years.
  • Saving for retirement? Consider retirement plans such as Traditional or Roth IRAs .These tax-advantaged accounts can grow tax-free or tax-deferred until distribution. See the rules to learn more.
    • Traditional IRA: You can potentially get a deduction for your contributions to a traditional IRA. You are not taxed on your earnings in your traditional IRA until you take a distribution. Your qualified distributions from a traditional IRA are taxable at ordinary income rates.
    • Roth IRA: You contribute after tax money into your Roth IRA. Your Roth IRA grows tax free. Your qualified distributions from a Roth IRA are tax free.

Capital gains taxes and your tax forms

You’ll need to show your purchase and sale information of your sold assets to the Internal Revenue Service. Thankfully, a few standard IRS forms make it possible.

1. You can use IRS Form 8949 to report details of your capital asset transactions. You should complete this form for each transaction that resulted in a capital gain or loss in the tax year.

2. After completing Form 8949, report the gains and losses on Schedule D. This form summarizes capital gains and losses throughout a tax year.

3. Transfer the information on Schedule D to line 7 of Form 1040, U.S. Individual Income Tax Return.

More help with navigating capital gains tax

If you still have capital gain tax questions, let H&R Block help.

Make an appointment with one of our tax pros today.

Or if you prefer to file on your own, H&R Block Premium can help you file your taxes this tax year and calculate capital gains taxes.

However you choose to file, we’re dedicated to making sure you’ve filed with accuracy so you get the biggest refund possible – guaranteed.

Was this topic helpful?