Taxes · Capital gains

Capital gains tax calculator

The rate you pay on a gain depends on the income underneath it. This calculator stacks the gain on top of your ordinary income the way the IRS does, so the 0%, 15%, or 20% figure is the one you actually owe — not a headline rate.

Federal tax on this gain

Enter your numbers above.

Rate on the gain
3.8% surtax (NIIT)

"Other taxable income" means your ordinary taxable income after deductions — wages, interest, business income — before this gain. It is the income the gain stacks on top of. The NIIT line uses your income plus the gain as an estimate of MAGI; see the caveats below.

How the math works

A capital gain is what you sell an asset for, minus what you paid for it (your cost basis). How it's taxed turns on one thing: how long you held it.

Held one year or less, it's a short-term gain, and it gets no special treatment. It's added to your ordinary income and taxed at your ordinary marginal rate — the same 10% to 37% brackets your paycheck runs through.

Held longer than a year, it's a long-term gain, taxed at 0%, 15%, or 20%. But those rates aren't read off the gain in isolation. The gain is stacked on top of your ordinary taxable income, and the ordinary income fills the lower brackets first.

rate on the gain = the 0/15/20% band the gain lands in
once it is stacked ON TOP of your ordinary taxable income

So a filer with high ordinary income has already used up the 0% and part of the 15% space before the gain is counted. A filer with low ordinary income has 0% room to spare, and part or all of the gain can be tax-free. Same gain, different rate, decided entirely by the income beneath it. A gain large enough to cross a threshold is split: the part below the line is taxed at the lower rate, the part above at the next one up.

The 2024 long-term brackets for a single filer: 0% up to $47,025 of stacked income, 15% from there to $518,900, and 20% above $518,900. For married filing jointly the 0% band runs to $94,050 and the 15% band to $583,750.

Worked example

Take a single filer with $59,540 of ordinary taxable income — the U.S. median individual earnings for full-time workers — who sells a long-held investment for a $20,000 gain.

The 0% band ends at $47,025, and this filer's ordinary income already sits above it. So none of the gain is tax-free. The whole $20,000 stacks between $59,540 and $79,540 — inside the 15% band. Tax on the gain: $3,000.

Now suppose the same filer had sold a month before the one-year mark, making it short-term. The $20,000 is taxed as ordinary income. At $59,540, this filer is in the 22% bracket, and the gain doesn't push them out of it, so all $20,000 is taxed at 22%: $4,400.

The one-year holding period is worth $1,400 here — the gap between $4,400 and $3,000. That's a real number attached to a calendar date, and it's the single most useful thing this calculation produces: it tells you what patience is worth before you sell.

When this calculator is wrong

This tool computes the federal income tax on the gain. That's not the whole bill, and here's where the number on the screen understates what you'll actually owe.

What to do with the result

The most actionable output here isn't the tax — it's the holding-period gap. If you're inside a year of the purchase date on an asset you plan to sell, the calculator's short-term-vs-long-term difference is the price of selling now. In the worked example that price was $1,400 on a $20,000 gain. Weigh it against your reason for selling early.

The second move is checking whether you're near a threshold. If your stacked income lands just above the $47,025 (single) or $94,050 (joint) 0% ceiling, or just under the $200,000/$250,000 NIIT line, the timing of a sale across two tax years — or a deductible contribution that lowers your income in the year of the sale — can move a slice of the gain into a lower band. That's where a gain calculator stops and a tax-year plan starts.

Common questions

What's the difference between short-term and long-term capital gains?
The holding period. Held one year or less, a gain is short-term and taxed at your ordinary income rate (10% to 37%). Held more than a year, it's long-term and taxed at 0%, 15%, or 20%. The line is exactly one year and a day from the purchase date.
Do capital gains push me into a higher tax bracket?
A long-term gain doesn't raise the rate on your ordinary income — the two are taxed on separate schedules. But the gain does stack on top of your income, so it can land part of itself in a higher capital-gains band, and it raises your total income for other tests like the NIIT threshold and Medicare premiums. A short-term gain is ordinary income, so it can push your ordinary income into a higher bracket directly.
How can a long-term gain be taxed at 0%?
If your ordinary income plus the gain stays under the 0% ceiling — $47,025 for a single filer, $94,050 for joint filers in 2024 — the gain that fits under that line is taxed at nothing. Low-income years, gap years, and early retirement before Social Security starts are the classic windows for this.
Does the calculator include state tax?
No. It's federal only. Most states tax capital gains as ordinary income with no long-term discount, so your combined rate is usually higher than the federal figure shown. Add your state's rate separately.
What is the 3.8% Net Investment Income Tax?
A surtax on investment income — gains, interest, dividends, rents — for filers with modified adjusted gross income above $200,000 single or $250,000 joint. It applies to the lesser of your net investment income or the amount your income exceeds the threshold, so it's charged only on the investment income above the line.