How to Calculate Capital Gains Tax When You Sell Stock: 2026 Rates, Thresholds, and a Worked Example

United StatesMoney & Banking✓ 2026

A Wall Street street sign in New York — gains on stock you held over a year get the preferential 0%, 15% or 20% rates

Acediscovery Credit: CC BY 4.0 Source: https://commons.wikimedia.org/wiki/File:Wall-Street-Sign-New-York.jpg.

Photo: CC BY 4.0 Source: https://commons.wikimedia.org/wiki/File:Wall-Street-Sign-New-York.jpg (CC BY 4.0)

FeeNo fee to calculate — you pay the tax itself: 0%, 15% or 20% on long-term gains, plus a possible 3.8% net investment income tax
TimeAbout 20 minutes with your sale records
OnlineYes — rules and forms at irs.gov
Quick Answer

When you sell stock for more than you paid, the profit is a capital gain, and the tax rate depends first on how long you held it: hold it more than one year and the gain is long-term, taxed at 0%, 15%, or 20% for 2026 depending on your taxable income; sell within a year and it is short-term, taxed at your ordinary income tax rates. For 2026, the 0% rate covers taxable income up to $49,450 for single filers and $98,900 for married couples filing jointly, and the 20% rate starts above $545,500 (single) or $613,700 (joint). Higher earners may also owe the 3.8% net investment income tax. This guide shows the full calculation — basis, holding period, stacking, and the net investment income tax — on a worked example, so you can estimate your bill before you sell, not after.

Capital Gains Tax at a Glance (Tax Year 2026)

Key figure Amount / rule
Long-term holding period More than 1 year
Long-term rates 0% / 15% / 20%, based on taxable income
0% ceiling — single Taxable income up to $49,450
0% ceiling — married filing jointly Taxable income up to $98,900
0% ceiling — head of household Taxable income up to $66,200
20% rate starts — single Taxable income over $545,500
20% rate starts — married filing jointly Taxable income over $613,700
Net investment income tax +3.8% above $200,000 modified AGI (single) / $250,000 (joint)
Short-term gains Taxed as ordinary income
Capital loss deduction limit $3,000 a year against other income ($1,500 if married filing separately); the rest carries forward
Where to report Form 8949 and Schedule D, filed with Form 1040

Watch out for scams: The IRS never emails, texts, or messages you on social media demanding immediate payment of a "capital gains bill," and it never asks for payment by gift card, wire transfer, or crypto. Read the official rules and get forms only at irs.gov. Anyone who contacts you claiming to be the IRS and threatens arrest or deportation unless you pay now is running a scam — hang up and report it.

Step Zero: Your Gain Is Sale Price Minus Basis

Your basis is usually what you paid for the stock, including commissions. Your gain is:

Amount realized (sale proceeds, minus selling commissions) − adjusted basis = capital gain (or loss)

Your brokerage's Form 1099-B reports the sale and, for most stock bought after 2011, your basis too — but the return you file is your responsibility, so keep your purchase confirmations. Special basis rules apply to inherited stock (generally stepped up to its value at the owner's death) and gifted stock; IRS Publication 551 covers both.

The 2026 Long-Term Rate Thresholds

The rates apply to your taxable income — income after your standard or itemized deduction — and the gain "stacks" on top of your other income. The slice of gain that falls below the 0% ceiling is taxed at 0%, the next slice at 15%, and only the slice above the top threshold at 20%.

Filing status 0% up to 15% up to 20% above
Single $49,450 $545,500 $545,500
Married filing jointly $98,900 $613,700 $613,700
Head of household $66,200 $579,600 $579,600
Married filing separately $49,450 $306,850 $306,850

(Thresholds per IRS Revenue Procedure 2025-32 for tax year 2026.) Two exceptions to keep in mind: gains on collectibles are capped at 28%, and the part of a gain on depreciated real estate called "unrecaptured section 1250 gain" is capped at 25%. Ordinary stock and fund shares use the 0/15/20 table above.

Before You Calculate: Checklist

✓

How to Calculate: Step by Step

  1. Sort every sale into short-term or long-term. Held one year or less: short-term. Held more than one year: long-term. Your 1099-B already groups them this way.
  2. Compute the gain or loss on each sale — proceeds minus basis.
  3. Net within each group, then against each other. Add up short-term results and long-term results separately. A net loss in one group offsets gains in the other.
  4. Find where your long-term gain lands. Take your taxable income without the long-term gain — that is the floor the gain stacks on. Compare the stack against your filing status thresholds in the table above.
  5. Apply 0%, 15%, and 20% to the slices of long-term gain in each band. Short-term gains are simply taxed at your regular bracket rates.
  6. Test the net investment income tax. If your modified AGI exceeds $200,000 (single) or $250,000 (joint), add 3.8% on the smaller of your net investment income or the amount by which your modified AGI exceeds the threshold. These thresholds are fixed in the law and are not inflation-adjusted.
  7. Handle a net loss. If losses exceed gains, deduct up to $3,000 ($1,500 married filing separately) against other income this year and carry the rest forward — it does not expire.
  8. Report on Form 8949 and Schedule D with your Form 1040, using the Qualified Dividends and Capital Gain Tax Worksheet to apply the preferential rates.

A calculator on a US tax return — the preferential rate applies slice by slice, not to the whole gain at once

Images of Money Credit: CC BY 2.0 Source: https://www.flickr.com/photos/59937401@N07/5857164554.

Photo: CC BY 2.0 Source: https://www.flickr.com/photos/59937401@N07/5857164554 (CC BY 2.0)

Worked Example: A $30,000 Long-Term Gain

You are single. Your taxable income from wages and other sources, before the stock sale, is $40,000. You sell stock you bought three years ago for $20,000 and receive $50,000, a long-term gain of $30,000. Your total taxable income is $70,000.

Slice of the gain How it is taxed Tax
$49,450 − $40,000 = $9,450 Falls under the single 0% ceiling of $49,450 → 0% $0
Remaining $30,000 − $9,450 = $20,550 Between $49,450 and $545,500 → 15% $3,082.50
Total federal capital gains tax ≈ $3,083

Your effective rate on the gain is about 10.3% — not 15% — because the first $9,450 rode in under the 0% ceiling. Your modified AGI is far below $200,000, so no net investment income tax applies. Had you sold the same stock after only 10 months, the entire $30,000 would have been taxed at your ordinary rates instead — the one-year line is the single most valuable date in this calculation. (State taxes, if any, are extra; several states tax capital gains as ordinary income.)

The New York Stock Exchange sign on Broad Street — sales are taxed when they happen, not when you withdraw the cash

Billie Grace Ward Credit: CC0 Source: https://commons.wikimedia.org/wiki/File:Sign_of_the_New_York_Stock_Exchange,_Broad_Street.jpg.

Photo: CC0 Source: https://commons.wikimedia.org/wiki/File:Sign_of_the_New_York_Stock_Exchange (CC0)

Common Mistakes

FAQ

What if I held the stock exactly one year?

One year or less is short-term. The gain must be held more than one year to be long-term.

Does the 0% rate mean I can sell tax-free every year?

Up to the ceiling, yes — some investors deliberately realize gains in low-income years (a gap year, early retirement) to use the 0% band, sometimes called gain harvesting. The band is based on taxable income, so a year with little other income leaves the most room.

Are qualified dividends taxed the same way?

Yes — qualified dividends stack with long-term gains and use the same 0/15/20 thresholds and worksheet.

Do I owe capital gains tax if I don't withdraw the money from my brokerage?

Yes. The tax follows the sale, not the withdrawal. Inside a traditional or Roth IRA, by contrast, sales are not taxed as they happen — different rules apply on withdrawal.

What about cryptocurrency?

The IRS treats virtual currency as property, so the same short-term/long-term capital gains framework applies to sales and exchanges. See the IRS virtual currency guidance on irs.gov.

Sources

Verified: December 4, 2026

Related guides