Home/Taxes/Capital Gains Tax Calculator
📈 Calculator · Investing taxes

Capital Gains Tax Calculator 2026 and 2027: Federal, the 3.8% NIIT and Your State

Find the tax on one sale the way it really works, with your whole return before and after, including the 3.8% surtax, your state, the date it turns long-term and how much of your gain fits in the 0% band.

✍️ Built by DigitalWealthSource
🔍 Reviewed by Derek Giordano
📅 Updated Nov 16, 2026
🔒 Runs in your browser

Enter one sale and the rest of your year. The calculator figures your federal tax with and without the sale, so the difference is exactly what the sale costs, including the 3.8% net investment income tax and your state’s rate. Everything stays in your browser.

The sale

What you paid, plus fees and reinvested dividends
The sale date decides the tax year

The rest of your year

Your AGI without this sale or qualified dividends
Counts toward the 3.8% tax
They offset this gain first
Flat rate; enter 0 if your state has no income tax
Tax on this sale
—
Federal income tax
—
Net investment income tax
—
State tax
—

How this sale is taxed

The federal figure is your whole-return tax with the sale minus without it, so it includes bracket effects and the senior deduction’s phase-out. It doesn’t cover collectibles (28%), depreciation on real estate (25%), a home sale exclusion or Social Security taxation.

📐 Verified Nov 15, 2026 against IRS Publication 550 (holding period), Topic 409 (rates and loss limits), the Form 1040 instructions’ capital gain worksheet, the IRS net investment income tax page, and 2026 and 2027 brackets from our registry (Rev. Procs. 2025-32 and 2026-35). How we check numbers →

How the Calculator Works

Capital gains rates depend on everything else on your return, so the calculator figures your whole federal tax twice, with the sale and without it, and the difference is the tax the sale adds. Long-term gains stack on top of your other taxable income and fill the 0%, 15% and 20% bands in order; short-term gains are taxed like wages. The 3.8% net investment income tax applies to the smaller of your investment income or the part of your modified AGI above the threshold. State tax is your flat rate times the gain.

Gain = sale price after fees − cost basis − capital losses carried over Long-term if held more than one year: count from the day after you bought; the sale day counts Federal tax on the sale = tax(return with the sale) − tax(return without it) NIIT = 3.8% × smaller of (investment income) or (modified AGI − $200,000 single / $250,000 joint / $125,000 separate), with minus without State tax = your rate × the gain
🧮 A single filer with $85,000 of other income sells shares bought Mar. 14, 2025
  • Sold Feb. 20, 2026 for $32,000 against a $20,000 basis: a $12,000 gain held 343 days, so it’s short-term and lands in the 22% bracket: $2,640 federal plus $600 at a 5% state rate = $3,240.
  • Wait until Mar. 15, 2026, the first long-term day, and the federal part drops to $1,800 (15%): $2,400 in all, $840 less, for waiting 23 days.
  • Income below the 3.8% threshold ($200,000 single) means no net investment income tax either way.

Timing a Sale

  • The one-year line. The holding period starts the day after you buy and includes the day you sell. IRS Publication 550’s example: shares bought Jan. 31, 2024 and sold Jan. 29, 2025 are short-term; sold Feb. 6, 2025, long-term. The calculator shows your first long-term date.
  • The 0% band. Long-term gains are taxed at 0% while total taxable income stays under $49,450 single or $98,900 joint in 2026 ($51,050 and $102,100 in 2027). In a low-income year you can sell winners and buy them back to raise your basis at the 0% federal rate; wash-sale rules apply to losses, not gains.
  • December or January. A sale on Dec. 31 lands on this year’s return; Jan. 2 moves it to next year’s, with that year’s brackets and a year more to pay.
  • Hidden costs at 65. A big gain raises modified AGI, which shrinks the $6,000 senior deduction by 6% of income over $75,000 ($150,000 joint); the calculator counts it.

Numbers That Matter

Rule or figureWhat it saysSourceVerified
0% / 15% / 20% bands, 2026Long-term gains at 0% up to the first figure, 20% above the second: single $49,450 / $545,500; joint $98,900 / $613,700; head of household $66,200 / $579,600; separate $49,450 / $306,850 of taxable incomeRev. Proc. 2025-32Nov 15, 2026
0% / 15% / 20% bands, 2027Single $51,050 / $563,200; joint $102,100 / $633,600; head of household $68,350 / $598,400; separate $51,050 / $316,800Rev. Proc. 2026-35Nov 15, 2026
Net investment income tax3.8% of the smaller of net investment income or modified AGI over $200,000 single, $250,000 joint, $125,000 separate (not indexed)IRS Net Investment Income TaxNov 15, 2026
Holding periodLong-term if held more than one year; count from the day after acquisition, the sale day includedIRS, Publication 550 (2025)Nov 15, 2026
LossesNet capital loss deductible up to $3,000 ($1,500 married filing separately) a year; the rest carries forwardIRS Topic 409 (reviewed Nov. 9, 2026)Nov 15, 2026
Other ratesCollectibles and taxable small business stock gain up to 28%; unrecaptured section 1250 gain (real estate depreciation) up to 25% (not computed here)IRS Topic 409Nov 15, 2026
Worksheet ruleThe tax is the smaller of the capital gain worksheet result or regular tax on all taxable income (line 25)IRS, Form 1040 instructionsNov 15, 2026
Senior deduction$6,000 per person 65+, less 6% of modified AGI over $75,000 ($150,000 joint), 2025-2028FS-2025-03Nov 15, 2026

Decision Rules

  • If a gain is a few weeks from long-term, compare the tax both ways before selling; the calculator shows the date and the difference.
  • If you’re in the 0% band, consider realizing gains up to its top in a low-income year.
  • If you have losses, sell them before year-end to offset gains, and the $3,000 extra cuts ordinary income; the tax-loss harvesting guide covers the wash-sale rule.
  • If your income is near the 3.8% threshold, spreading a sale over two tax years can keep part of it below.
  • For your whole return, including dividends and credits, use the federal income tax calculator.

What the Calculator Leaves Out

It handles one sale of stocks, funds or crypto against the rest of your year. It doesn’t apply the 28% rate on collectibles or the 25% rate on real estate depreciation, the home sale exclusion, installment sales, wash sales or state rules beyond one flat rate (some states tax gains differently or not at all). A gain can also make more Social Security taxable, which the federal income tax calculator handles. Capital losses you enter offset this gain without sorting short-term from long-term. Tax figures cover 2026 and 2027 sales.

Frequently Asked Questions

How much tax will I pay on a capital gain in 2026?
+
Long-term gains (assets held more than a year) are taxed at 0%, 15% or 20% depending on your total taxable income: 0% up to $49,450 single or $98,900 joint, 20% above $545,500 single or $613,700 joint. Short-term gains are taxed at ordinary rates up to 37%. The 3.8% net investment income tax and state tax can add more.
What are the 2027 capital gains brackets?
+
For 2027 the 0% rate applies up to $51,050 of taxable income for single filers, $102,100 for joint filers and $68,350 for heads of household; the 20% rate starts above $563,200, $633,600 and $598,400.
When does a gain become long-term?
+
When you’ve held the asset more than one year. Start counting the day after you bought it; the day you sell counts. Shares bought on Jan. 31 become long-term if sold on Feb. 1 of the next year or later.
Who pays the 3.8% net investment income tax?
+
People whose modified AGI is above $200,000 (single or head of household), $250,000 (married filing jointly) or $125,000 (married filing separately). The tax is 3.8% of the smaller of net investment income or the amount over the threshold. The thresholds aren’t adjusted for inflation.
Do states tax capital gains?
+
Most states with an income tax tax capital gains as ordinary income and a few give a partial break. States without an income tax generally don’t, but Washington taxes long-term gains above a standard deduction ($278,000 for 2025). The calculator uses one flat rate you enter.
How much can a capital loss save?
+
Losses first offset gains. If you end the year with a net loss, up to $3,000 ($1,500 if married filing separately) reduces other income, and the rest carries forward. At a 22% rate, a $3,000 deduction saves $660.
⚠️ Important Disclosure
DigitalWealthSource publishes educational financial content. Nothing on this site constitutes personalized financial, tax, legal, or investment advice. Every person's financial situation is unique. We strongly encourage consulting with a qualified financial advisor, CPA, or attorney before making significant financial decisions. Content is provided for informational and educational purposes only.
👤
Written & reviewed by Derek Giordano
Derek reviews all content on DigitalWealthSource. Background in business marketing with hands-on experience in debt payoff, homebuying, tax strategy, and long-term investing. Our methodology →
✓
Independent & Ad-Free
No ads, no affiliate links, no sponsored content. Sources are listed on this page. Spot an error or an outdated figure? Tell us and we’ll fix it.
📖 Sources & References
  1. Publication 550 (2025), Investment Income and Expenses Internal Revenue Service. https://www.irs.gov/publications/p550
  2. Topic 409, Capital gains and losses Internal Revenue Service. https://www.irs.gov/taxtopics/tc409
  3. Form 1040 instructions: Qualified Dividends and Capital Gain Tax Worksheet Internal Revenue Service. https://www.irs.gov/instructions/i1040gi
  4. Net Investment Income Tax Internal Revenue Service. https://www.irs.gov/individuals/net-investment-income-tax
  5. Rev. Proc. 2025-32 (2026) Internal Revenue Service. https://www.irs.gov/pub/irs-drop/rp-25-32.pdf
  6. Rev. Proc. 2026-35 (2027) Internal Revenue Service. https://www.irs.gov/pub/irs-drop/rp-26-35.pdf