The formula
Gain = sale price − purchase price − selling fees
Short-term (held 1 year or less): taxed at ordinary income rates, stacked on top of your other taxable income
Long-term (held more than 1 year): 0%, 15% or 20%, by where income + gain falls in the brackets
NIIT = 3.8% × the lesser of the gain and (income + gain − $200,000 single / $250,000 joint)
Total tax = federal + NIIT + state
Effective rate = total tax ÷ gain
Worked example
- You bought shares for $10,000 and sell them for $25,000: a $15,000 gain.
- You're single with $85,000 of other taxable income, so the gain sits between $85,000 and $100,000.
- Held more than a year: that's all in the 15% long-term band (above $49,450), so federal tax is $2,250. State tax at 5% is $750, for a total of $3,000.
- Held a year or less: it's taxed at 22% ordinary rates (the band from $50,400 to $105,700), so $3,300 + $750 = $4,050.
- Holding for more than a year saves $1,050. NIIT doesn't apply, because income plus gain is below $200,000.
Short-term vs long-term gains
In the US, a capital gain is short-term if you held the asset for one year or less, and long-term if you held it for more than a year. Short-term gains are taxed as ordinary income, at rates from 10% to 37%. Long-term gains get lower rates of 0%, 15% or 20%, depending on your taxable income. Waiting a few extra days to pass the one-year mark can cut the tax substantially, as the comparison in the calculator shows.
2026 federal brackets used
For 2026, long-term gains are taxed at 0% for taxable income up to $49,450 (single) or $98,900 (married filing jointly), 15% up to $545,500 (single) or $613,700 (joint), and 20% above that. Ordinary brackets run from 10% up to $12,400 (single) or $24,800 (joint), through 12%, 22%, 24%, 32% and 35%, to 37% above $640,600 (single) or $768,700 (joint). The gain is stacked on top of your other taxable income, which is why the same gain can fall into more than one band.
Net investment income tax
Higher earners also pay the 3.8% net investment income tax (NIIT) on investment income, including capital gains, above $200,000 of modified adjusted gross income (single) or $250,000 (joint). These thresholds aren't indexed for inflation. The calculator uses taxable income plus the gain as an approximation of MAGI. Because MAGI is before deductions, the real figure is usually higher, so NIIT can apply at lower taxable incomes than shown.
State taxes and other countries
Most US states tax capital gains as ordinary income, at rates from 0% to over 13%. Enter yours in the state rate field. For other countries, choose Custom rates. As examples: in the UK, capital gains tax is 18% for basic-rate and 24% for higher-rate taxpayers from 2025/26, above a £3,000 annual exempt amount. In India, listed equity gains are taxed at 20% if short-term and 12.5% if long-term, above ₹1.25 lakh a year. In Canada, half of a capital gain is included in taxable income. Australia gives a 50% discount on assets held over a year.
Ways to reduce capital gains tax
- Hold for more than a year to qualify for long-term rates.
- Harvest losses: sell losing investments to offset gains. In the US, net losses offset up to $3,000 of ordinary income a year, and the rest carries forward. Watch the 30-day wash-sale rule.
- Use tax-advantaged accounts such as 401(k)s, IRAs, ISAs and TFSAs, where gains aren't taxed annually.
- Time sales for years when your income is lower, perhaps filling the 0% long-term band.
- Give appreciated shares to charity instead of cash.
Cost basis matters
Your gain depends on your cost basis: what you paid, including commissions, adjusted for things like reinvested dividends and stock splits. If you bought at several prices, which shares you sell matters too. See the average cost calculator. For real estate, add capital improvements and subtract depreciation, and consider the home sale exclusion or a 1031 exchange. Crypto is taxed as property in the US, so each sale or swap can be a taxable event.
An estimate, not tax advice
This calculator gives a planning estimate of federal and state tax on a single sale. Your actual bill depends on your full return, including other gains and losses, collectibles (taxed at up to 28%), the alternative minimum tax and state-specific rules. Check current figures with the IRS or your tax authority, or ask a tax professional before a large sale.