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

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)
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
- 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.
- Compute the gain or loss on each sale — proceeds minus basis.
- 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.
- 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.
- 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.
- 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.
- 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.
- 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.

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.)

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
- Selling a few days too early. "More than one year" means exactly that — selling on the one-year anniversary makes the gain short-term. Count from the day after purchase to the sale date.
- Triggering a wash sale. If you sell at a loss and buy substantially identical stock within 30 days before or after the sale, the loss is disallowed for now and added to the basis of the new shares.
- Assuming the whole gain gets one rate. The bands apply slice by slice, as the example shows; a gain that crosses the 0% ceiling is not taxed at 15% on every dollar.
- Forgetting reinvested dividends. Dividends you reinvested bought more shares and raised your basis. Leaving them out means paying tax twice on the same money.
- Ignoring the 3.8% surtax in a big year. A one-time large gain — a business sale, a house-sized stock position — can push modified AGI over the NIIT threshold even if your salary never does.
- Not harvesting losses. Realized losses offset gains dollar for dollar before the $3,000 limit matters; unused losses carry forward indefinitely.
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
- Internal Revenue Service, "Topic No. 409, Capital Gains and Losses" — holding periods, rates framework, and the $3,000 loss limit: https://www.irs.gov/taxtopics/tc409
- Internal Revenue Service, Revenue Procedure 2025-32 — tax year 2026 inflation adjustments, including the 0% and 15% capital gain thresholds
- Internal Revenue Service, "Net Investment Income Tax" questions and answers — the 3.8% tax and its $200,000 / $250,000 thresholds: https://www.irs.gov
Verified: December 4, 2026
Related guides
How to Check If a Debt Collector Is Legitimate: The Validation Notice Test (CFPB Rules)A real debt collector can prove it, and federal law forces them to: under the Fair Debt Collection…
How to Calculate Your Take-Home Pay: Federal Tax, FICA and State Tax ExplainedYour take-home pay is your gross pay minus everything withheld from it, and for most employees…
How to Calculate Overtime Pay: The 1.5x Rule, Worked Examples and Who QualifiesUnder the federal Fair Labor Standards Act (FLSA), a covered, non-exempt employee must be paid at…
How to Calculate Sales Tax: Rates, Worked Examples and States With No Sales TaxSales tax in the United States is calculated with one formula — tax = price × combined rate, and…
Howvida