About the Capital Gains Tax Calculator
This capital gains tax calculator estimates how much tax you will owe when you sell stocks, funds, crypto, a rental or other investments for more than you paid. Enter the sale price, your cost basis, any selling costs and how long you held the asset, plus your other taxable income, and it works out federal tax, the 3.8% net investment income tax and optional state tax.
Long-term gains (assets held more than one year) are taxed at 0%, 15% or 20%, and the calculator stacks the gain on top of your other income exactly as the IRS worksheet does — so part of a gain can fall in the 0% zone and part in the 15% zone. Short-term gains (held one year or less) are taxed as ordinary income at your bracket rates, which the tool computes precisely rather than assuming a single rate.
Figures use the IRS thresholds for tax year 2026 (from Revenue Procedure 2025-32) or 2025. It is ideal for timing a sale, deciding whether to wait for long-term treatment, or setting money aside for next April. For the 3.8% net investment income tax, enter your modified AGI before the sale; if you leave it blank the tool estimates it from your taxable income plus the standard deduction. Special cases — collectibles (28%), unrecaptured depreciation on real estate (25%) and the home-sale exclusion — are not modelled here.
With the default inputs, the total tax on the gain is $3,000.00. Change any value above to recalculate instantly.
How to use the capital gains tax calculator
- 1Choose the tax year and your filing status.
- 2Enter the sale price, your cost basis and any selling costs.
- 3Select whether you held the asset more than one year.
- 4Enter your other taxable income for the year, after deductions.
- 5If your income is high, enter your modified AGI so the 3.8% NIIT is exact.
- 6Add your state rate if your state taxes capital gains, then review the total tax.
Formula and method
The gain is the sale price minus your cost basis and selling costs. For long-term gains the calculator places the gain on top of your other taxable income: the part that lands below the 0% threshold is tax-free, the part between the 0% and 15% thresholds is taxed at 15%, and anything above the 20% threshold is taxed at 20%.
Short-term gains are ordinary income, so the tool computes your federal tax with and without the gain and reports the difference. The 3.8% net investment income tax applies to the smaller of the gain and the amount by which modified AGI (including the gain) exceeds $200,000 (single/HoH), $250,000 (joint) or $125,000 (separate). Enter your MAGI before the sale for an exact figure; if you leave it at 0 the calculator estimates it as other taxable income plus the standard deduction, which understates MAGI if you itemize or have other deductions above the line. The NIIT here counts only this gain as investment income — other dividends or interest you have are not added. State tax is a flat rate you enter.
- Basis
- Purchase price plus fees and reinvested amounts
- Other taxable income
- Taxable income before adding this gain
- NIIT
- Net investment income tax, 3.8% above the income threshold
Worked examples
$20,000 long-term stock gain, single, $60,000 other income
Selling for $50,000 shares bought for $30,000 creates a $20,000 gain. Other taxable income of $60,000 is already above the $49,450 top of the 2026 0% zone, so the whole gain is taxed at 15%: $3,000. You keep $47,000 of the sale proceeds.
Married couple, $40,000 long-term gain on $80,000 of income
The joint 0% zone runs to $98,900 of taxable income in 2026, so $18,900 of the gain is tax-free. The remaining $21,100 is taxed at 15% for $3,165 — an effective rate of about 7.9% on the gain.
Short-term $15,000 gain, single, $90,000 other income, 5% state tax
Held under a year, the gain is ordinary income. $15,700 of room remains in the 22% bracket ($105,700 − $90,000), so the full $15,000 is taxed at 22% federally ($3,300). Adding 5% state tax of $750 brings the total to $4,050. Waiting past the one-year mark would cut the federal bill to $2,250.
High earner: $100,000 long-term gain with NIIT
With $170,000 of other taxable income the whole $100,000 gain falls in the 15% zone ($15,000). Modified AGI of $190,000 plus the gain is $290,000, which is $90,000 over the $200,000 single threshold, so NIIT is 3.8% of $90,000 (the lesser of that and the gain) = $3,420. Total tax is $18,420.
Frequently asked questions
What are the 2026 long-term capital gains tax rates?+
For 2026 the 0% rate applies to taxable income up to $49,450 (single) or $98,900 (married filing jointly); 15% applies up to $545,500 (single) or $613,700 (joint); 20% applies above that.
How long do I need to hold an investment for long-term treatment?+
More than one year. The holding period starts the day after you buy and includes the day you sell. Assets held one year or less produce short-term gains taxed at ordinary income rates.
What is the net investment income tax?+
It is an extra 3.8% federal tax on investment income, including capital gains, for people whose modified AGI exceeds $200,000 (single or head of household), $250,000 (joint) or $125,000 (married filing separately). The thresholds are not indexed for inflation.
Can capital losses reduce my taxes?+
Yes. Capital losses first offset capital gains. If losses exceed gains, up to $3,000 per year ($1,500 married filing separately) can offset ordinary income and the remainder carries forward indefinitely.
Do I pay capital gains tax when I sell my home?+
You can usually exclude up to $250,000 of gain ($500,000 for married couples) on a main home you owned and lived in for two of the last five years. Use the home sale exclusion calculator for that case.
How is crypto taxed?+
The IRS treats cryptocurrency as property, so selling, swapping or spending it triggers a capital gain or loss using the same short- and long-term rules as stocks.
Tax results are estimates based on published rules and simplified assumptions. They are not tax advice — check official guidance or a tax professional for your situation.