calculate capital gains tax calculator

Capital Gains Tax Calculator

Estimate federal and state capital gains tax for stocks, crypto, real estate, or other investments. This tool is for education and planning.

12+ months is treated as long-term in this calculator.

Important: This estimate does not include every IRS rule, depreciation recapture, exclusion tests, AMT, or local taxes. Verify with a CPA or tax advisor.

How to Calculate Capital Gains Tax

A capital gain is the profit you make when you sell an asset for more than your adjusted cost basis. Your tax bill depends on three major things: the size of the gain, how long you held the asset, and your overall income.

This calculator helps you estimate tax quickly by combining:

  • Cost basis adjustments (purchase price + improvements)
  • Net proceeds (sale price - selling costs)
  • Holding period (short-term vs. long-term)
  • Federal rates, NIIT, and optional state tax

Inputs Explained

1) Purchase Price and Capital Improvements

Your basis starts with what you paid. Improvements that add value or extend life can increase basis, which usually lowers taxable gain.

2) Sale Price and Selling Costs

Tax is based on gain, not just sale price. Commissions, transaction fees, and closing costs can reduce your taxable amount.

3) Holding Period

If you hold an asset for less than one year, gains are generally short-term and taxed like ordinary income. Longer holdings are often taxed at long-term capital gains rates (0%, 15%, or 20% federal, depending on income).

4) Taxable Income

Long-term capital gains rates are income-based. This calculator uses your taxable income before the gain to estimate how your gain may be split across long-term brackets.

5) Loss Carryover

If you have unused capital losses from prior years, they can offset current gains. Enter the portion you plan to apply here.

Formula Used in This Capital Gains Tax Calculator

Adjusted Basis = Purchase Price + Improvements

Net Proceeds = Sale Price - Selling Costs

Raw Gain = Net Proceeds - Adjusted Basis

Taxable Gain = max(0, Raw Gain - Loss Carryover)

For long-term gains, the taxable gain is allocated through 0%, 15%, and 20% brackets based on filing status and income. For short-term gains, the calculator applies your entered ordinary tax rate.

Why a Capital Gains Estimate Matters

  • Better timing: Selling in a lower-income year can reduce tax.
  • Smarter rebalancing: Know tax costs before changing investments.
  • Cash planning: Avoid tax surprises at filing time.
  • Strategy testing: Compare hold vs. sell decisions quickly.

Short-Term vs. Long-Term Capital Gains

Short-Term Capital Gains

These are usually taxed as ordinary income. If your marginal rate is high, short-term trading can create significant tax drag.

Long-Term Capital Gains

Long-term gains usually receive preferential tax treatment. For many households, this means lower rates than ordinary income, especially when gains fall partly in the 0% or 15% brackets.

Common Ways Investors Reduce Capital Gains Tax

  • Hold assets for longer than one year when appropriate
  • Harvest losses to offset realized gains
  • Spread sales over multiple tax years
  • Use tax-advantaged accounts when available
  • Track basis carefully so you do not overpay

FAQ

Does this calculator include every tax rule?

No. It is a practical estimate tool, not official tax advice. Certain assets (like collectibles, qualified small business stock, or depreciated real estate) can have special rules.

What about the home sale exclusion?

This version does not apply primary home exclusion tests. If your sale may qualify, your actual tax could be much lower.

Should I include NIIT?

If your income is near NIIT thresholds, include it to avoid underestimating tax. NIIT is often overlooked in DIY estimates.

Final Note

Use this calculator to plan, compare scenarios, and ask better questions before selling appreciated assets. For final filing decisions, review your numbers with a qualified tax professional.

🔗 Related Calculators