Capital Gains Tax Calculator
Federal tax on a long-term capital gain, stacked the way the IRS actually does it: your ordinary income fills the rate bands first, and the gain is taxed at 0%, 15%, and 20% only in the band space above it — with the optional 3.8% net investment income tax on top.
Tax on your long-term gain
Example: $40,000 gain on $40,000 ordinary income, single, 2026 → $9,450 of the gain at 0%, $30,550 at 15% — $4,583.
The example, stacked
A $40,000 long-term gain on top of $40,000 of taxable ordinary income, single, 2026: the 0% band runs to $49,450 of taxable income, and ordinary income has already used $40,000 of it. So the first $9,450 of the gain rides free at 0%, and the remaining $30,550 is taxed at 15% — $4,583 in all, an effective 11.46% on the gain. One gain, two rates: that is the stacking most "what's my capital gains rate?" tables quietly skip. Every figure here is computed by the same tested engine as the calculator above.
Why the stacking matters
The long-term rates are not a lookup — they are bands of taxable income (2026 single: 0% to $49,450, 15% to $545,500, 20% above). Your gain occupies the interval from your ordinary income upward, so the same $50,000 gain can cost $0, be split across rates, or land entirely at 20% depending on what sits underneath it. That is why realizing gains in a low-income year is a real planning lever. To find the taxable ordinary income this page asks for, the Tax Bracket Calculator applies your standard deduction for you; for the whole-paycheck picture including FICA, use the Take-Home Pay Calculator.
What this tool deliberately leaves out
Scope is federal tax on plain long-term gains — the following are real, and excluded by design rather than modeled badly:
- State and local taxes — most states tax gains as ordinary income.
- Short-term gains (held one year or less) — ordinary income at bracket rates; price them with the Federal Income Tax Calculator.
- Unrecaptured § 1250 gain — depreciation on sold real estate, taxed up to 25%.
- Collectibles and § 1202 QSBS gain — taxed at up to 28%.
- The § 121 home-sale exclusion — up to $250,000/$500,000 of a primary-residence gain may be excluded before any of this applies.
Frequently asked questions
Is my whole gain taxed at one capital-gains rate?
No — that is the point of this calculator. The 0%, 15%, and 20% rates are bands of taxable income, and a long-term gain stacks on top of your ordinary income. Ordinary income fills the low bands first; the gain then occupies whatever band space is left, so one gain is often split across two rates. A single "your rate is X%" answer hides that split.
What counts as a long-term gain?
Gain on an asset held for MORE than one year before selling. Held one year or less, the gain is short-term and is taxed as ordinary income at your regular bracket rates — this calculator does not model that; use the tax bracket or take-home pay calculators to price ordinary income.
What is the net investment income tax (NIIT)?
An additional 3.8% tax (IRC section 1411) on the LESSER of your net investment income or the amount your modified AGI exceeds a threshold: $200,000 single or head of household, $250,000 married filing jointly, $125,000 married filing separately. The thresholds are set by statute and are NOT adjusted for inflation, so more filers cross them each year. The calculator applies the lesser-of rule to the gain you enter.
What does this calculator deliberately not model?
State and local taxes on gains; short-term gains (taxed as ordinary income); unrecaptured section 1250 depreciation on real estate (taxed up to 25%); collectibles and section 1202 QSBS gain (taxed up to 28%); the section 121 home-sale exclusion (up to $250,000/$500,000 of a primary-home gain can be excluded before any of this math starts); and interactions with qualified dividends sharing the same bands. Each is disclosed here rather than approximated badly.
Why does it ask for taxable ordinary income rather than salary?
The 0/15/20 breakpoints are defined on TAXABLE income — after the standard or itemized deduction — so the stacking is only correct if the ordinary income you enter is already net of deductions. If you only know your salary, subtract your deduction first (the tax bracket calculator does exactly that step).
Not tax advice: a federal planning estimate for plain long-term gains and, optionally, the NIIT — using the taxable ordinary income you supply, with none of the exclusions listed above modeled. Netting rules (short against long, capital-loss carryovers) and qualified dividends sharing the same bands can change the result. Consult a tax professional or IRS.gov for your situation. Values are processed locally in your browser and never transmitted. See the methodology page.