Capital Gains Tax Calculator
Work out the federal tax on selling an investment in 2026, compare what the same sale would cost at short-term versus long-term rates, apply any losses, and see what you actually keep.
What this calculator estimates
This tool estimates the federal tax on selling an investment: the gain itself, which rate bands it falls into, whether the 3.8% net investment income tax applies, and what is left afterwards. It also shows the same sale under the opposite holding period, which is usually the single most consequential number on the page.
How to use it
- Enter your other taxable income first. This is not optional detail — it determines your capital gains rate entirely.
- Choose whether you held the asset more than one year.
- Enter what you paid and what you sold for, plus any commissions on either side.
- Add other gains, losses, or a carried-forward loss if you have them.
How the calculation works
The gain is the sale price less selling costs, minus your cost basis — the purchase price plus acquisition costs. Getting basis right matters: fees, commissions, and reinvested dividends all increase it and reduce the taxable gain.
How that gain is taxed depends entirely on the holding period:
- Held one year or less — a short-term gain, taxed as ordinary income at your marginal rate, which can reach 37%.
- Held more than one year — a long-term gain, taxed at 0%, 15%, or 20%.
The critical point about those preferential rates is that long-term gains are not taxed in their own separate brackets. They stack on top of your ordinary taxable income, and your ordinary income fills the 0% band first. A single filer with $20,000 of ordinary income and a $25,000 gain pays nothing on most of that gain. The same $25,000 gain for someone earning $200,000 is taxed at 15%, and above the upper threshold at 20%.
Losses are netted before any of this. Short-term losses offset short-term gains, long-term against long-term, then across categories. If losses still exceed gains, up to $3,000 a year comes off ordinary income ($1,500 if married filing separately) and the rest carries forward indefinitely.
Finally, the net investment income tax adds 3.8% on the lesser of your net investment income and the amount by which your modified AGI exceeds $200,000 (single) or $250,000 (joint). These thresholds are written into the statute and have never been indexed for inflation, so more people cross them every year.
A worked example
A single filer with $78,000 of other taxable income sells stock bought for $24,000 and sold for $61,000, with $150 of buying commission and $400 of selling costs. The gain is $36,450.
Held long-term: their ordinary income of $78,000 already exceeds the $49,450 zero-rate ceiling, so the whole gain is taxed at 15% — about $5,468. Held short-term instead, the same gain is taxed at ordinary rates in the 22% and 24% bands, costing meaningfully more. The comparison table in the results shows both.
Important limitations
- No main home exclusion. If this was your primary residence, a large part of the gain may not be taxable at all. This calculator does not apply that exclusion.
- Special asset types are not modelled. Collectibles, qualified small business stock, and the unrecaptured Section 1250 gain on depreciated real estate use different rates.
- No wash sale rules. Repurchasing a substantially identical security within 30 days defers a loss you might expect to claim now.
- No state rates are built in. State tax appears only if you enter a rate.
- Modified AGI is approximated from the figures you enter, so the NIIT result is indicative rather than exact.
Frequently asked questions
How long is "long-term"?
More than one year. The clock starts the day after you acquire the asset and runs to the day you sell. Selling a day early moves the entire gain to ordinary income rates, which is why the comparison in the results is worth looking at before you sell.
Why is my rate 0%?
Because your ordinary income is low enough that the gain still falls below the zero-rate ceiling for your filing status. This is genuine, not an error — a modest income with a long-term gain can face no federal capital gains tax at all.
How much of a loss can I use?
Losses offset gains without limit. Beyond that, $3,000 a year against ordinary income ($1,500 if married filing separately), with the remainder carrying forward indefinitely until it is used up.
Do I owe tax on gains inside my 401(k) or IRA?
No. Gains inside tax-advantaged retirement accounts are not taxed as they occur. This calculator is for assets held in a regular taxable brokerage account.
What is the net investment income tax?
A 3.8% surtax on investment income for higher earners, on top of the capital gains tax itself. Because its thresholds are not inflation-adjusted, it reaches steadily further down the income scale each year.
Official sources
- IRS Rev. Proc. 2025-32 — 2026 adjusted net capital gain thresholds.
- IRS Schedule D — capital gains and losses.
- IRS Publication 550 — investment income and expenses.
- IRS Form 8960 — net investment income tax.
Related calculators
This calculator is provided for general educational and estimation purposes only. It does not constitute tax, legal, accounting, or financial advice. Tax laws and individual circumstances vary, and your actual tax liability may differ. Review official IRS guidance or consult a qualified tax professional before making tax-related decisions. Ledgerwise is not affiliated with, endorsed by, or approved by the Internal Revenue Service or any government agency.