Retirement & Investing · Tool

Capital Gains Tax Calculator

Long-term gains are not taxed at one flat rate — they stack on top of your other income and flow through the 0%, 15% and 20% thresholds in order, which is why two people with the same gain can owe very different tax. Enter your 2027 income and gains and this calculator does the stacking the IRS worksheet does, then layers the home-sale exclusion and the 3.8% net investment income tax where they apply.

Runs in your browserNothing saved or sentFree — no email required
Fills this tool with the worked example it is tested against — illustrative numbers, not a recommendation. How we test

You and your other income

"Other taxable income" is your taxable income from everything except these gains — roughly, wages and other income minus the standard or itemized deduction. It matters because the gains stack on top of it: the first dollars of gain fill whatever is left of the 0% zone.

The gains and losses

Short-term means held one year or less and is taxed as ordinary income. If you sold your main home, check the box and enter that gain: the §121 exclusion ($250,000 single, $500,000 joint) comes off before any tax is figured.

How this is calculated

Netting first. Losses offset gains of the same kind first, then the other kind; a net loss beyond the gains offsets up to $3,000 of other income this year ($1,500 filing separately), and the rest carries forward — the calculator shows both the amount used and the amount carried.

Then the stacking. Your other taxable income fills the brackets first. Long-term gains sit on top: for 2027, the part of the stack that stays under $51,050 of total taxable income (single) or $102,100 (joint) is taxed at 0%; the part up to $563,200 / $633,600 at 15%; anything above at 20%. In the worked example — $40,000 of other income plus a $5,000 short-term gain, so a $45,000 ordinary layer, under a $20,000 long-term gain — $6,050 of the gain lands in the 0% zone and $13,950 at 15%. Short-term gains are taxed by the difference method the IRS worksheet uses (total tax with them, minus total tax without them), which is why a short-term gain can also push some long-term gain out of the 0% zone; the results panel calls that out when it happens.

The NIIT layer. The 3.8% net investment income tax applies to the smaller of your net investment income or the amount your modified AGI passes $200,000 (single) / $250,000 (joint) — thresholds set in statute and never inflation-adjusted. It is computed separately and shown separately.

What is not modeled, stated plainly. State taxes; the 25% rate on unrecaptured §1250 gain and the 28% rate on collectibles; qualified dividends (they stack the same way — add them to long-term gains for a close estimate); AMT; and wash-sale adjustments, which change the losses you may claim.

Official documentation and references

Keep going