Capital gains tax calculator
Long-term gains are not taxed in isolation: they stack on top of your ordinary income, so the same gain can cost 0%, 15% or 20% depending on what is underneath it. This engine splits the gain across the 2025 bands, adds the 3.8% net investment income tax where it applies, and shows the blended rate.
| Rate | Amount | Tax |
|---|---|---|
| 15% | $50,000 | $7,500 |
Ordinary income of $60,000 is taxed separately at $8,114. State tax is not included.
gain starts at ordinary taxable income · The 0% band is consumed by ordinary income first.
Σ gain-in-band × rate · 0%, 15% and 20% bands for 2025.
3.8% × min(NII, MAGI − threshold) · Threshold 200,000 single / 250,000 married.
(gains tax + NIIT) / gain · Blended rate on the realised gain.
A clear path from inputs to results.
A long-term capital gain is not taxed at a flat rate: it stacks on top of your ordinary income and fills the 0%, 15% and 20% bands in order. This calculator splits the gain across the 2025 bands, adds the 3.8% net investment income tax where it applies, and reports the blended rate.
How to use
- Choose the filing status.
- Enter ordinary taxable income after deductions.
- Enter the realised long-term gain.
- Add other investment income to test the NIIT threshold.
The formula
Reference: IRC §1(h) (2025 long-term rates, Rev. Proc. 2024-40); IRC §1411 (net investment income tax).
Worked example
$50,000 gain on top of $60,000 of ordinary taxable income
- Ordinary taxable income $60,000.
- Long-term gain $50,000.
- Single filer, no other investment income.
- 1
The 0% band ends at $48,350, but ordinary income already fills it.
- 2
The entire $50,000 gain therefore sits in the 15% band.
- 3
Capital gains tax: 50,000 × 0.15 = $7,500.
- 4
MAGI is $110,000, below the $200,000 NIIT threshold, so no 3.8% surtax.
- 5
Effective rate on the gain: 15.0%.
Capital gains tax $7,500 · effective 15.0% · no NIIT.
Interpreting the result
Timing is the lever. The same gain costs nothing if it lands while ordinary income is low enough to leave room in the 0% band, and 20% plus NIIT if it lands on top of a large income year. That is why retirees often realise gains before taking large IRA distributions, and why a sabbatical year can be an unusually cheap time to sell.
Assumptions & limitations
- Long-term gains only (assets held more than one year). Short-term gains are taxed as ordinary income.
- Federal rates for 2025; state tax is excluded.
- The NIIT applies at 3.8% on the lesser of net investment income or MAGI above $200,000 single / $250,000 married.
- No credits, phase-outs or alternative minimum tax are modelled.
Frequently asked questions
Why is my gain taxed at 15% when the 0% band exists?
The 0% band applies to the space above your ordinary taxable income. If ordinary income already exceeds the top of that band, none of the gain qualifies for 0%.
Does selling a house count?
Only the portion above the home-sale exclusion, and only if the property was held long enough. Primary-residence exclusions are not modelled here.
What is the net investment income tax?
A 3.8% surtax on investment income for taxpayers above the MAGI threshold. It sits on top of the capital gains rate, so the top combined rate is 23.8%.
How do I keep the gain in the 0% band?
Reduce ordinary taxable income in the same year, for example by delaying a retirement distribution or taking a lower-income year. The engine lets you test that directly.
Methodology last reviewed 2026-10-21. Results are informational and not financial or engineering advice — see our disclaimer.