Capital Gains Tax Calculator
Calculate US capital gains tax using 2025 IRS thresholds. Includes long-term/short-term rates, NIIT 3.8%, and loss carryforward.
Capital gains details
Estimated tax owed
$750.00
Capital gain
$5,000.00
Tax rate
15%
Term type
Long-term
Net proceeds
$14,250.00
NIIT 3.8%
$0.00
⚠️ Tax planning note
This is an estimate. Consult a tax professional for your specific situation. Long-term rates are current as of 2025 (IRS Rev. Proc. 2024-25).
Capital Gains Tax Formulas
Long-term capital gains (held ≥1 year) use preferential tax rates. Short-term gains are taxed as ordinary income. NIIT applies to high-income earners.
-
Purchase PriceOriginal cost per share or unit -
Sale PricePrice received when selling -
Holding PeriodDays held (< 366 = short-term, ≥ 366 = long-term) -
Cost BasisPurchase price + improvements -
Capital GainSale price − cost basis -
Tax Rate0%, 15%, or 20% (LT) or ordinary rate (ST) -
NIITNet Investment Income Tax, 3.8% surcharge on high earners -
Net ProceedsSale price − total tax
This calculator uses 2025 IRS Rev. Proc. 2024-25 thresholds. Consult a tax professional for your specific situation.
Understanding Capital Gains Tax
Capital gains tax applies when you sell an investment (stocks, mutual funds, real estate, crypto) for more than you paid. The tax rate depends on how long you held it and your income level.
Types of Capital Gains
Long-Term (held ≥ 1 year):
- 0%, 15%, or 20% depending on income
- Preferential treatment
Short-Term (held < 1 year):
- Taxed as ordinary income
- 10% to 37% depending on tax bracket
2025 Long-Term Capital Gains Thresholds
Single:
- 0% up to $47,025 of long-term gains
- 15% from $47,026 to $518,900
- 20% above $518,900
Married Filing Jointly:
- 0% up to $94,050
- 15% from $94,051 to $583,750
- 20% above $583,750
Head of Household:
- 0% up to $63,000
- 15% from $63,001 to $551,350
- 20% above $551,350
A Worked Example
Scenario: You’re single, earn $100,000/year. You bought a stock at $10,000 and sold it at $15,000 after 18 months.
- Gain: $5,000 (long-term)
- Total income: $100,000 + $5,000 = $105,000
- Tax rate: 15% (in the 15% bracket)
- Tax owed: $5,000 × 0.15 = $750
- Net proceeds: $15,000 − $750 = $14,250
Cost Basis Matters
Your “cost basis” is what you paid plus associated costs (commissions, improvements for real estate).
Example: You buy 100 shares at $50 plus $50 commission.
- Cost basis per share: $50.50 (not $50)
- If you sell at $60: gain = $950 (not $1,000)
For real estate, renovations add to basis. A $500k home with $50k in improvements has $550k basis.
Special Rules
Capital Loss Carryforward: Losses offset gains. If you lose $10k and gain $6k: net loss = $4k. You deduct $3k against ordinary income, carry $1k forward to next year.
NIIT (3.8% surcharge): For high earners (single > $200k, married > $250k), an additional 3.8% tax applies to net investment income.
Inherited Assets (Step-Up Basis): When you inherit an asset, your cost basis becomes its value on the date of death, not what the deceased paid. This eliminates tax on appreciation during the deceased’s lifetime—a major benefit.
Tax Planning Tips
- Hold > 1 year for long-term rates if possible
- Harvest losses to offset gains in profitable years
- Gift appreciated assets to charity instead of selling (avoid tax)
- Donate appreciated securities to DAF (Donor-Advised Fund) for tax deduction
- Track improvements on real estate to increase basis
- Consult a CPA for large gains or complex situations
Related Calculators
Use the tax bracket calculator to estimate your income bracket. Calculate overall income impact with the paycheck calculator. Track investment performance with the stock return calculator.
Capital Gains in Different Account Types
Taxable Brokerage Accounts
Capital gains tax applies to any gains realized when you sell stocks, funds, or other investments. You pay tax based on your gains that year, regardless of whether you reinvest the proceeds. Keep detailed records of purchase dates and prices for tax-loss harvesting and basis calculations.
Tax-Advantaged Retirement Accounts
One major benefit of 401(k)s and IRAs: no capital gains tax within the account. If you buy a stock at $50, it grows to $150, and you sell it for $150, you owe $0 in capital gains tax inside the account. Taxes are deferred until withdrawal (traditional accounts) or withdrawn tax-free (Roth accounts). This is why retirement accounts are so powerful—the tax drag from constantly realizing gains doesn’t apply.
Inherited Securities
Inheriting stock is a major tax advantage: step-up basis. If your parent bought a stock at $20 and it’s worth $100 when they pass, your cost basis becomes $100. If you sell immediately at $100, you owe $0 in tax. This wipes out all appreciation that happened during the deceased’s lifetime—a tax-free benefit worth potentially millions in large estates.
Real Estate Transactions
Home sales have a special exclusion: $250,000 (single) or $500,000 (married) of capital gains are excluded from tax if you lived in the home 2 of the last 5 years. After that exclusion, gains are taxed at long-term rates. For investment real estate (rental property, vacation home), the full gain is taxable with no exclusion.
Tax Strategies to Reduce Capital Gains
1. Tax-Loss Harvesting: Sell losing positions to realize losses, offset against gains. You can deduct up to $3,000 against ordinary income, carry the rest forward. Example: Sell a losing stock for a $5,000 loss. Offset a $5,000 gain, triggering $0 tax on that gain.
2. Charitable Donations: Donate appreciated securities to charity instead of selling and donating cash. You get a tax deduction for the full fair market value, and avoid capital gains tax entirely. Win-win.
3. Donor-Advised Fund (DAF): Donate appreciated securities to a DAF, get immediate tax deduction for full value, avoid capital gains tax, then grant to charities over time.
4. Buy and Hold: Hold investments longer than 1 year to qualify for long-term rates (0-20%) vs. short-term (10-37%). This 17+ percentage point difference is enormous over a career.
5. Timing Recognition: If you have a large gain, consider spreading the sale over two calendar years. Sell half in December, half in January to split the gain across years, potentially staying in lower tax brackets.
6. Retirement Account Prioritization: Max out 401(k)s ($23,500 limit, 2024) and IRAs ($7,000 limit) first. These accounts grow tax-deferred and avoid capital gains tax entirely.
7. Direct Indexing: Instead of buying an S&P 500 index fund, buy the 500 individual stocks and harvest losses on underperformers while maintaining overall market exposure. Advanced but powerful for large portfolios.
Long-Term Wealth Building Perspective
For long-term investors, capital gains tax shouldn’t dictate strategy. Over 20+ years:
- Tax savings from holding long-term (17% difference) matter, but total return and diversification matter more
- A poorly chosen investment held 10 years still underperforms a great investment held 1 year
- Compounding over decades (via 401ks, index funds, compound interest) dwarfs tax costs
The goal: Build wealth first, optimize taxes second.
When to Consult a Tax Professional
- You have realized gains > $50,000 in a year
- You have complex rental or business income
- You received an inheritance requiring basis step-up calculations
- You’re considering charitable donations of appreciated securities
- You have wash-sale or cost-basis ambiguities
- You’re doing significant tax-loss harvesting
Accountants can identify deductions and strategies you’d miss, often paying for themselves many times over.
Source: IRS Revenue Procedure 2024-25 (2025 Tax Tables and Parameters).
⚠️ This calculator is educational only. Consult a tax professional for personalized advice.
Single, $80k income, bought $10k stock, sold $15k after 2 years
0% tax, net proceeds $15,000
Long-term gain = $5,000. Income + gain = $85,000 < $94,050 MFJ threshold. 0% rate applies.
Single, $150k income, bought $10k stock, sold $15k after 1.5 years
$660 tax (22% short-term rate), net proceeds $14,340
Short-term gain = $5,000. Gain taxed as ordinary income at 22% bracket. No NIIT (income < $200k).
Married jointly, $600k income, bought $100k, sold $150k after 5 years
$10,590 tax (20% LT + 3.8% NIIT), net proceeds $139,410
Long-term gain = $50,000. Total income = $650,000 > $250,000. Both 20% rate and $1,900 NIIT apply.
Related calculators
Results are estimates for educational purposes only and may not reflect all factors in your specific situation. This is not financial advice. Consult a qualified financial adviser for personalised guidance.