Skip to content
Menu

Capital gains tax calculator

The US federal tax on selling shares at a profit or a loss: the rate each part of the gain is taxed at, the 3.8% surtax if it applies, state tax, and what is left.

Inputs

Wages, interest and other ordinary income, before deductions.

$16,100 for 2026.

Purchase price plus fees, for the shares sold.

Leave at 0 for a state with no income tax.

Tax on the sale
$4,500

on a $30,000 gain

Effective rate on the gain
15.0%
You keep
$45,500

of $50,000 proceeds

How the gain is taxed

Part of the gainAmountRateTax
Long-term at 15%$30,00015%$4,500
Total$30,00015.0%$4,500

What changes the answer

  • Taxable income before the sale is $73,900 ($90,000 less a $16,100 deduction). The gain is taxed on top of it.
  • The same sale as a short-term gain would be taxed $6,600: $2,100 more.
  • The 0% band for long-term gains ends at $49,450 of taxable income in 2026; this income is past it.
  • Income with the gain stays at or below $200,000, so the 3.8% net investment income tax does not apply.

How capital gains are taxed

A gain is the sale proceeds minus the cost basis. If the shares were held for more than one year the gain is long-term and has its own rates: 0%, 15% and 20%. If they were held for one year or less it is short-term and is taxed like wages, at 10% to 37%. The holding period starts the day after the purchase.

Long-term gains sit on top of your other taxable income. In 2026 the 0% rate reaches $49,450 of taxable income for this filing status and the 15% rate reaches $545,500. Only the part of the gain above each edge pays the higher rate, which is why one sale can be taxed at two rates. Taxable income is income after the deduction: $16,100 here if you take the standard deduction.

The 3.8% net investment income tax

A separate 3.8% tax applies to investment income when modified adjusted gross income is above $200,000 for this filing status. It is charged on the smaller of the investment income and the amount over the threshold. These thresholds are fixed in law and do not rise with inflation. The NIIT calculator works through it for all of your investment income.

What this calculator assumes

It covers US federal income tax for one sale of stock, fund shares or crypto, using the figures in IRS Revenue Procedure 2025-32. It treats your other income as ordinary income and none of it as investment income, takes modified AGI as that income plus the gain, and applies the state rate you enter to the whole gain. It leaves out the 25% and 28% rates on real estate depreciation and collectibles, the alternative minimum tax, credits, and income-based effects such as taxes on Social Security benefits or Medicare premiums.

Learn more

Capital gains tax explains the rules, Tax brackets for investors shows how gains stack on other income, Holding period rules covers the one-year line, and Capital loss carryover covers losses.

More calculators

For illustration, not investment advice. A calculator shows what follows from the numbers you enter; it does not predict returns or recommend any security. Taxes, fees and real returns will differ.