How the Capital Gains Tax calculator works
Capital gain
Gain = Sale price − selling costs − cost basis
Tax on the gain
Tax = federal income tax with the gain − federal income tax without it + net investment income tax + state tax
- Long-term (held more than a year)
- 0%, 15% or 20%, depending on taxable income
- Short-term (a year or less)
- taxed at your ordinary income tax rates
Net investment income tax
NIIT = 3.8% × the smaller of investment income and modified AGI above $200,000 ($250,000 joint)
Worked example
You sell shares for $25,000 that you bought for $10,000 more than a year ago: a $15,000 long-term gain. With $80,000 of other income as a single filer, your taxable income is already above the 0% limit, so the whole gain is taxed at 15%.
The tax on the gain is $2,250, 15% of it, leaving $12,750 after tax. Had you sold within a year, the gain would be short-term and taxed at your 22% bracket, about $3,300.
How is capital gains tax calculated?
Subtract your cost basis, what you paid plus buying and selling costs, from the sale price to get the gain. If you held the asset more than one year, the gain is long-term and taxed at 0%, 15% or 20% depending on your taxable income; held one year or less, it is short-term and taxed as ordinary income at 10% to 37%. Higher earners can also owe the 3.8% net investment income tax, and many states tax gains as regular income.
- Gain = sale price − (purchase price + costs to buy and sell)
- Holding period: more than one year is long-term; one year or less is short-term.
- Rate: long-term gains stack on top of your other taxable income, so the 0%, 15% and 20% thresholds below are measured on your total taxable income, not on the gain alone.
- Extra taxes: the 3.8% net investment income tax above $200,000 of modified AGI ($250,000 joint), plus any state tax.
The worked example above runs each step with real numbers.
Long-term vs short-term
How long you hold an investment is the biggest factor you control. A sale one day after the one-year mark can cut the federal rate on the gain from your income tax bracket to 15%, or even to 0% for people with lower taxable income. The chart compares the two for your sale.
Capital gains tax rates for 2026 and 2027
| Filing status | 0% rate up to | 20% rate above |
|---|---|---|
| Single | $49,450 | $545,500 |
| Married filing jointly | $98,900 | $613,700 |
| Married filing separately | $49,450 | $306,850 |
| Head of household | $66,200 | $579,600 |
| Filing status | 0% rate up to | 20% rate above |
|---|---|---|
| Single | $51,050 | $563,200 |
| Married filing jointly | $102,100 | $633,600 |
| Married filing separately | $51,050 | $316,800 |
| Head of household | $68,350 | $598,400 |
Taxable income between the two limits pays 15%. The limits count your whole taxable income with the gain stacked on top. A 3.8% net investment income tax applies above $200,000 of modified AGI ($250,000 joint). Source: IRS.
Who pays 0%?
Long-term gains are stacked on top of your other taxable income. The part of the gain that fits under the 0% limit, $49,450 of taxable income for single filers and $98,900 for married couples filing jointly in 2026, is tax-free federally. Retirees and people between jobs often have room to realize gains at 0%.
Selling your home
If you are selling your main home, turn on This is the sale of my main home under More options. You can exclude up to $250,000 of the gain from income, or up to $500,000 if you file a joint return, as long as you owned the home and lived in it for at least 2 of the 5 years before the sale and didn’t exclude gain on another home in the previous 2 years. Only the gain above the exclusion is taxed, at long-term rates. Count the cost of improvements in what you paid, and agent commissions and other selling costs in the costs field; both shrink the gain.
Losses
If the sale is a loss, the calculator shows the tax saved by deducting up to $3,000 of it from other income this year, and the amount you can carry forward to future years.
Related calculators
To work out the gain itself, with commissions and dividends, use the stock profit calculator. For your average cost after several purchases, use the stock average calculator, and for your whole tax return, the income tax calculator.
Assumptions and limits
- One sale in the year; other gains and losses are not netted. Losses offset gains first, then up to $3,000 of other income a year.
- Your other income is treated as wages taxed at ordinary rates, with the standard deduction.
- Collectibles, the taxable part of gains on real estate depreciation and qualified small business stock follow special rules not modeled here.
- The main home option assumes you meet the 2-out-of-5-year ownership and use tests and haven't excluded gain on another home in the past 2 years. Partial exclusions and depreciation recapture are not modeled; see IRS Publication 523.
Frequently asked questions
How much is capital gains tax on stocks?
For shares held more than a year, the federal rate is 0%, 15% or 20% depending on your taxable income; most people pay 15%. For shares held a year or less, the gain is taxed like wages, at 10% to 37%. High earners may also owe the 3.8% net investment income tax.
What are the 2026 long-term capital gains brackets?
For single filers, 0% on taxable income up to $49,450, 15% up to $545,500 and 20% above. For married couples filing jointly, 0% up to $98,900, 15% up to $613,700 and 20% above.
How can I pay less capital gains tax?
Hold investments more than a year, sell losing investments to offset gains, time sales for lower-income years when the 0% rate may apply, and use tax-advantaged accounts such as IRAs and 401(k)s, where trades aren't taxed.
Do I pay capital gains tax on crypto?
Yes. The IRS treats cryptocurrency as property, so selling, trading or spending it at a gain is taxed like a stock sale, short- or long-term depending on how long you held it.
Do I pay capital gains tax when I sell my house?
Usually not on the first $250,000 of gain, or $500,000 for married couples filing jointly, if you owned the home and lived in it as your main home for at least 2 of the 5 years before the sale. Only gain above that is taxed, at long-term rates. Turn on the main home option to see the tax.
Is the capital gains tax calculated on the whole sale price?
No, only on the gain: the sale price minus your cost basis and selling costs. Your basis is generally what you paid, including commissions.
Sources and method
- Topic no. 409, Capital gains and losses · Internal Revenue Service
- Topic no. 701, Sale of your home · Internal Revenue Service
- Topic no. 559, Net investment income tax · Internal Revenue Service
- IRS releases tax inflation adjustments for tax year 2026, including amendments from the One, Big, Beautiful Bill · Internal Revenue Service
Formulas and figures checked against these sources on November 12, 2026. The calculator runs entirely in your browser; nothing you type is sent to us or stored. Results are estimates for education, not financial, tax or legal advice, and MonyPulse is not a lender, tax preparer or investment adviser. Found an error? Tell us. See how we build and test our calculators and our editorial standards.