Capital Gains Tax Calculator (U.S. Federal Estimate)
Use this tool to estimate taxes on stock, crypto, real estate (non-primary residence), or other investment gains. For a better estimate, include your other taxable income.
How to calculate tax on capital gains
Capital gains tax is based on your profit, not your total sale amount. The quick formula is:
Capital Gain = Net Sale Proceeds β Cost Basis
- Net Sale Proceeds: sale price minus selling fees, commissions, and transaction costs.
- Cost Basis: purchase price plus certain purchase costs and qualified capital improvements.
Short-term vs. long-term matters a lot
The tax rate depends on how long you held the asset:
- Short-term gain (held 1 year or less): taxed like ordinary income.
- Long-term gain (held more than 1 year): generally taxed at 0%, 15%, or 20% federally, depending on taxable income and filing status.
That difference is why timing a sale by just a few weeks can materially change your tax bill.
Step-by-step example
Suppose you bought an investment for $30,000, paid $500 in purchase fees, added $2,500 of improvements, then sold it for $48,000 with $1,500 in selling costs.
- Cost basis = $30,000 + $500 + $2,500 = $33,000
- Net proceeds = $48,000 β $1,500 = $46,500
- Capital gain = $46,500 β $33,000 = $13,500
Then apply the right tax rates based on your holding period and income profile.
Inputs that improve estimate accuracy
1) Include other taxable income
Long-term capital gain brackets are determined using total taxable income. If you ignore your wages or business income, your estimate can be too low.
2) Donβt forget transaction costs
Commissions and fees can reduce taxable gain. Small amounts add up, especially for frequent traders.
3) Add state taxes
Some states tax capital gains like ordinary income, while others have no income tax at all. Enter your estimated state rate to get a better full-picture total.
Ways people legally reduce capital gains taxes
- Hold longer than one year to qualify for long-term rates.
- Tax-loss harvest by realizing losses to offset gains.
- Spread sales across years to stay in lower brackets.
- Use tax-advantaged accounts where possible (e.g., retirement accounts).
- Track basis carefully so you do not overpay tax.
Common mistakes when calculating capital gains tax
- Using sale price instead of net proceeds.
- Forgetting qualified improvements in basis.
- Ignoring NIIT for higher-income households.
- Assuming one flat federal rate applies to all gains.
- Not separating short-term from long-term transactions.
Important notes
This page gives a practical estimate for planning, not a filing-ready tax return. Real returns can include depreciation recapture, wash-sale rules, collectibles rates, opportunity zone rules, primary residence exclusions, and more. If your transaction is large, a CPA or EA review is worth it.