Capital Gains Tax Calculation
How long-term capital gains are taxed at preferential 0%, 15%, and 20% rates based on taxable income.
How it works
Long-term capital gains (assets held >1 year) are taxed at preferential rates of 0%, 15%, or 20% depending on taxable income. These rates are much lower than ordinary income tax rates (10%-37%), making taxable accounts tax-efficient for long-term holdings.
1. Determine Taxable Income
Start with taxable income before capital gains
Taxable Income = AGI - Standard/Itemized Deductions - QBI Deduction
Example: $100k AGI - $30k std deduction = $70k taxable income before gains2. Calculate Capital Gains
Determine long-term capital gain amount
Capital Gains = Sale Price - Cost Basis
Example: Sell stock for $50k, basis $30k → $20k capital gain3. Apply Capital Gains Tax Rates
Use capital gains brackets (0%, 15%, 20%)
2024 Married Filing Jointly: 0% rate: up to $94,050 15% rate: $94,051 to $583,750 20% rate: above $583,750 (Brackets indexed annually)
Example: $70k taxable income + $20k gain = $90k total → all gains at 0% rate4. Calculate Tax
Multiply gains by applicable rate(s)
Capital Gains Tax = Gains × Rate(s)
Example: $20k gain entirely in 0% bracket → $0 tax $20k gain in 15% bracket → $3,000 tax
Real-world context
The 0% Capital Gains Sweet Spot
For married couples filing jointly, the first ~$94k of taxable income (including gains) is taxed at 0% for capital gains. Early retirees can often realize substantial gains tax-free by managing their income to stay in this bracket.
IRS reference: IRS Topic 409 - Capital Gains and Losses
Tax-Efficient Asset Location
Because long-term capital gains are taxed at low rates, stocks and growth assets belong in taxable accounts. Bonds and other ordinary-income assets should go in tax-deferred accounts. This "asset location" strategy can save thousands in taxes annually.
Net Investment Income Tax (NIIT)
This projection calculates the 3.8% Net Investment Income Tax (IRC §1411) when AGI exceeds the applicable threshold. NIIT applies to the lesser of: (a) net investment income, or (b) AGI exceeding the threshold. Thresholds are not inflation-adjusted: $250,000 MFJ, $200,000 Single/HOH, $125,000 MFS. Income INCLUDED in net investment income (NII): • Long-term capital gains and qualified dividends • Taxable interest income • Rental and royalty income (passive by default) • K-1 income (treated as passive by default — see projection note below) Income EXCLUDED from NII: • W-2 wages and self-employment income • Active business income (Schedule C, Schedule F) • IRA, 401(k), and pension distributions • Social Security benefits • Tax-exempt interest (municipal bonds) • Roth IRA qualified distributions • Life insurance proceeds Projection note: AGI is used as a proxy for MAGI in the NIIT threshold test. For most clients the result is identical; clients with foreign earned income exclusions may see a slight difference. K-1 income is classified as passive NII by default — if the client materially participates in the underlying business, NIIT on that income will be overstated. Example: AGI $350k (MFJ), $50k capital gains → Min($50k, $350k − $250k) = $50k × 3.8% = $1,900 NIIT.
IRS reference: IRC §1411; IRS Form 8960 and Instructions
What drives the result
Withdrawals from taxable accounts trigger capital gains tax
$50k withdrawal from 80% basis account → $10k capital gains → $1,500 tax at 15%
A higher gain realization rate creates more annual realized gains. It defaults to the account's basis ratio at entry and can be set directly per account.
A 5% realization rate against $500k of growth → $25k gains → $3,750 tax annually
Higher ordinary income pushes capital gains into 15% or 20% bracket
$50k wages (low) → gains at 0-15%. $150k wages (high) → gains at 15-20%
Assumptions
- All capital gains are long-term (held >1 year)
- Net Investment Income Tax (NIIT) is calculated as a 3.8% surtax on net investment income when AGI exceeds the applicable threshold — see Important Considerations for which income types are included
- Tax brackets indexed annually for inflation
- Qualified dividends taxed at same rates (not modeled separately)
Limitations
- Wash sale rules not enforced — losses from tax harvesting are not disallowed even if the same or substantially identical security is repurchased within 30 days
- AGI is used as a MAGI proxy for NIIT threshold testing — may differ slightly for clients with foreign earned income exclusions or other MAGI adjustments
- K-1 income is treated as passive net investment income by default; NIIT may be overstated for clients who materially participate in the underlying partnership or S-Corp
Related
This page explains how Stratum models this calculation. It is educational material for financial professionals, not tax or legal advice, and tax law changes. Verify current figures against primary IRS sources before relying on them with a client.