Capital Gains Tax Calculator
Estimate your capital gains tax when selling investments. Compare short-term vs long-term rates based on your holding period, filing status, and taxable income. See your net profit after taxes.
Capital gains tax is what the IRS takes when you sell an investment for more than you paid. The two key inputs are how long you held the asset and what other income you have that year. Short-term gains (held one year or less) are taxed as ordinary income at your marginal bracket — up to 37% federal. Long-term gains (held more than one year) get preferential rates of 0%, 15%, or 20% depending on income, plus a possible 3.8% Net Investment Income Tax for high earners.
This calculator estimates federal capital gains tax for stocks, ETFs, mutual funds, real estate, and other investments. Enter purchase price, sale price, holding period, filing status, and your other taxable income, and it returns your taxable gain, federal tax due, and net after-tax proceeds.
Capital gains tax is a key consideration in any sell decision. The same investment yields very different after-tax returns depending on holding period and your income year. A single high-income taxpayer can pay 23.8% (20% long-term + 3.8% NIIT) on the same gain a lower-income taxpayer pays 0% on.
Inputs
Results
Capital Gain
$5,000
Tax Rate
15%
Capital Gains Tax
$750
Net Profit
$4,250
Gain Breakdown
Formula
How to use this calculator
- Enter purchase price (your cost basis) — what you originally paid, plus reinvested dividends or commissions if applicable.
- Enter sale price — what you sold for, net of selling commissions.
- Choose holding period. The IRS holding period clock starts the day after purchase and includes the sale date. Holding from January 5 to January 6 of the following year is long-term; holding to January 4 is short-term.
- Select your filing status.
- Enter other taxable income (line 15 of your 1040). This determines which long-term capital gains bracket your gain falls into.
- Review the result. The calculator handles the bracket cliff correctly — if part of your gain falls in 0% and part in 15%, it taxes each portion at the right rate.
Worked examples
Long-term holder
Bought stock at $10K, sold 2 years later at $15K. Single filer, $75K other income. Long-term gain: $5K Long-term rate: 15% (at this income level) Tax: $750 Net: $4,250 keeps after tax If the same person had sold at 11 months instead, the $5K would have been taxed at their 22% marginal ordinary bracket — $1,100 in tax. The 30-day wait saved $350.
0% rate opportunity
Married couple, $80K other income, $20K long-term gain. Combined taxable income: $100K (just above 0% threshold of $94,050 for MFJ in 2024). Of the $20K gain: About $14K falls below threshold → 0% tax = $0 About $6K falls above → 15% × $6K = $900 Total federal tax: $900 (effective 4.5% on the gain) Strategic income management around the 0% threshold can dramatically lower tax bills. This is the "0% capital gains harvesting" strategy.
When to use this calculator
Use this calculator before any significant investment sale, when tax-loss harvesting at year-end, when planning Roth conversions, or when modeling the after-tax impact of selling a long-held position (especially appreciated stock or real estate).
Tax-strategy implications: - Hold for >1 year if possible (long-term rates are dramatically lower than ordinary) - Time sales to your income year (a low-income year can drop you into 0%) - Offset gains with losses (tax-loss harvesting; losses up to $3K/year can offset ordinary income, more carries forward) - Watch the Net Investment Income Tax (3.8%) at high incomes — total federal can reach 23.8% - State tax is on top — varies from 0% (no state income tax) to 13%+ (California top marginal)
This calculator covers federal only. For full after-tax modeling, add your state's capital gains treatment separately.
Common mistakes to avoid
- Confusing holding period with calendar dates. Holding from Jan 5 to next Jan 4 is short-term (one year exactly); Jan 5 to next Jan 6 is long-term.
- Forgetting cost basis adjustments. Reinvested dividends increase your basis; selling fees decrease the gain.
- Ignoring state tax. Some states tax capital gains at ordinary rates regardless of federal preferential treatment.
- Selling appreciated assets to "diversify" without considering the tax cost. A 23.8% tax hit on a long-held position takes a lot of "diversification" to make up.
- Forgetting the wash-sale rule. Repurchasing the same security (or substantially similar) within 30 days of a loss disallows the deduction.
- Confusing capital gains with regular income brackets. Long-term gains are taxed on a separate schedule, not added to your ordinary income brackets.
Frequently Asked Questions
Sources & further reading
- Topic No. 409 Capital Gains and Losses — Internal Revenue Service
- Capital gains tax rates — Internal Revenue Service
- Net Investment Income Tax — Internal Revenue Service