190+ calculators  /  US · CA · IN   /  no sign-up · no lead forms
RealMoneyIQ
Home / Taxes / Capital Gains Tax

Capital Gains Tax Calculator

↻ Updated 2026

Work out the federal tax on an investment sale for 2026 — short-term gains at your ordinary rate, long-term gains at 0/15/20%, plus the 3.8% net investment income tax where it applies.

Educational calculators — always consult a licensed professional before making financial decisions.

Your inputs
Sale proceeds
Cost basis
What you originally paid
Holding period
Other taxable income
Wages etc., after deductions
Capital gains tax
$3,000
long-term
Net proceeds
$57,000
after tax on the gain
Effective rate on gain
15%
gain of $20,000
Your gain, after tax
Kept$17,000
Capital gains tax$3,000
NIIT (3.8%)$0
Breakdown
Sale proceeds$60,000
Cost basis− $40,000
Capital gain$20,000
Long-term capital gains tax$3,000
Net investment income tax (3.8%)$0
Total tax on gain$3,000
ASSUMPTIONS 2026 tax year, federal only. Short-term gains are stacked on your other income and taxed at ordinary 2026 brackets; long-term gains use the 0/15/20% breakpoints. NIIT of 3.8% applies to the gain when your income plus gain exceeds the threshold for your status. Excludes state/local taxes and credits. Enter your other income already net of deductions.

Runs entirely in your browser — nothing you enter is sent to us.How this works

How to read your capital gains result

The holding-period toggle is the largest lever on this page and it costs nothing to move. On the defaults, the identical $20,000 gain is taxed $3,000 held long-term and $4,400 held short-term — a $1,400 difference decided by the calendar, not by the investment. The effective-rate card measures tax against the gain, not against the proceeds.

Your other income is the floor the gain sits on. Long-term gains are stacked on top of ordinary income, so the same $20,000 gain can be taxed at 0%, 15% or 20% depending entirely on what you earned that year.
Enter other income already net of deductions — the field expects taxable income, not salary. Enter your gross salary and the tool will place your gain higher in the stack than the IRS would.
Short-term gains are just ordinary income. If the toggle is on "Short", the federal income tax calculator is running underneath this one.

How tax on a long-term or short-term gain is calculated

The gain is proceeds minus basis. What happens next depends entirely on how long you held the asset, because the US taxes the two holding periods under two different rate schedules.

Short-term gains have no schedule of their own — they're added to your ordinary income and taxed at whatever brackets they land in. Long-term gains get the 0/15/20% schedule, and are stacked on top of your ordinary income rather than replacing it. Your ordinary income is taxed first and fills the lower bands; the gain is taxed in whatever bands are left above it.

gain = sale proceeds − cost basis short-term: tax = tax(other income + gain) − tax(other income) long-term: stack the gain on top of other income, then 0% on the part below the 15% breakpoint 15% on the part between the breakpoints 20% on the part above the 20% breakpoint 2026 long-term breakpoints (taxable income, Rev. Proc. 2025-32): single 15% above $49,450 20% above $545,500 mfj 15% above $98,900 20% above $613,700 hoh 15% above $66,200 20% above $579,650 mfs 15% above $49,450 20% above $306,850 NIIT = 3.8% × lesser of (gain, income + gain − threshold) thresholds: $200,000 single/hoh, $250,000 mfj, $125,000 mfs total tax = capital gains tax + NIIT

sale proceeds
What the asset sold forbefore any tax; the net-proceeds card subtracts the tax on the gain from this
cost basis
What you originally paid, adjusted for reinvested dividends and commissionsgetting this wrong is the most common way a real return diverges from a calculator
other income
Your ordinary taxable income for the year — after deductionssets where in the stack the gain begins; the calculator does not subtract a standard deduction for you
gain
Proceeds minus basisfloored at zero — this calculator does not model losses
NIIT
Net Investment Income Tax, an extra 3.8% for higher earnersIRC §1411; the thresholds are fixed in statute and have never been inflation-indexed since 2013

The stacking rule is what makes long-term gains hard to intuit. Because ordinary income is taxed first and fills the lower bands, a long-term gain can never push your salary into a higher bracket — but your salary absolutely pushes your gain into a higher capital-gains band. The causation runs one way only.

Note that the breakpoints are measured against taxable income, while the NIIT threshold is measured against modified adjusted gross income — a larger number, before deductions. This calculator compares your "other income" field against both, which means it applies NIIT slightly later than the IRS would for anyone whose deductions are substantial. Flagged rather than hidden; see the limitations below. For the ordinary-rate side, the effective vs marginal rate calculator shows which bracket a short-term gain would land in.

Worked examples

Example: a $20,000 long-term gain on $80,000 of other income

The calculator's defaults — $60,000 of proceeds against a $40,000 basis, held more than a year, single filer with $80,000 of other taxable income.

Sale proceedswhat it sold for$60,000
Less cost basiswhat you paid− $40,000
Capital gainthe taxable event$20,000
Gain stacks fromalready above the $49,450 breakpoint$80,000
Taxed at 0%no room below the breakpoint$0
Taxed at 15%15% of the full $20,000$3,000
NIIT$100,000 total is under the $200,000 threshold$0
Total tax on gaineffective rate 15%$3,000
Net proceeds$60,000 − $3,000$57,000
Same gain held short-term22% — $16,712 − $12,312 of ordinary tax$4,400

$3,000 long-term against $4,400 short-term. The $1,400 gap is the entire reward for holding past the one-year mark, and it's 7 percentage points of the gain. Because $80,000 of other income already exceeds the $49,450 breakpoint, none of this gain reached the 0% band — the whole $20,000 was taxed at 15%.

Example: the same gain on $40,000 of other income

Drop other income to $40,000 and change nothing else. The gain is identical; the space beneath it is not.

Gain stacks fromnow $9,450 below the breakpoint$40,000
Taxed at 0%$49,450 − $40,000 — zero tax on this slice$9,450
Taxed at 15%the rest of the gain, above the breakpoint$10,550
Total tax on gain15% × $10,550 = $1,582.50$1,583
Effective rate on gainwas 15%7.9%
Net proceeds$1,417 more than the first example$58,418

$40,000 less ordinary income halved the tax on an unchanged gain, from $3,000 to $1,583. The first $9,450 of the gain fell in the 0% band and was taxed at nothing at all. This is why the year in which a gain is realised can matter more than the gain itself — the 0% band is not a rate you qualify for, it's a space you either have or don't.

Frequently asked questions

How long do I have to hold a stock to get long-term capital gains?

More than one year. Exactly one year is not enough — IRS Topic 409 defines the holding period as beginning the day after you acquire the asset and ending on the day you dispose of it, so buy on 1 January and you must sell on 2 January of the following year or later. Sell on 1 January and the gain is short-term.

The stakes of that single day are visible on this page: the default $20,000 gain is taxed $3,000 long-term and $4,400 short-term. Short-term gains carry no preferential rate at all — they're ordinary income, taxed at 10% to 37% depending on where they land in your brackets.

Who pays the 3.8% net investment income tax?

Anyone whose modified adjusted gross income exceeds $200,000 single or head of household, $250,000 married filing jointly, or $125,000 married filing separately — and only on the lesser of their net investment income or the amount by which MAGI exceeds that threshold (IRC §1411; IRS, Questions and Answers on the Net Investment Income Tax). It rides on top of the capital gains rate rather than replacing it.

Set other income to $250,000 and a $50,000 gain on this calculator and you'll see $7,500 of long-term tax plus $1,900 of NIIT — an 18.8% effective rate on the gain, not 15%. The tax phases in rather than switching on: at $190,000 of other income with a $20,000 gain, only $10,000 sits above the threshold, so NIIT is $380 and the effective rate is 16.9%. These thresholds were written into statute in 2013 and are not inflation-indexed, so each year's wage growth pulls more people over them.

How do I pay 0% capital gains tax?

By having taxable income low enough that the gain — stacked on top of it — still lands below the 15% breakpoint: $49,450 single or $98,900 married filing jointly for 2026 (Rev. Proc. 2025-32). It's not a rate you claim; it's the bottom band of the same schedule that produces 15% and 20%, and it applies to long-term gains only.

The second example above shows it working partially: $40,000 of other income leaves $9,450 of space under the breakpoint, so $9,450 of the gain is taxed at nothing and the rest at 15%. The band is filled by ordinary income first, which is why the space is what matters rather than the gain. Since the breakpoints measure taxable income, deductions widen the band — a single filer with the $16,100 standard deduction can hold roughly $65,550 of gross income and still have gains land at 0%.

Can I deduct capital losses against my income?

Yes, in a specific order and up to a hard cap — and this calculator models none of it. Losses first offset capital gains of the same type, then the other type. If a net loss remains, you may deduct up to $3,000 against ordinary income per year ($1,500 married filing separately), and anything beyond that carries forward indefinitely (IRS Topic 409).

Enter a basis higher than your proceeds here and the tool reports a $0 gain and $0 tax, because it floors the gain at zero. That's correct about the tax on this sale and silent about the deduction the loss may generate. The carryforward has no expiry, which is why a large loss can shelter gains for years — but it dies with the taxpayer rather than passing to an estate.

What this capital gains calculator doesn't handle

One asset, one sale, one year, federal only. The tax code around investment sales is considerably larger than that.

  • Losses and carryforwards The gain is floored at zero, so a sale at a loss shows no tax and no benefit. The $3,000 annual deduction against ordinary income, the netting rules between short- and long-term, and loss carryforwards from prior years are all outside the model (IRS Topic 409). So is the wash-sale rule, which disallows a loss if you rebuy a substantially identical security within 30 days either side of the sale (IRS Publication 550).
  • NIIT is tested against taxable income, not MAGI The statute measures the $200,000/$250,000 threshold against modified adjusted gross income — before deductions. This tool compares it against the "other income" field, which the page asks you to enter after deductions. For anyone near the threshold with meaningful deductions, that means the calculator applies NIIT later, and reports less of it, than a real return would.
  • Special rates and asset classes Collectibles carry a higher maximum rate, unrecaptured §1250 gain on real estate depreciation has its own ceiling, and qualified small business stock may be excluded entirely (IRS Publication 550; IRC §§1202, 1250). None of those rates live in our 2026 data module, so this calculator applies the plain 0/15/20% schedule to every asset. The primary-residence exclusion under IRC §121 isn't modelled either — enter a home sale and the tool will tax gain the IRS may not.
  • Qualified dividends They use the same 0/15/20% breakpoints and stack the same way, but they're not a sale, so there's no field for them. If you have both, your dividends occupy space in the bands before your gain does, and this calculator won't know.
  • State tax Federal only. Most states tax capital gains as ordinary income with no preferential long-term rate, so the state bill on a long-term gain can exceed the federal one for a taxpayer sitting in the 0% federal band.
Related calculators

Rates, brackets and limits here are checked against primary sources. If a number still looks off, email support@realmoneyiq.com and we'll review and fix it.

RealMoneyIQ provides free educational calculators, not financial, tax, investment or legal advice. Results are estimates based on the assumptions you enter and publicly published rates; your actual outcome will differ. Always confirm decisions with a licensed professional who knows your full situation.