Capital gains tax calculator: the gain, the holding period and the 0%, 15% and 20% slices
This page is for United States, federal rules (IRS); state taxes are not covered
Type what you paid and what you got, the two dates, your filing status and your other taxable income. The tool works out the gain, tells you if it is short-term or long-term, and shows the federal tax slice by slice. US federal tax only, in US dollars.
Subtract what you paid (costs included) from what you got (costs taken out). That is the gain. Held more than one year, it is long-term. It sits on top of your other taxable income, and the part under the 0% line is taxed at 0%, the part under the 15% line at 15%, and the rest at 20%. Held one year or less, it is taxed as ordinary income.
| Rate | Part of the gain | Tax on that part |
|---|
How it works: the gain is what you got minus what you paid, costs included on both sides. If you held the asset more than one year, the gain is long-term. It sits on top of your other taxable income, like blocks on a stack. The part of the stack under the 0% line is taxed at 0%. The part under the 15% line is taxed at 15%. Anything higher is taxed at 20%. If you held it one year or less, the gain is taxed as ordinary income, bracket by bracket.
What "other taxable income" means
It is your taxable income before this sale: pay and other income, minus your deduction. It is the figure on your return after the standard or itemized deduction. Do not add the gain to it. The tool does that. The year's brackets and thresholds are on the federal tax brackets page and the capital gains tax brackets page. To see what each number does, read how capital gains tax is calculated.
The formula
- Gain = (amount received − selling costs) − (price paid + buying costs)
- Long-term if the sale date is after the same date one year later (counting starts the day after you bought)
- 0% part = gain under the 0% line; 15% part = gain between the 0% and 15% lines; 20% part = gain above the 15% line
- Each part is measured on the stack: other taxable income first, the gain on top
- Short-term gain tax = ordinary tax on (other income + gain) − ordinary tax on other income
- Other taxable income
- your taxable income before this sale (after the standard or itemized deduction)
- 0% and 15% lines
- the IRS 'maximum zero rate amount' and 'maximum 15 percent rate amount' for your filing status and year
Worked example (made-up numbers)
- A single filer bought shares on January 15, 2025 for $10,000 and sold them on June 20, 2026 for $20,000. No fees. The gain is $10,000.
- More than one year passed, so it is long-term. Other taxable income is $45,000.
- The 2026 single 0% line is $49,450. Room under it: $49,450 − $45,000 = $4,450 taxed at 0%.
- The other $5,550 sits above the 0% line and below the 15% line ($545,500), so it is taxed at 15%: $5,550 × 15% = $832.50.
$832.50 of federal tax on the $10,000 gain. Held one year or less, the same gain would be taxed as ordinary income: $648 at 12% plus $1,012 at 22%, which is $1,660.
What this assumes
- It uses the thresholds for the year you pick: Rev. Proc. 2025-32 for 2026 and Rev. Proc. 2026-35 for 2027. A sale in any other year needs that year's table.
- It treats the sale as your only capital transaction of the year. Other gains and losses are not netted. Net them first and enter the net result.
- 'Other taxable income' is your taxable income before this sale. Qualified dividends are not stacked in this tool.
- It counts a sale as long-term when the sale date is after the same date one year later. A purchase on February 29 counts as February 28. That one case is not spelled out on the IRS pages read.
- It leaves out state tax, the 3.8% net investment income tax, the 25% and 28% rates (collectibles, small business stock, real estate depreciation), wash sales, and gifted or inherited basis rules.
- For a loss it shows the deduction against other income, limited to $3,000 ($1,500 for married filing separately), and the carryover. It uses your ordinary bracket rates to estimate the saving.
- The tool figures the tax in whole cents. Your return rounds to whole dollars, and a tax software run can differ by a few dollars.
Questions
How is capital gains tax calculated?
Subtract your adjusted basis (what you paid plus buying costs) from the amount you realized (what you got minus selling costs). If you held the asset more than one year, the gain is taxed at 0%, 15% or 20% by where it falls on top of your other taxable income. Otherwise it is taxed as ordinary income. See how capital gains tax is calculated.
Does the gain count toward the 0% line?
Yes. The lines measure taxable income, and the gain is part of it. Your other income fills the stack first. The gain sits on top.
What if I sold at a loss?
A capital loss first offsets capital gains. If losses are larger, up to $3,000 ($1,500 if married filing separately) can reduce other income each year. The rest carries over.
Which dates does it use?
The day you bought it and the day you sold it. The IRS counts the holding period from the day after you bought through the day you sold. More than one year is long-term.
Reminder: this page is for United States, federal rules (IRS); state taxes are not covered
Follow along