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.
Designed & developed by Syed Osama
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.
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.
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.
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.
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.
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.
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.
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 status | 0% up to | 15% up to | 20% 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.
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%.
| Asset | Long-term rate | What is different |
|---|---|---|
| Stocks, funds, ETFs, crypto | 0%, 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 residence | 0% up to the exclusion | Exclude 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 estate | Up to 25% on depreciation | The 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.
Each example below was worked out with the calculator above, using a 5% state tax rate unless the example says otherwise.
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%.
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.
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.
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.
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.
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.
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 income | Long-term federal tax | Short-term federal tax | Net investment income tax | Saved 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.
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.
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.
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 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.