Home Academic Skills Childhood Education Freelancing & Remote Jobs Physical Education Free Tools →
Saturday, December 5, 2026
Tax tools

Capital Gains Tax Calculator

Use this free capital gains tax calculator to work out what you owe when you sell a stock, a fund, crypto, a collectible, or a home. Enter what you paid, what you sold it for, and how long you held it, and it shows your gain, the federal tax at the short-term or long-term rate, the extra 3.8% net investment income tax if it applies, your state tax, and what you keep after tax.

Your sale

Use the numbers from your buy and sell records. Your cost basis is usually what you paid, plus any fees you paid to buy.

$

The price you paid, plus any fees to buy. Improvements you made to a home also add to the basis.

$

The sale price before any selling costs are taken out.

$

Broker fees, commissions, and closing costs. These lower your taxable gain.

Collectibles and a home follow different rules from stocks.

Count from the day after you bought it. Selling on the one-year anniversary is still short-term.

$

Your taxable income from salary and other sources, after deductions. It decides which rate your gain is taxed at.

Your state income tax rate on the gain. Use 0 if your state has no income tax. Some states tax gains as ordinary income.

How much tax do you pay on a capital gain?

A short-term gain, on something you held for one year or less, is taxed as ordinary income, up to 37%. A long-term gain, on something you held for more than one year, is taxed at 0%, 15%, or 20%, depending on your taxable income. For example, a single filer with $60,000 of other taxable income who sells stock for a $14,500 long-term gain pays $2,175 in federal tax and $725 in state tax at a 5% state rate, for $2,900 in total tax, and keeps $31,600 of the $35,000 sale price after selling costs and tax.

How to use this capital gains tax calculator

  1. Enter what you paid and what you sold it for. Your cost basis is what you paid plus any fees to buy. Add your selling costs too, because they lower your gain.
  2. Choose what you sold and how long you held it. Stocks, collectibles, and a home follow different rules, and holding for more than one year usually means a lower rate.
  3. Enter your other taxable income and filing status. Your other income fills up the low-rate bands first, so it decides which rate your gain is taxed at.
  4. Add your state tax rate. Use 0 if your state has no income tax. The calculator applies your state rate to the taxable gain.
  5. Read your result. The result shows your gain, the federal tax, the net investment income tax if it applies, your state tax, your total tax, and what you keep after tax.

How capital gains tax is calculated

Capital gains tax is the tax on the profit from selling something for more than you paid for it. A capital gain is the sale price minus your cost basis minus your selling costs. The tax on that gain depends on what you sold, how long you held it, and how much other income you have. The calculator follows five steps.

Capital gain = Sale price − Cost basis − Selling costs

Step 1: Find your gain

Start with the sale price, subtract what you paid, and subtract your selling costs. If you bought stock for $20,000, paid $500 in broker fees to sell, and sold for $35,000, your gain is $35,000 minus $20,000 minus $500, which is $14,500. If you improved a home, the cost of the improvements adds to your basis and lowers the gain. If the result is below zero, you have a capital loss, not a gain, and this calculator shows no tax on the sale.

Step 2: Check how long you held it

Start counting the day after you bought. If you sell after more than one year, the gain is long-term and gets the lower 0%, 15%, or 20% rates. If you sell within one year, the gain is short-term and is taxed as ordinary income, at the same rates as your salary, up to 37%. Selling on the exact one-year anniversary is still short-term, so wait one more day for long-term treatment. If the shares came from an RSU vest, your cost basis is the price on the vest date, and the RSU tax calculator works out the tax at vest and the gain when you sell.

Step 3: Stack the gain on top of your other income

A long-term gain is not taxed at one flat rate. It stacks on top of your other taxable income, and the slices fall into the 0%, 15%, and 20% bands. Your other income fills the bands first, so a gain can be split across two or three rates at once. For example, a single filer with $40,000 of other taxable income and a $25,000 long-term gain has $11,050 of the gain taxed at 0% and the other $13,950 taxed at 15%, for $2,092.50 in federal tax. The same gain with $60,000 of other income is taxed at 15% on the full $25,000, because the other income already fills the 0% band. This stacking rule is why the calculator asks for your other taxable income.

Step 4: Add the net investment income tax if it applies

On top of the rates above, a 3.8% net investment income tax applies to investment income when your modified adjusted gross income is over $200,000 for single and head of household filers, or $250,000 for married couples filing jointly. The tax applies to the smaller of your investment income or the amount over the threshold. These thresholds are fixed by law and do not rise with inflation, so they catch more people every year. The calculator estimates your modified adjusted gross income as your other taxable income plus the standard deduction plus the gain, and applies 3.8% to the part of the gain above the threshold.

Step 5: Add state tax and work out what you keep

Most states tax capital gains, and most of them tax gains at the same rate as ordinary income. A few states have no income tax at all. The calculator applies the state rate you enter to the taxable gain. Your after-tax proceeds are the sale price minus selling costs minus total tax. That is the cash you actually keep from the sale.

Long-term capital gains tax rates by filing status

The 0% and 15% limits below are limits on your total taxable income, including the gain, not limits on the gain alone. The rates come from the latest IRS inflation adjustments. Tax figures change with inflation, so check the current figures before you file.

Filing status0% up to15% up to20% above
Single$51,050$563,200$563,200
Married filing jointly$102,100$633,600$633,600
Head of household$68,350$598,400$598,400
Married filing separately$51,050$316,800$316,800

Example: a single filer with $100,000 of taxable income including the gain pays 15% on the long-term gain, because $100,000 is above the 0% limit of $51,050 and below the 20% limit of $563,200.

Capital gains tax by asset type

Not every asset follows the 0%, 15%, and 20% schedule. The table below shows the main differences. Short-term gains are taxed as ordinary income for every asset type, up to 37%.

AssetLong-term rateWhat is different
Stocks, funds, ETFs, crypto0%, 15%, or 20%The standard schedule. Crypto follows the same rules as stocks.
Collectibles (art, coins, gold, antiques)Up to 28%The rate is a maximum of 28%. If your ordinary rate is lower, the lower rate applies.
Primary residence0% up to the exclusionExclude up to $250,000 of gain if single, or $500,000 if married filing jointly, if you owned and lived in the home for at least 2 of the last 5 years. Gain above the exclusion is taxed at the long-term rates.
Rental real estateUp to 25% on depreciationThe part of the gain from depreciation you claimed is taxed at up to 25%. This calculator does not model that part.

The home exclusion can be used only once every two years, and you cannot have used it on another home sale in the prior two years.

Capital gains tax examples

Each example below was worked out with the calculator above, using a 5% state tax rate unless the example says otherwise.

Example 1: A short-term stock sale

A single filer with $60,000 of other taxable income buys stock for $10,000, pays $200 in broker fees, and sells within a year for $18,000. The gain is $7,800. Because the gain is short-term, it is taxed as ordinary income: $1,716 in federal tax. State tax at 5% adds $390. Total tax is $2,106, and the seller keeps $15,694 of the sale after selling costs and tax. The effective tax rate on the gain is 27%.

Example 2: A long-term stock sale

A single filer with $40,000 of other taxable income buys stock for $25,000 and sells after two years for $50,000, with no selling costs. The gain is $25,000. The first $11,050 of the gain falls under the 0% limit and is tax-free, and the other $13,950 is taxed at 15%, for $2,092.50 in federal tax. State tax at 5% adds $1,250. Total tax is $3,342.50, and the seller keeps $46,657.50. The same $25,000 gain with $60,000 of other income would pay $3,750 in federal tax, because the other income already fills the 0% band.

Example 3: Selling a home with the exclusion

A married couple buys a home for $300,000, lives in it for six years, pays $20,000 in closing costs, and sells for $620,000. The gain is $300,000, and the $500,000 exclusion for joint filers covers all of it, so the federal and state tax on the sale is $0 and the couple keeps $600,000. A single filer who buys for $200,000, pays $10,000 in closing costs, and sells for $500,000 has a $290,000 gain. The $250,000 exclusion leaves $40,000 taxable. With $60,000 of other taxable income, that $40,000 is taxed at 15%, for $6,000 in federal tax and $2,000 in state tax at 5%, a total of $8,000, and the seller keeps $482,000.

Example 4: A high earner and the net investment income tax

A single filer with $250,000 of other taxable income sells stock for a $50,000 long-term gain. The federal tax at 15% is $7,500. The net investment income tax also applies: modified adjusted gross income is about $316,600, which is $116,600 over the $200,000 threshold, so 3.8% applies to the full $50,000 gain, adding $1,900. State tax at 5% adds $2,500. Total tax is $11,900, and the seller keeps $138,100 of the $150,000 sale price.

Example 5: Selling a collectible

A single filer with $60,000 of other taxable income sells a painting bought for $10,000 for $30,000, after holding it for three years. The gain is $20,000. Collectibles are taxed at up to 28%, but the rate cannot be higher than the ordinary rate, and this filer is in the 22% bracket, so the federal tax is 22% of $20,000, which is $4,400. State tax at 5% adds $1,000. Total tax is $5,400, and the seller keeps $24,600.

Example 6: The same sale, short-term versus long-term

A single filer with $60,000 of other taxable income sells stock for a $20,000 gain. Sold within a year, the gain is taxed as ordinary income at 22%, for $4,400 in federal tax. Held for more than a year, the same gain is taxed at 15%, for $3,000. Waiting past the one-year mark saves $1,400 in federal tax on this sale, and state tax is the same either way.

Tax on a $20,000 gain by income and holding period

The table below shows the federal tax on the same $20,000 gain for a single filer at four income levels. State tax is not included. The net investment income tax starts to apply at the highest income level.

Other taxable incomeLong-term federal taxShort-term federal taxNet investment income taxSaved by holding long-term
$30,000$0$2,400$0$2,400
$60,000$3,000$4,400$0$1,400
$100,000$3,000$4,617.50$0$1,617.50
$200,000$3,000$5,734$760$2,734

At $30,000 of other income, the whole $20,000 gain falls under the 0% limit, so the long-term federal tax is $0. At $200,000, the net investment income tax adds $760 on top of the rates above.

What pushes your gain into a higher rate

Your other income decides the rate on your gain, because it fills the low-rate bands first. A bonus, a second job, or a pay rise can push a gain that would have been taxed at 0% into the 15% band, or a gain at 15% into the 20% band. The raise calculator shows how a higher salary changes your take-home pay, and the same higher income also raises the rate on any gain you sell in that year. Two things help: selling in a year when your other income is lower, and spreading a large sale across two tax years so the gain is split between them.

How to lower your capital gains tax

  • Hold for more than one year. The long-term rates of 0%, 15%, and 20% are lower than ordinary income rates for most people. Waiting past the one-year mark is the simplest saving.
  • Harvest losses. Capital losses first offset capital gains. If your losses are larger than your gains, up to $3,000 of the extra loss can offset other income each year, and the rest carries forward to later years.
  • Hold investments inside a retirement account. Gains inside a 401(k) or IRA are not taxed when the investment is sold. The 401k calculator shows how a balance grows when the tax on each sale is deferred until retirement.
  • Use the home exclusion. If you sell your main home, the $250,000 or $500,000 exclusion can wipe out the tax entirely. Make sure you meet the two-out-of-five-years ownership and use tests before you sell.
  • Give appreciated shares instead of cash. Donating shares you have held for more than a year to a charity usually means no capital gains tax on the gift, and you may still deduct the full value.
  • Watch the wash sale rule. If you sell a stock at a loss and buy the same stock back within 30 days, the loss is not allowed. Wait out the 30 days before you buy it back.

What happens when you file

Capital gains are reported on Schedule D with your tax return, and the gain is taxed in the year you sell, not the year you get paid if the payment is spread out. If you sell for a large gain, the tax may be due before your return is filed, so many people pay estimated tax during the year to avoid a penalty for underpayment. Your broker sends a Form 1099-B that shows the sale price, and it usually shows your cost basis too, so check that the basis on the form matches your own records. If you had too much tax withheld during the year, the tax refund calculator shows whether the gain leaves you with a refund or an amount owed.

What this calculator does not include

  • Unrecaptured Section 1250 gain on rental real estate, taxed at up to 25% on the depreciation part of the gain.
  • Qualified small business stock, where part of the gain can be excluded under Section 1202.
  • The wash sale rule, installment sales, like-kind exchanges, and the alternative minimum tax.
  • Depreciation recapture on business property and depreciation taken on a home office.
  • State rules that differ from the federal rules, such as states that tax gains at a flat rate or do not follow the federal long-term rates.
  • Estimated tax penalties. The calculator shows the tax on the gain, not any penalty for paying late.

Capital gains tax calculator FAQs

How much tax do you pay on capital gains?
It depends on how long you held the asset and your income. Short-term gains are taxed as ordinary income, up to 37%. Long-term gains are taxed at 0%, 15%, or 20%, plus 3.8% net investment income tax for higher earners and state tax on top.
What is the difference between short-term and long-term capital gains?
A gain is short-term if you held the asset for one year or less, and long-term if you held it for more than one year. Short-term gains are taxed at your ordinary income rate. Long-term gains get the lower 0%, 15%, and 20% rates. Count from the day after you bought, and selling on the exact one-year anniversary is still short-term.
How do I calculate capital gains tax?
First find the gain: sale price minus cost basis minus selling costs. Then check the holding period. A long-term gain stacks on top of your other taxable income, so the slices fall into the 0%, 15%, and 20% bands. Add the 3.8% net investment income tax if your income is over the threshold, then add state tax.
Who pays 0% capital gains tax?
Single filers with total taxable income up to $51,050, married couples filing jointly up to $102,100, and heads of household up to $68,350 pay 0% on long-term gains. These limits are on total taxable income including the gain, so other income counts toward them.
Do I pay capital gains tax when I sell my house?
Often no. If you owned and lived in the home for at least 2 of the last 5 years, you can exclude up to $250,000 of gain if single, or $500,000 if married filing jointly. Only the gain above the exclusion is taxed, at the long-term rates.
Are collectibles taxed at 28%?
Long-term gains on collectibles such as art, coins, stamps, and gold are taxed at a maximum rate of 28%. The rate cannot be higher than your ordinary income rate, so if your ordinary rate is lower, the lower rate applies. Short-term collectible gains are taxed as ordinary income.
What is the net investment income tax?
It is an extra 3.8% tax on investment income, including capital gains, when modified adjusted gross income is over $200,000 for single and head of household filers, or $250,000 for married couples filing jointly. It applies to the smaller of your investment income or the amount over the threshold.
Can capital losses offset capital gains?
Yes. Capital losses first offset capital gains in the same year. If your losses are larger than your gains, up to $3,000 of the extra loss can offset other income each year, and the rest carries forward to later years.
Do I pay state tax on capital gains?
In most states, yes. Most states tax capital gains at the same rate as ordinary income, and a few states have no income tax at all. A few states have their own flat rate for gains. Enter your state rate in the calculator to see the state part of the tax.
When do I pay capital gains tax?
The tax is due for the year you sell. If the gain is large, the tax may be due before you file your return, so many people pay estimated tax during the year to avoid an underpayment penalty. The gain is reported on Schedule D with your tax return.

More tax and pay tools

Official sources: IRS inflation adjustments, IRS Topic 409 on capital gains and losses, IRS Publication 550 on investment income and expenses, IRS Publication 523 on selling your home.

Syed Osama, developer at SkillGuidely
Designed & developed by

Syed Osama

Syed Osama is a digital publishing specialist who builds career metrics, financial calculators, and interactive web tools. He focuses on developing practical calculation resources to help remote workers, freelancers, and professionals make quick, accurate financial estimations.

This calculator gives an estimate for education only. It is not tax, legal, or financial advice. Tax rules, rates, and limits change. Always check the current figures with the IRS and talk to a tax professional before you sell or file.