How to Calculate Capital Gains Tax (2026 Guide)
Short-term vs long-term matters more than most people realize. Here's the exact calculation with 2026 brackets, NIIT surtax, and worked examples for stocks, crypto, and real estate.
The basic formula
Capital gain = Sale proceeds − Cost basis
Capital gains tax = Gain × applicable rate + NIIT surtax (if high income)
Two rate structures apply depending on holding period:
- Short-term (held ≤ 12 months): Taxed as ordinary income (10% to 37%)
- Long-term (held > 12 months): Preferential 0%, 15%, or 20% rate
Step 1: Calculate your gain (or loss)
Sale proceeds = what you sold for, minus any commissions/fees
Cost basis = what you originally paid, including:
- Purchase price
- Commissions and broker fees
- Reinvested dividends (for DRIPs)
- Capital improvements (for real estate)
- Stock splits and spin-offs adjustments
For inherited assets: basis is fair market value at date of death (the "step-up" rule), not what the decedent originally paid. This is a massive tax benefit for heirs.
Step 2: Check holding period
The one-year clock starts the day AFTER you acquire the asset and ends the day you sell. Waiting 366+ days converts short-term to long-term — can save 10-15% in tax.
Acquisition methods matter:
- Bought with cash: Clock starts day after purchase
- Inherited: Automatically long-term, regardless of when you received it
- Gifted: You inherit the donor's basis AND holding period
- Stock options exercised: Clock starts day after exercise
Step 3: Apply the 2026 long-term capital gains brackets
The LTCG rate depends on your total taxable income (ordinary income + capital gains) for the year:
Single filer (2026)
- 0% rate: Taxable income up to $48,350
- 15% rate: $48,351 to $533,400
- 20% rate: Above $533,400
Married filing jointly (2026)
- 0% rate: Up to $96,700
- 15% rate: $96,701 to $600,050
- 20% rate: Above $600,050
Head of household (2026)
- 0% rate: Up to $64,750
- 15% rate: $64,751 to $566,700
- 20% rate: Above $566,700
Note: The brackets are based on your total taxable income, not just capital gains. If you have $80k salary + $20k LTCG, your total is $100k and you're in the 15% bracket — the capital gain pushes you into the LTCG range that applies to your combined income.
Step 4: Add NIIT surtax if applicable
If your Modified AGI exceeds:
- $200,000 (single / HoH)
- $250,000 (MFJ)
You owe an additional 3.8% Net Investment Income Tax (NIIT) on capital gains, dividends, rental income, and interest. At the top: 20% LTCG + 3.8% NIIT = 23.8% federal on long-term gains.
Worked examples
Example 1: Stock sale, modest income
You're single, $65k salary. Sold stock for $15,000 that you bought 3 years ago for $8,000.
- Gain: $15,000 − $8,000 = $7,000
- Holding period: 3 years → long-term
- Total taxable income: $65,000 + $7,000 = $72,000
- LTCG rate (single, under $533k): 15%
- Tax: $7,000 × 15% = $1,050
- NIIT: $0 (income under $200k threshold)
Example 2: Same scenario but short-term
Same $7,000 gain, but held 9 months.
- Holding period: 9 months → short-term
- Taxed as ordinary income at 22% bracket
- Tax: $7,000 × 22% = $1,540 — $490 more than long-term
Example 3: Crypto gain with NIIT
Single filer, $175k salary. Sold $80,000 of Bitcoin held 2 years, bought for $30,000.
- Gain: $80,000 − $30,000 = $50,000
- Total income: $175k + $50k = $225k
- LTCG rate: 15%
- LTCG tax: $50,000 × 15% = $7,500
- NIIT applies (over $200k): $50,000 × 3.8% = $1,900
- Total federal tax: $9,400
Example 4: 0% bracket strategy
Retired single filer, $40,000 pension income. Sells $8,000 of long-term stock gains.
- Total taxable income: $48,000
- Stays under the $48,350 threshold → 0% LTCG rate
- Federal capital gains tax: $0
This "tax-gain harvesting" strategy works for retirees and low-income years — realize gains tax-free to reset cost basis higher.
State capital gains tax
Most states tax capital gains as ordinary income (no preferential rate). Key states:
- Zero state tax: FL, TX, NV, WA (mostly), TN, WY, AK, SD, NH
- Low (< 5%): AZ, CO, IL, IN, KY, MI, NC, ND, OH, PA, UT
- Medium (5-8%): Most other states
- High (8%+): CA (up to 13.3%), HI (11%), NJ (10.75%), NY (10.9%), OR (9.9%), MN (9.85%)
Loss harvesting (the tax-reduction strategy)
Capital losses offset capital gains, and up to $3,000/year of excess loss can offset ordinary income. Any remaining loss carries forward indefinitely.
Example: $10,000 LTCG + $8,000 LT loss = $2,000 net LTCG (taxed normally). Or: $5,000 LTCG + $10,000 LT loss = $5,000 net loss ($3,000 offsets ordinary income, $2,000 carries forward).
Wash sale rule: If you sell at a loss and buy the same or "substantially identical" security within 30 days (before or after), the loss is disallowed. Plan loss harvesting carefully to avoid triggering wash sales.
Use the calculator
All of this manual math? Run your numbers through the Capital Gains Tax Calculator to see your federal tax instantly — with NIIT factored in automatically.