How it's calculated
Estimate for education only, not tax advice. Check with a tax professional or IRS guidance.
Gain (or loss) = sale proceeds − cost basis
Long-term = held more than 1 year; otherwise short-term
Short-term gain: tax = regular tax(income + gain) − regular tax(income)
Long-term gain (IRS Qualified Dividends and Capital Gain Tax Worksheet):
line 1 taxable income including the gain
line 5 ordinary part = line 1 − gain
line 9 taxed at 0% = min(line 1, 0% maximum) − min(line 5, 0% maximum)
line 17 taxed at 15% = min(gain − line 9, max(0, min(line 1, 15% maximum) − line 5 − line 9))
line 20 taxed at 20% = gain − line 9 − line 17
line 25 tax = smaller of (15% × line 17 + 20% × line 20 + regular tax(line 5)) or regular tax(line 1)
tax on the gain = line 25 − regular tax(income)
Net Investment Income Tax (optional estimate):
NIIT = 3.8% × min(gain, max(0, MAGI − threshold)), MAGI ≈ taxable income + gain
Effective rate on the gain = tax on the gain ÷ gain
- Stacking. Long-term gains sit on top of your ordinary taxable income. Your other income fills the 0% band first, so only the part of the 0% band it leaves empty is available to the gain; the rest of the gain is taxed at 15% up to the 15% maximum and at 20% above it. The tax on your other income doesn't change.
- Line 25. The IRS worksheet takes the smaller of the capital-gain-rate tax and the regular tax. Just above the 0% maximum, the regular 12% bracket can still be cheaper than 15%, so in that narrow range the gain is taxed at 12% (example 6).
- Exact arithmetic. Amounts are handled in exact cents and the tax is rounded to the cent only at the end. The calculator uses the IRS tax rate schedules exactly. For taxable income under $100,000 the IRS has you use its Tax Table, which works in $50 steps, so a real return can differ by a few dollars.
- Losses. No tax is due on a loss. A net capital loss can be deducted against ordinary income, up to $3,000 a year ($1,500 if married filing separately), and the rest carries forward to later years. The "estimated tax reduction" is the regular tax on your income minus the regular tax on your income less the deduction. If you have several gains and losses this year, they are netted first: use the tax-loss offset calculator.
- Holding period from dates. Following IRS Topic 409, the count starts the day after you bought and includes the day you sold; the sale is long-term if it is after the one-year anniversary of the purchase (for a February 29 purchase, the calculator treats February 28 of the next year as the anniversary). Property you received as a gift or inheritance has different holding-period rules (see IRS Topic 409 and Publication 544).
- NIIT is a rough estimate. The tax is 3.8% of the smaller of your net investment income or the amount your modified adjusted gross income (MAGI) is over $200,000 (single or head of household), $250,000 (married filing jointly) or $125,000 (married filing separately). These thresholds are set by law and are not adjusted for inflation. The calculator counts only this gain as investment income and approximates MAGI as taxable income plus the gain. Real MAGI is figured before deductions, so it is usually higher, and other investment income (dividends, interest, other gains) also counts: the real NIIT can be higher than this estimate.
- Verified two ways: hand-worked cases at every bracket boundary for each filing status in our automated tests, and a separate Python program that follows the IRS worksheet line by line with exact fractions and compares thousands of random cases with this calculator to the cent.
2026 long-term capital gain rates (taxable income including the gain)
| Rate | Single | Married filing jointly | Married filing separately | Head of household |
|---|---|---|---|---|
| 0% | Up to $49,450 | Up to $98,900 | Up to $49,450 | Up to $66,200 |
| 15% | $49,450 – $545,500 | $98,900 – $613,700 | $49,450 – $306,850 | $66,200 – $579,600 |
| 20% | Over $545,500 | Over $613,700 | Over $306,850 | Over $579,600 |
2026 ordinary income tax brackets (used for short-term gains)
| Rate | Single | Married filing jointly | Married filing separately | Head of household |
|---|---|---|---|---|
| 10% | $0 – $12,400 | $0 – $24,800 | $0 – $12,400 | $0 – $17,700 |
| 12% | $12,400 – $50,400 | $24,800 – $100,800 | $12,400 – $50,400 | $17,700 – $67,450 |
| 22% | $50,400 – $105,700 | $100,800 – $211,400 | $50,400 – $105,700 | $67,450 – $105,700 |
| 24% | $105,700 – $201,775 | $211,400 – $403,550 | $105,700 – $201,775 | $105,700 – $201,750 |
| 32% | $201,775 – $256,225 | $403,550 – $512,450 | $201,775 – $256,225 | $201,750 – $256,200 |
| 35% | $256,225 – $640,600 | $512,450 – $768,700 | $256,225 – $384,350 | $256,200 – $640,600 |
| 37% | Over $640,600 | Over $768,700 | Over $384,350 | Over $640,600 |
Sources (checked 2026-10-19)
- 2026 tax rate tables (section 4.01) and the maximum 0% and 15% capital gain rate amounts (section 4.03): Rev. Proc. 2025-32, IRS.
- The same 2026 brackets in plain language: IRS news release IR-2025-103 (Oct. 9, 2025), "IRS releases tax inflation adjustments for tax year 2026, including amendments from the One, Big, Beautiful Bill".
- Net Investment Income Tax rate and thresholds: IRS Topic no. 559, Net investment income tax; "not indexed for inflation": IRS, Questions and answers on the Net Investment Income Tax.
- Short-term vs long-term, holding period, the $3,000 / $1,500 loss limit and carryover: IRS Topic no. 409, Capital gains and losses.
- Method: the Qualified Dividends and Capital Gain Tax Worksheet in the Instructions for Form 1040 (line 16). The 2026 instructions aren't out yet; the worksheet's steps are the same each year and only the dollar amounts change.
What this calculator does not include
- State and local income tax. Federal only.
- Alternative minimum tax (AMT).
- Collectibles (such as coins or art, taxed at up to 28%), unrecaptured section 1250 gain on real estate (up to 25%) and qualified small business stock (section 1202).
- Wash sales. A loss can be disallowed if you buy substantially identical securities within 30 days before or after the sale; this isn't checked.
- Netting several gains and losses. One sale at a time. Your other income is treated as ordinary income with no qualified dividends or other capital gains or losses; for netting, use the tax-loss offset calculator.
- Knock-on effects. A gain raises your adjusted gross income, which can change deductions, credits and other income-based amounts. Those changes aren't modeled.
- Estimated tax payments, penalties, and special holding-period rules (gifts, inheritances, options, short sales).
Worked examples
1. Single, $60,000 of other income, $10,000 long-term gain
Taxable income before the sale is $60,000, already above the $49,450 single 0% maximum, so the 0% band is full. The whole $10,000 gain falls in the 15% band (it ends at $545,500): 15% × $10,000 = $1,500.00, an effective rate of 15.00%. Check with the worksheet: regular tax on $60,000 is $7,912.00; plus $1,500.00 = $9,412.00, which is less than the $10,112.00 regular tax on $70,000, so line 25 is $9,412.00 and the gain adds $1,500.00. Load this example
2. A gain that straddles the 0% and 15% rates
Single, $40,000 of other taxable income, $20,000 long-term gain. The 0% band runs to $49,450, so $49,450 − $40,000 = $9,450.00 of the gain is taxed at 0% and the other $10,550.00 at 15%: 15% × 10,550.00 = $1,582.50, an effective rate of 7.91%. Load this example
3. The same gain, short-term
Held a year or less, the $20,000 is ordinary income. It fills the 12% bracket from $40,000 to $50,400 and the rest is taxed at 22%: 12% × 10,400.00 + 22% × 9,600.00 = $1,248.00 + $2,112.00 = $3,360.00 (regular tax on $60,000 minus regular tax on $40,000), an effective rate of 16.80%. Holding more than a year would cost $1,582.50 instead. Load this example
4. Married filing jointly, high income, with the NIIT
$600,000 of other taxable income and a $100,000 long-term gain. The 15% band ends at $613,700, so $13,700.00 is taxed at 15% ($2,055.00) and $86,300.00 at 20% ($17,260.00): $19,315.00 of income tax. Estimated MAGI ($700,000) is well over the $250,000 threshold, so the NIIT estimate is 3.8% × $100,000 = $3,800.00. Total: $23,115.00, an effective rate of 23.12%. Load this example
5. Selling at a loss
Single, $60,000 of other income, bought for $10,000 and sold for $2,000 after more than a year: an $8,000 long-term loss and no tax on the sale. Up to $3,000 can be deducted against ordinary income this year, which at the 22% bracket lowers the estimated tax by $660.00. The other $5,000.00 carries forward as a long-term loss. Load this example
6. Why a long-term gain can be taxed at 12%
Single, exactly $49,450 of other taxable income and a $950.00 long-term gain. At capital gain rates the gain would cost 15% × 950.00 = $142.50, so line 23 is $5,828.50. But the regular tax on $50,400 (line 24) is only $5,800.00, because that income is still in the 12% bracket. Line 25 takes the smaller, so the gain adds 12% × 950.00 = $114.00. Load this example
Frequently asked questions
What are the 2026 long-term capital gains tax brackets?
For 2026, long-term gains are taxed at 0% while taxable income (including the gain) is up to $49,450 for single or married filing separately, $98,900 for married filing jointly and $66,200 for head of household. The 15% rate applies above that up to $545,500 (single), $306,850 (married filing separately), $613,700 (married filing jointly) and $579,600 (head of household), and 20% above those amounts. Source: IRS Rev. Proc. 2025-32, section 4.03.
How is capital gains tax calculated on a stock sale?
Subtract your cost basis from the sale proceeds. If you held the shares more than a year, the gain is long-term and is stacked on top of your other taxable income across the 0%, 15% and 20% rates. If you held them a year or less, it is short-term and taxed at your ordinary income tax rates. This calculator does both and shows each step.
Does a capital gain push my other income into a higher bracket?
Not for the federal income tax on that other income: long-term gains are stacked on top, so your wages are taxed the same either way. A short-term gain is added to ordinary income, so it is taxed at the brackets above your other income. A gain can still raise your AGI, which can affect the NIIT, deductions and credits.
What counts as long-term?
Generally, holding an asset for more than one year. Count from the day after you bought it through the day you sold it (IRS Topic 409). Shares bought on March 5, 2025 and sold on March 5, 2026 are short-term; sold on March 6, 2026, they are long-term.
Who pays the 3.8% Net Investment Income Tax?
Individuals with net investment income and modified adjusted gross income over $200,000 (single or head of household), $250,000 (married filing jointly or qualifying surviving spouse) or $125,000 (married filing separately). The tax is 3.8% of the smaller of the investment income or the amount over the threshold. The IRS notes these thresholds are not indexed for inflation (IRS Topic 559). This calculator's NIIT figure is an estimate.
What if I sold at a loss?
There is no tax on a loss. After offsetting any capital gains, up to $3,000 of net capital loss a year ($1,500 if married filing separately) can be deducted from other income, and the rest carries forward (IRS Topic 409). To combine several gains and losses, use the tax-loss offset calculator.
Is this my exact tax bill?
No. It is an educational estimate for one sale under federal rules. State tax, AMT, other gains and losses, qualified dividends, deductions and credits that change with income, and special rules for collectibles, real estate and small business stock are not included. Check with a tax professional or IRS guidance.
Spotted an error?
Accuracy matters more than anything else here. If a number, formula or explanation on this page looks wrong, please email a correction. The email opens with this page's link, including your current inputs, already filled in. What to include in a report.