About the Capital Gains Tax Calculator
When you sell an investment — a stock, a fund, cryptocurrency, or property — for more than you paid, that profit is a capital gain, and the IRS wants a cut. But how big a cut depends on two things most people get wrong: how long you held the asset and how the gain stacks on top of your other income. This Capital Gains Tax Calculator handles both. Enter your purchase price (your cost basis), your sale price, how long you held the asset, your filing status, and your other taxable income — it returns your gain, the exact federal rate that applies, the tax you'll owe, and the profit you actually keep. It uses the official 2025 short-term and long-term rules, so it reflects real IRS thresholds rather than a flat guess.
Short-Term vs. Long-Term — The Distinction That Matters Most
The single biggest factor in your capital gains bill is the holding period:
- Short-term gains — assets held one year or less — are taxed as ordinary income, exactly like your paycheck. That means rates as high as 37%.
- Long-term gains — assets held more than one year — get the preferential 0%, 15%, or 20% rates. For most people that's 15%, roughly half the ordinary rate.
The holding period runs from the day after you buy to the day you sell. Crossing the one-year line — even by a day — can move a gain from the 22%, 24%, or 32% ordinary bracket down to 15%. That timing decision is often worth thousands.
Formula Used
For a long-term gain, the calculator "stacks" your gain on top of your ordinary taxable income and fills the rate bands from there:
Gain = Sale price − Purchase price
Stack the gain from (income) up to (income + gain)
• the slice below the 0% ceiling → taxed at 0%
• the slice up to the 20% threshold → taxed at 15%
• the slice above that threshold → taxed at 20%
Tax = 0%×slice₀ + 15%×slice₁₅ + 20%×slice₂₀
For a short-term gain, it's taxed as ordinary income, so the tax is the difference your gain adds to your ordinary-income bill:
Tax = IncomeTax(income + gain) − IncomeTax(income)
This stacking method mirrors the IRS's own Qualified Dividends and Capital Gain Tax Worksheet — which is why a single large gain can be split across two rates.
Worked Example
Say you're a single filer with $60,000 in other taxable income. You bought a stock for $10,000 and sold it two years later for $30,000 — a $20,000 long-term gain:
Gain = $30,000 − $10,000 = $20,000
0% ceiling (single, 2025) = $48,350
Your income ($60,000) is already above it → 0% slice = $0
The gain stacks from $60,000 to $80,000, all inside the 15% band
Tax = 15% × $20,000 = $3,000
After-tax profit = $20,000 − $3,000 = $17,000
Now compare: if you'd sold at 11 months instead, that same $20,000 would be a short-term gain stacked into your 22% ordinary bracket — a tax of $4,400. Waiting past the one-year mark saved $1,400 on the identical trade.
2025 Long-Term Capital Gains Brackets
Long-term rates depend on your total taxable income (income plus the gain) and your filing status. These are the 2025 thresholds:
| Filing Status | 0% Rate Up To | 15% Rate Up To | 20% Rate Above |
|---|
| Single | $48,350 | $533,400 | $533,400 |
| Married Filing Jointly | $96,700 | $600,050 | $600,050 |
| Married Filing Separately | $48,350 | $300,000 | $300,000 |
| Head of Household | $64,750 | $566,700 | $566,700 |
Notice the 0% bracket: if your income plus gain stays under the first threshold, your long-term gain is taxed at nothing. A single filer with $30,000 of income who realizes a $10,000 long-term gain pays $0 in federal capital gains tax, because the whole stack stays under $48,350. Harvesting gains deliberately in low-income years is a genuine, legal strategy.
Ways to Reduce Your Capital Gains Tax
- Hold for more than a year. The jump from ordinary rates to the 0/15/20% long-term rates is the biggest lever you have. Don't sell at 11 months if a few weeks gets you long-term treatment.
- Harvest losses. Sell losing positions to offset winners. Net losses beyond your gains deduct up to $3,000 against ordinary income each year, with the rest carried forward.
- Use the 0% bracket. In a low-income year — a gap between jobs, early retirement, a sabbatical — you may be able to realize long-term gains at 0%.
- Sell inside tax-advantaged accounts. Gains in a 401(k) or IRA aren't taxed as you trade; you're taxed (or not, for a Roth) only on withdrawal.
- Use the home-sale exclusion. Up to $250,000 of gain ($500,000 married) on a primary residence can be excluded entirely.
- Spread large sales across years to avoid pushing a big gain into the 20% band or triggering the 3.8% NIIT.
Common Mistakes
- Forgetting your cost basis includes fees. Commissions, and reinvested dividends for funds, raise your basis and lower your taxable gain.
- Assuming one flat rate. A large gain can straddle the 15% and 20% bands — the calculator's breakdown shows the split.
- Ignoring state tax. Most states tax gains too; this tool estimates federal only.
- Overlooking the NIIT. High earners owe an extra 3.8% on investment income, pushing the top long-term rate to 23.8%.
- Selling just short of a year. Missing long-term treatment by days can cost you the difference between 15% and your full ordinary rate.
Disclaimer
This calculator provides general estimates for informational purposes only and is not tax advice. It estimates federal capital gains tax using 2025 brackets and does not include state income tax, the 3.8% Net Investment Income Tax, the Alternative Minimum Tax, depreciation recapture, or the interaction with deductions and credits. Your actual liability depends on your full return. Confirm the numbers with the IRS or a qualified tax professional before making decisions. To estimate your broader tax picture, try our Income Tax Calculator and Self-Employment Tax Calculator, or project long-run growth with the Compound Interest Calculator.
Frequently Asked Questions
What is the difference between short-term and long-term capital gains?It comes down to how long you held the asset before selling. If you owned it for one year or less, the profit is a short-term gain and is taxed as ordinary income — the same rate as your salary, up to 37%. If you held it for more than one year, it's a long-term gain and qualifies for the lower 0%, 15%, or 20% long-term rates. The holding period is measured from the day after you bought the asset to the day you sold it, so timing a sale even a few days past the one-year mark can dramatically cut the tax.
What are the 2025 long-term capital gains tax rates?For 2025 (returns filed in 2026), long-term gains are taxed at 0%, 15%, or 20% depending on your total taxable income and filing status. A single filer pays 0% on gains that keep total income under $48,350, 15% up to $533,400, and 20% above that. For married filing jointly the 0% ceiling is $96,700 and the 20% threshold is $600,050. The calculator applies these breakpoints automatically based on the filing status and income you enter.
How is my capital gains tax bracket determined?Long-term capital gains are 'stacked' on top of your other taxable income, not taxed in isolation. The calculator starts your gain at the level of your ordinary income and fills the 0%, 15%, and 20% bands from there. So if your income already exceeds the 0% ceiling, none of your gain gets the 0% rate — it starts at 15%. A single large gain can even span two brackets, with part taxed at 15% and part at 20%. This stacking is exactly how the IRS worksheet computes it.
Do I have to pay capital gains tax when I sell my house?Often not. If the home was your primary residence for at least two of the last five years, the IRS Section 121 exclusion lets you exclude up to $250,000 of gain if you're single, or $500,000 if married filing jointly. You only owe capital gains tax on the profit above that exclusion. Investment properties and second homes don't qualify for the exclusion, and depreciation you claimed on a rental may be 'recaptured' and taxed separately.
Can capital losses reduce my capital gains tax?Yes. You net your gains against your losses for the year. If you sold one investment for a $10,000 gain and another for a $4,000 loss, you're taxed on the $6,000 net gain. If your losses exceed your gains, you can deduct up to $3,000 of the excess against ordinary income each year and carry the rest forward to future years. Deliberately realizing losses to offset gains is called tax-loss harvesting.
What is the Net Investment Income Tax (NIIT)?The NIIT is an extra 3.8% tax on investment income — including capital gains — for higher earners. It applies when your modified adjusted gross income exceeds $200,000 (single) or $250,000 (married filing jointly). For those taxpayers, the effective top rate on long-term gains becomes 23.8% rather than 20%. This calculator estimates the base federal capital gains tax and flags that NIIT may apply; it does not add the 3.8% automatically.
Does this calculator include state capital gains tax?No — it estimates federal tax only. Most states tax capital gains as ordinary income at their own rates, which can add several percentage points to your total. A handful of states (such as Florida, Texas, and Washington for most gains) have no state income tax on them, while high-tax states like California tax gains as regular income. Check your state's rules and add its rate on top of the federal estimate shown here.
How can I legally reduce my capital gains tax?The biggest lever is holding assets longer than a year to qualify for the lower long-term rates instead of ordinary rates. Beyond that: harvest losses to offset gains, use tax-advantaged accounts like a 401(k) or IRA where gains grow untaxed, spread large sales across tax years to stay in a lower bracket, and take advantage of the 0% bracket in lower-income years. For a home, use the primary-residence exclusion. This tool is a great way to test how each move changes your bill.
Does this apply to cryptocurrency and stocks the same way?Yes. The IRS treats stocks, mutual funds, ETFs, cryptocurrency, and most other property under the same capital gains rules. Held one year or less, the gain is short-term (ordinary rates); held longer, it's long-term (0/15/20%). Each sale, swap, or crypto-to-crypto trade is a taxable event, so enter your cost basis (what you paid, including fees) and proceeds for that specific lot to estimate the tax.