What this calculator does
Estimate how much federal tax you'll owe when you sell a stock, fund or other investment for a profit. That profit is called a capital gain, and it's taxed in the year you sell. How much you pay depends mostly on how long you owned the asset.
Gains on assets held more than a year are long-term, and they're taxed at 0%, 15% or 20%. Gains on assets held a year or less are short-term. They're taxed at your ordinary income tax rates, the same as wages, which go as high as 37%.
The calculator estimates the federal tax on one sale for tax year 2026. It works out the gain, then stacks it on top of your other taxable income to see which rate bands it lands in. If your income is high enough, it adds the 3.8% net investment income tax. You can also add a flat state rate. The result is an estimate, not tax advice.
Where it's used
Why this math matters outside the classroom:
- Selling shares. A $5,000 long-term gain taxed entirely at a 15% rate adds $750 to the year's tax.
- Holding period. Investors see how the same gain is taxed differently when an asset is held for more than a year rather than less.
- Stacked brackets. A gain that sits partly in one rate band and partly in the next is taxed at each rate on its own portion.
- Estimating set-asides. People who sell an asset during the year estimate the tax on the gain so the amount is not a surprise at filing time.
Grade level and standards: Grades 7–8; Common Core State Standards for Mathematics 7.RP.A.3. © Copyright 2010. National Governors Association Center for Best Practices and Council of Chief State School Officers. All rights reserved.
How to use it
- Enter what you paid for the asset (your cost basis), what you sold it for and any selling costs.
- Choose whether you owned it for more than a year, or for a year or less.
- Choose your 2026 filing status. Enter your other income for the year, before deductions.
- If you like, add a state rate. Then read the estimated tax, the effective rate on the gain and the table showing each rate band.
What the inputs mean
- Purchase price (cost basis)
- Usually the purchase price plus any purchase fees. For funds, reinvested dividends add to your basis. For property, improvements add to it. Your broker's 1099-B form normally reports it.
- Selling costs (optional)
- Commissions, fees and similar costs of the sale.
- How long did you own it?
- Long-term means you owned it for more than one year. Count from the day after you bought it to the day you sold it. One year or less is short-term.
- Other income for the year
- Your wages and other regular income for the year, before the standard deduction. The calculator takes off the 2026 standard deduction for your filing status. Then it places the gain on top of what's left.
- State tax rate on the gain (optional)
- Most states tax capital gains like regular income. A few have no income tax, and some give gains special treatment. A flat rate on the whole gain is only a rough estimate.
Formula and method
gain = sale price − selling costs − cost basis ordinary taxable income = other income − 2026 standard deduction long-term: gain fills the 0% band up to the 0% limit, then 15%, then 20% short-term: tax(ordinary + gain) − tax(ordinary) at the 2026 brackets NIIT = 3.8% × min(gain, MAGI − threshold) total tax = federal tax + NIIT + state rate × gain
In the formulas, the cost basis is what you paid, and the standard deduction is the amount of income the IRS lets you leave untaxed. NIIT is the net investment income tax. MAGI (modified adjusted gross income) is a version of your total income the IRS uses to decide if NIIT applies. The threshold is the income line where it starts.
Long-term rates depend on your total taxable income, with the gain counted last. For 2026, the 0% rate applies up to $49,450 of taxable income for single filers and married people filing separately. The limit is $66,200 for heads of household and $98,900 for joint filers.
The 15% rate applies up to $545,500 (single), $579,600 (head of household), $613,700 (joint) and $306,850 (separate). Above that, the rate is 20%.
The net investment income tax adds 3.8% when MAGI passes $200,000 (single or head of household), $250,000 (joint) or $125,000 (separate). It applies to your investment income or the amount over the line, whichever is smaller. Here, MAGI is estimated as your other income plus the gain.
Worked example
A single filer with $60,000 of other income in 2026 sells shares held for three years for $25,000. They paid $10,000 for them.
- Gain: $25,000 − $10,000 = $15,000.
- Other taxable income: $60,000 − $16,100 standard deduction = $43,900.
- Room left in the 0% band: $49,450 − $43,900 = $5,550, so that much of the gain is taxed at 0%.
- The other $9,450 is taxed at 15%: $9,450 × 15% = $1,417.50.
- Income stays below $200,000, so there's no NIIT.
Result: The estimated federal tax on the sale is $1,417.50, an effective 9.45% of the gain. Held for a year or less, the same gain would cost $2,650.
Understanding the result
Compare the long-term and short-term results to see what waiting costs or saves. Holding past the one-year mark can cut the tax a lot. In the example, the same $15,000 gain costs $2,650 short-term but $1,417.50 long-term.
The effective rate on the gain is usually below the top rate you reach, because part of the gain often falls in a lower band. In years when your other income is low, such as early retirement or a career break, more of a gain can fall in the 0% band.
Assumptions and limitations
- It uses the tax year 2026 long-term rate limits, regular brackets and standard deduction from IRS Rev. Proc. 2025-32. NIIT thresholds are the ones published by the IRS.
- It assumes one sale, no other capital gains or losses for the year, the standard deduction, and no qualified dividends.
- Other income is treated as regular income, and MAGI is estimated as other income plus the gain.
- This is an estimate, not tax advice. Your actual tax depends on your whole return.
- Some rules aren't included: special rates for collectibles (up to 28%) and for unrecaptured depreciation on real estate (up to 25%). The home-sale exclusion isn't included either.
- It also leaves out netting against other gains and losses, wash sales, rules for inherited assets and the alternative minimum tax.
- State tax is a single flat rate applied to the whole gain.
Frequently asked questions
What are the 2026 long-term capital gains tax rates?
0%, 15% and 20%. For single filers in 2026, the 0% rate covers taxable income up to $49,450. The 15% rate covers it up to $545,500, with 20% above that. For married couples filing jointly, the limits are $98,900 and $613,700.
How are short-term capital gains taxed?
Like regular income, at the same 10% to 37% bracket rates as wages. That's why the calculator works out your tax with and without the gain, and takes the difference.
Can I pay 0% tax on capital gains?
Yes, on the part of a long-term gain that fits under the 0% limit once your other taxable income is counted. Say you're a single filer whose taxable income, including the gain, stays at or below $49,450 in 2026. Then you owe no federal tax on the long-term gain.
What happens if I sell at a loss?
A capital loss owes no tax. It first cancels out capital gains. Then it can offset up to $3,000 of regular income a year ($1,500 if married filing separately). Anything left carries forward to future years.
What is the net investment income tax?
It's an extra 3.8% federal tax on investment income, including capital gains. It applies when your modified adjusted gross income is above $200,000 (single or head of household), $250,000 (married filing jointly) or $125,000 (married filing separately). These lines aren't adjusted for inflation.
How this calculator is checked
Method: Stacking method for long-term gains (gain fills the 0%/15%/20% bands above ordinary taxable income) with 2026 thresholds from IRS Rev. Proc. 2025-32 section 4.03; short-term gains via 2026 bracket tax difference; NIIT per the IRS NIIT page (figures in src/lib/finance/tax-2026.ts). The calculation is covered by automated tests with known reference values and edge cases. Last updated 2026-10-18. Found a problem? Tell us.
Embed this calculator
Put this Capital Gains Tax Calculator on your own website or blog for free. Paste this code where you want it to appear: