Capital Gains Tax Calculator: Short-Term & Long-Term
Selling an investment? Estimate short- and long-term capital gains tax, including NIIT and state impact. Enter cost basis and sale price. Check.
Last updated: February 7, 2026
What Capital Gains Tax Actually Is
You bought Tesla stock for $12,000 two years ago. Today it's worth $28,000. If you sell, you owe capital gains tax on that $16,000 profit—not the full $28,000. Capital gains tax only applies to the increase in value between what you paid (your cost basis) and what you received when you sold.
Here's the part most people miss: holding period changes everything. Sell after 365 days and you pay long-term capital gains rates (0%, 15%, or 20%). Sell on day 364 and you pay your ordinary income tax rate—up to 37%. That one-day difference on a $50,000 gain can mean $6,000+ in extra taxes.
This calculator shows you exactly what you'll owe based on your gains, losses, holding periods, and income level—including state taxes and the 3.8% Net Investment Income Tax if you're above the threshold.
How Capital Gains Tax Is Calculated
The Core Formula:
Capital Gain = Sale Price − Cost Basis − Selling Costs
Tax Owed = Capital Gain × Applicable Tax Rate
Cost basis includes your original purchase price plus any commissions or fees paid when buying. For stocks with reinvested dividends, each reinvestment adds to your basis at that price.
2025 Long-Term Capital Gains Rates:
- • 0%: Single up to $48,350 | Married up to $96,700
- • 15%: Single $48,351–$533,400 | Married $96,701–$600,050
- • 20%: Above these thresholds
- • +3.8% NIIT: If MAGI exceeds $200K (single) or $250K (married)
Short-term gains (held 1 year or less) are taxed at your ordinary income tax rate—anywhere from 10% to 37% depending on your bracket.
Two Investors, Two Outcomes
Example 1: Sarah Waits One More Day
Sarah bought 200 shares of NVIDIA at $150/share ($30,000 total) on March 1, 2024. By February 28, 2025, they're worth $72,000. She's tempted to sell immediately—but that would be day 365. She waits until March 2, 2025.
Sarah's Numbers (Taxable income: $85,000, Single, California):
- Capital gain: $72,000 − $30,000 = $42,000
- Federal tax (15% LTCG): $6,300
- California tax (9.3%): $3,906
- Total tax: $10,206
- After-tax proceeds: $61,794
If Sarah had sold one day earlier (short-term), her federal rate would have been 22% instead of 15%. That's an extra $2,940 in federal tax alone—just for not waiting 24 hours.
Example 2: Marcus Triggers NIIT
Marcus is a software engineer earning $280,000. He sells stock for a $60,000 long-term gain, pushing his MAGI to $340,000.
Marcus's Numbers (Single, Washington State):
- Capital gain: $60,000
- Federal LTCG (20%): $12,000
- NIIT (3.8% on full $60,000): $2,280
- WA long-term capital gains tax (7%): $4,200
- Total tax: $18,480
- Effective rate on this gain: 30.8%
Marcus pays nearly 31% on his long-term gain because of the NIIT and Washington's new capital gains tax. Without those extras, he'd owe $12,000 instead of $18,480. High earners in high-tax states need to plan around these stacked rates.
When to Use This Calculator (and When Not To)
Use It For:
- Pre-sale planning: See how much you'll owe before clicking "sell" in your brokerage account
- Comparing scenarios: Test what happens if you sell now vs. wait for long-term treatment
- Tax-loss harvesting: Enter gains and losses to see the net tax impact
- Year-end planning: Figure out if you should realize gains before December 31 or wait
- NIIT exposure: Check if your sale will push you over the $200K/$250K threshold
Don't Rely on It For:
- Wash sale calculations: We don't track 30-day windows—you need to verify trades manually
- Specific lot identification: We assume you know which shares you're selling and their basis
- Complex basis adjustments: Inherited assets, gifts, stock splits, spinoffs, and mergers require CPA input
- Collectibles: Art, gold, antiques are taxed at 28% max—different from standard LTCG rates
How We Calculate This
We follow IRS netting rules exactly. Short-term gains and losses net against each other first. Long-term gains and losses net separately. If you end up with a net loss in one category and a net gain in the other, they cross-offset. Net losses exceeding gains offset up to $3,000 of ordinary income, with unlimited carryforward.
What we include: 2024 and 2025 federal brackets, all 50 states plus DC, the 3.8% NIIT calculation, qualified dividends (taxed at LTCG rates), and loss carryforward tracking.
What we don't include: Wash sale detection, depreciation recapture (25% rate for real estate), primary residence exclusion calculations, or AMT. For real estate sales or complex situations, run the numbers here first, then verify with a tax professional.
Sources
- IRS Tax Topic 409 — Capital gains and losses rules
- IRS Publication 550 — Investment income and expenses
- IRS Tax Topic 559 — NIIT thresholds and calculation
Long-term capital gains thresholds are inflation-adjusted annually. 2025 brackets shown are from IRS Rev. Proc. 2024-40.
For Educational Purposes Only - Not Financial Advice
This calculator provides estimates for informational and educational purposes only. It does not constitute financial, tax, investment, or legal advice. Results are based on the information you provide and current tax laws, which may change. Always consult with a qualified CPA, tax professional, or financial advisor for advice specific to your personal situation. Tax rates and limits shown should be verified with official IRS.gov sources.
Frequently Asked Questions
What's the difference between short-term and long-term capital gains?
Short-term capital gains are profits from selling assets held for one year or less, and are taxed as ordinary income at your marginal tax rate (10% to 37%). Long-term capital gains are from assets held for more than one year, and receive preferential tax rates of 0%, 15%, or 20% depending on your taxable income and filing status. For example, a taxpayer in the 24% bracket pays 24% on short-term gains but only 15% on long-term gains—a significant 9 percentage point difference. The holding period is calculated from the day after purchase to the sale date.
How do the 0%, 15%, and 20% long-term capital gains brackets work?
Long-term capital gains tax brackets are based on your total taxable income (including the gains themselves). For 2025 estimates: The 0% rate applies if taxable income is up to ~$47,025 (single) or ~$94,050 (married filing jointly). The 15% rate applies from ~$47,026 to ~$518,900 (single) or ~$94,051 to ~$583,750 (married). The 20% rate applies above those thresholds. These brackets are separate from ordinary income tax brackets and adjust annually for inflation. Unlike ordinary income which is taxed progressively across multiple brackets, capital gains are typically taxed at one rate based on your total income level.
What is NIIT (Net Investment Income Tax) and when does it apply?
The Net Investment Income Tax (NIIT) is a 3.8% surtax on investment income including capital gains, dividends, interest, rental income, and passive business income. It applies when your Modified Adjusted Gross Income (MAGI) exceeds $200,000 (single), $250,000 (married filing jointly), or $125,000 (married filing separately). You pay NIIT on the lesser of: (1) your net investment income, or (2) the amount your MAGI exceeds the threshold. Example: Single filer with $220,000 MAGI and $30,000 capital gains pays NIIT on only $20,000 (the MAGI excess) = $760. The NIIT applies to both short-term and long-term gains and is in addition to regular capital gains tax.
How does the $3,000 capital loss deduction work, and what about carryforwards?
Capital losses first offset capital gains of the same type (short-term losses → short-term gains, long-term losses → long-term gains), then offset the opposite type. After offsetting all gains, you can deduct up to $3,000 ($1,500 if married filing separately) of remaining net capital losses against ordinary income each year. Any losses exceeding $3,000 carry forward indefinitely to future tax years. Example: $50,000 capital loss with no gains. Year 1: deduct $3,000 against ordinary income, carry forward $47,000. Year 2: deduct $3,000, carry forward $44,000. Continue until exhausted. You report carryforward losses on Form 1040 Schedule D. There's no expiration—losses carry forward until used or death.
What are wash-sale rules and how do they affect my taxes?
The wash-sale rule disallows capital loss deductions if you purchase a substantially identical security within 30 days before or after the sale (61-day window total). The disallowed loss isn't permanently lost—it's added to the cost basis of the replacement shares, deferring the tax benefit. Example: Sell 100 shares of Stock A for a $1,000 loss on December 15. Buy 100 shares of Stock A on December 20. The $1,000 loss is disallowed in the current year but increases the basis of the new shares by $1,000. To avoid wash sales: (1) Wait 31+ days before repurchasing the same security, (2) Buy a similar but not identical investment (different company in the same sector, or an index ETF instead of individual stocks), or (3) Use the loss to offset gains without repurchasing. Important: Wash sales also apply if you buy the security in an IRA within 30 days of selling in a taxable account—this permanently disallows the loss.
How are qualified dividends taxed?
Qualified dividends are taxed at the preferential long-term capital gains rates (0%, 15%, or 20%) rather than as ordinary income. To qualify, dividends must be paid by a U.S. corporation or qualified foreign corporation, and you must hold the stock for more than 60 days during the 121-day period beginning 60 days before the ex-dividend date. Most dividends from stocks held in regular brokerage accounts for several months meet these requirements. Non-qualified (ordinary) dividends are taxed at regular income tax rates and include: dividends from REITs, MLPs, and foreign corporations in certain countries, dividends on stocks held less than 61 days, and dividends from tax-exempt organizations. Qualified dividends are also subject to the 3.8% NIIT when MAGI exceeds thresholds.
Do states tax capital gains differently?
Yes, state capital gains tax treatment varies significantly. Some states have no income tax at all (Alaska, Florida, Nevada, South Dakota, Tennessee, Texas, Washington, Wyoming), so capital gains are not taxed at the state level. Most states tax capital gains as ordinary income at their standard income tax rates—California (up to 13.3%), New York (up to 10.9%), Oregon (up to 9.9%). A few states offer preferential rates or exclusions for certain capital gains. Washington state has a 7% capital gains tax on gains exceeding $250,000 (individual). Some states allow deductions for retirement account contributions or other adjustments that reduce taxable capital gains. High-income earners can save 10%+ on investment gains by residing in no-tax states. State residency for tax purposes is determined by domicile and physical presence rules, not just where you sell the investment.