Capital Gain
Estimated Federal Tax
Effective Tax Rate
After-Tax Proceeds
Table of Contents
Capital Gains Tax — Short-Term vs Long-Term
Holding an investment for more than a year cuts the federal tax on the gain from up to 37% (ordinary income rates) down to 0%, 15%, or 20%. This calculator uses 2026 IRS brackets to estimate the federal tax based on your filing status and other taxable income.
How the capital gains calculation works
The gain itself is a simple subtraction. The tax is what gets nuanced:
Capital Gain = Sale Price − Cost Basis
- Sale Price — what you received when you sold (net of selling commissions if you want to be precise).
- Cost Basis — what you originally paid, plus any commissions, plus capital improvements (for property).
- Long-term tax — the gain is stacked on top of your other taxable income and taxed at 0%, 15%, or 20% based on where it falls in the LTCG brackets.
- Short-term tax — the gain is taxed at your marginal ordinary income rate (10% to 37%).
Worked example using the calculator's default values ($10,000 cost basis, $25,000 sale price, long-term, single filer, $75,000 other income):
- Capital gain = $25,000 − $10,000 = $15,000
- Total taxable income with gain = $75,000 + $15,000 = $90,000 (between $48,350 and $533,400 LTCG threshold for single)
- All $15,000 falls inside the 15% long-term bracket
- Federal tax = $15,000 × 0.15 = $2,250
- After-tax proceeds = $25,000 − $2,250 = $22,750
If the same trade had been short-term, the $15,000 would have been taxed at the 22% ordinary bracket (since the $75,000 base income already exceeds the 22% threshold of $48,475), producing roughly $3,300 of federal tax — an extra $1,050 just for not holding 366 days.
2026 long-term capital gains brackets
Long-term rates are calculated on your total taxable income (ordinary income plus the gain), not on the gain in isolation. The gain is stacked on top — if your ordinary income already places you in the 15% LTCG band, the entire gain is taxed at 15% (or partially at 20% if it pushes you into the top band).
| Filing status | 0% rate | 15% rate | 20% rate |
|---|---|---|---|
| Single | Up to $48,350 | $48,351 – $533,400 | Above $533,400 |
| Married filing jointly | Up to $96,700 | $96,701 – $600,050 | Above $600,050 |
| Head of household | Up to $64,750 | $64,751 – $566,700 | Above $566,700 |
| Married filing separately | Up to $48,350 | $48,351 – $300,000 | Above $300,000 |
Short-term gains use ordinary income brackets
Short-term capital gains receive no special treatment — they are taxed as ordinary income at the standard 10%, 12%, 22%, 24%, 32%, 35%, or 37% federal brackets. For a high earner, the difference between selling on day 365 and day 366 can mean paying more than double the rate.
This is why active traders often face surprisingly large tax bills. Frequent buying and selling generates short-term gains taxed at full income rates and produces none of the deferral benefit of long-term holding. For taxable accounts, the math overwhelmingly favors holding investments for more than a year whenever possible.
Offsetting gains with losses
Capital losses offset capital gains dollar-for-dollar. Short-term losses first offset short-term gains; long-term losses offset long-term gains. Any remaining loss in one category can offset the other. If you still have a net loss, you can deduct up to $3,000 against ordinary income each year ($1,500 if married filing separately), with the unused portion carried forward indefinitely.
Tax-loss harvesting is the deliberate sale of losing positions to capture the loss for tax purposes. Watch out for the IRS wash-sale rule: buying back the same or a "substantially identical" security within 30 days disallows the loss. Many investors swap into a similar but not identical fund (e.g., one S&P 500 ETF for another) to maintain market exposure while still capturing the loss.
The 3.8% Net Investment Income Tax
NIIT adds 3.8% on top of capital gains tax for high earners. It applies once modified adjusted gross income exceeds $200,000 (single) or $250,000 (married filing jointly). The tax is charged on the lesser of net investment income or the amount of MAGI above the threshold. Above those levels, NIIT effectively raises the top long-term capital gains rate from 20% to 23.8%.
This calculator does not include NIIT. If your MAGI is clearly above the thresholds, add 3.8% to the result. State capital gains taxes are also not included — most states tax gains as ordinary income (up to 13.3% in California). Nine states have no state income tax: Alaska, Florida, Nevada, New Hampshire, South Dakota, Tennessee, Texas, Washington, Wyoming.
Limitations of this calculator
- Federal only. State capital gains taxes (often equal to your state income tax rate) are not included.
- No NIIT. The 3.8% Net Investment Income Tax is not applied automatically.
- Standard assets only. Collectibles (28% max), Section 1202 small-business stock, and Section 1250 depreciation recapture have their own special rates and are not modeled.
- Cost basis simplification. Wash sales, return-of-capital distributions, adjusted basis from gifts/inheritance, and lot-specific (FIFO vs specific ID) accounting are all simplified to a single purchase price.
- Brackets shown for 2026. Tax thresholds adjust annually with inflation — verify against IRS publications for the year you actually file.
Sources & references
- IRS Topic 409 — Capital Gains and Losses — the authoritative IRS overview of short-term vs long-term treatment and current rate thresholds.
- IRS Publication 550 — Investment Income and Expenses — detailed treatment of cost basis, wash sales, and netting rules.
- IRS Schedule D & Form 8949 — how capital gains are reported on a federal return.
- IRS — Net Investment Income Tax (NIIT) — thresholds and calculation for the 3.8% surtax.
FAQs
With $75,000 of other taxable income and a $15,000 long-term gain, single filers stack the gain on top of ordinary income. Your total taxable income lands at $90,000 — well inside the 15% long-term bracket ($48,350 to $533,400). The entire $15,000 gain is taxed at 15% = $2,250 federal tax. After-tax proceeds on a $25,000 sale (with a $10,000 cost basis) would be roughly $22,750.
Almost always yes. Selling on day 365 of holding is short-term — taxed as ordinary income at up to 37%. Selling on day 366 (one year and one day) qualifies as long-term — taxed at 0%, 15%, or 20%. On a $20,000 gain for a taxpayer in the 24% ordinary bracket, that one-day difference cuts tax from $4,800 to $3,000 — a $1,800 saving for waiting 24 hours. The only reason to sell early is if you expect the asset to drop more than the tax difference between selling now and waiting.
Yes for stocks, mutual funds, and most other investments — the gain is realized when you sell, regardless of what you do with the cash. Two notable exceptions: a 1031 like-kind exchange lets you defer tax when swapping one investment real estate property for another, and Qualified Opportunity Zone investments can defer (and partially eliminate) gains reinvested within 180 days. Within tax-advantaged accounts (IRA, 401(k), Roth), no gain is realized when you trade between investments inside the account.
NIIT adds 3.8% on top of capital gains tax for high earners. It applies once modified adjusted gross income exceeds $200,000 (single) or $250,000 (married filing jointly), and is charged on the lesser of net investment income or the amount above the threshold. A single filer with $220,000 MAGI including a $50,000 long-term gain would owe 20% of $20,000 (the portion above the threshold) = $760 extra. This calculator does not include NIIT — add 3.8% mentally if you are clearly above the thresholds.
Five practical strategies: (1) hold for more than a year to qualify for long-term rates; (2) harvest losses to offset gains (short-term first against short-term, then long-term against long-term); (3) use tax-advantaged accounts — gains inside IRAs, Roth IRAs, and 401(k)s are tax-deferred or tax-free; (4) for a primary residence, the home-sale exclusion shelters up to $250,000 of gain ($500,000 married) if you lived there 2 of the last 5 years; (5) donate appreciated securities directly to charity — you avoid the gain entirely and get a deduction at full market value.