Skip to main content

CalcDune

How to Calculate Capital Gains Tax (2026 Rates + Examples)

Oct 28, 2026 · CalcDune

Selling an investment for more than you paid feels like a win — until tax season arrives and part of that profit turns out to belong to the IRS. The good news: capital gains tax is one of the more predictable taxes out there. Once you know your cost basis, holding period, and income bracket, the math is straightforward. This guide walks through it with real numbers.

Direct answer: To calculate capital gains tax, subtract your cost basis — purchase price plus improvements and selling costs — from the sale price to find your gain. Then apply the rate for how long you held the asset: over a year gets the 2026 long-term rates of 0%, 15%, or 20%; a year or less is taxed as ordinary income.

Key Takeaways

  • Capital gain = sale price − cost basis. Your basis is usually what you paid, plus improvements and selling costs.
  • Holding period decides the rate. More than one year means long-term rates (0%, 15%, or 20% in 2026); one year or less means ordinary income rates.
  • Your total taxable income sets the long-term bracket — the gain stacks on top of your other income.
  • Losses offset gains. Up to $3,000 of leftover net loss can reduce your other income each year.
  • High earners may owe an extra 3.8% Net Investment Income Tax on top of the rate.
  • State tax is separate. Your state may tax the same gain again, often at its ordinary income rate.

What Is a Capital Gain, Exactly?

A capital gain is the profit you make when you sell a capital asset — stocks, bonds, real estate, a business, collectibles — for more than it cost you. The Internal Revenue Service (IRS) only taxes the profit, not the whole sale price. Sell shares for $16,000 that cost $10,000, and the taxable event is the $6,000 difference.

Two details matter. First, the tax generally applies when you realise the gain by selling; shares that have doubled but are unsold are an unrealised gain, not taxed yet. Second, the number you subtract from the sale price is your cost basis. For shares, that is usually what you paid plus commissions; for property, the purchase price plus improvements — a new roof, an extension, a renovated kitchen — but not routine repairs. Keep records of both.

How Long Did You Hold It? Short-Term vs Long-Term

The most important question is how long you owned the asset. The line is drawn at one year:

  • Short-term capital gain: held for one year or less, taxed at your ordinary income rate — 10% to 37% in 2026, depending on income.
  • Long-term capital gain: held for more than one year, taxed at 0%, 15%, or 20%, depending on taxable income and filing status.

The difference is large enough to change behaviour. Someone in the 22% bracket who sells after eleven months pays 22% on the gain; wait one more month and the same gain may be taxed at 15% — or even 0%. The exact dates matter: buy on 15 March 2025 and sell on 15 March 2026, and you have held the asset exactly one year, which counts as short-term. Sell on 16 March 2026, and it is long-term. Check the dates before you place the sell order.

What Are the 2026 Long-Term Capital Gains Tax Rates?

For the 2026 tax year (returns normally filed in early 2027), the IRS thresholds, published in Revenue Procedure 2025-32, are as follows. They apply to your total taxable income — wages, business income, and the gain itself, added together — not just to the gain.

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

Picture it as stacking: ordinary income fills the bottom of the pile, the gain sits on top, and only the slice above a threshold is taxed at the higher rate.

One more federal layer: the Net Investment Income Tax (NIIT). If your modified adjusted gross income exceeds $200,000 as a single filer or $250,000 filing jointly, an extra 3.8% can apply to investment income, including capital gains. These thresholds are fixed in law, not inflation-adjusted. Two special rates sit outside the table: collectibles gains at up to 28%, and the depreciation-related slice of a real estate gain — unrecaptured section 1250 gain — at up to 25%.

How Do You Calculate Capital Gains Tax in 4 Steps?

Whatever you sold, the calculation follows four steps:

Step 1: Find your cost basis

Add up what you paid, plus improvements that added value, plus buying costs. For shares, that is the purchase price plus commissions. For property, it is the purchase price plus improvements such as an extension or a new roof — not routine maintenance.

Step 2: Work out the amount realised

This is what you actually walk away with: the sale price minus selling costs, such as brokerage commissions, agent fees, and closing costs. Forgetting these is one of the most common ways people overstate their gain.

Step 3: Subtract to get your gain (or loss)

Capital gain = amount realised − cost basis. A positive result is a gain; a negative one is a capital loss, which is useful in its own right — see the netting section below.

Step 4: Apply the rate for your holding period and income

Short-term gain? Add it to your ordinary income and tax it at your marginal rate. Long-term gain? Stack it on top of your other taxable income and apply the 0%, 15%, or 20% rates from the 2026 table above, splitting the gain across brackets if it straddles a threshold. Then check whether the 3.8% NIIT applies, and remember state tax is separate.

Worked Example: Selling Stock

Sarah, a single filer, bought 100 shares for $10,000 in 2024 and sells them in 2026 for $16,000, paying a $50 brokerage commission. She has held them for more than a year, so this is a long-term gain. Her other taxable income for 2026 is $60,000.

  • Cost basis: $10,000
  • Amount realised: $16,000 − $50 commission = $15,950
  • Capital gain: $15,950 − $10,000 = $5,950
  • Stacking: $60,000 of other taxable income + $5,950 gain = $65,950 total taxable income

The 0% rate covers taxable income up to $49,450 for a single filer, but Sarah’s other income already fills that space, so the whole gain sits above it. The 15% rate runs to $545,500, and her total of $65,950 is well inside it, so the entire gain is taxed at 15%:

Federal capital gains tax = $5,950 × 15% = $892.50.

Had Sarah sold after only ten months, the gain would be short-term, taxed at her 22% marginal rate: $5,950 × 22% = $1,309. Holding a few months longer would have saved her about $416 on this one sale.

Worked Example: Selling a Property

Property works the same way, but basis has more moving parts. Take David and Maria, a married couple filing jointly, selling a rental property in 2026:

  • Purchase price: $200,000
  • Improvements over the years (new roof, kitchen remodel, extension): $30,000
  • Cost basis: $200,000 + $30,000 = $230,000
  • Sale price: $300,000
  • Selling costs (agent commission, closing costs): $12,000
  • Amount realised: $300,000 − $12,000 = $288,000
  • Capital gain: $288,000 − $230,000 = $58,000

They held the property for more than a year, so the gain is long-term. With other taxable income of $120,000, their total is $178,000 — inside the 15% band for joint filers (up to $613,700), so the tax is $58,000 × 15% = $8,700.

Two property notes. Had this been their primary home, and had they lived in it for at least two of the previous five years, the IRS primary-residence exclusion could have shielded up to $250,000 of gain for a single filer or $500,000 for a joint couple — wiping out this entire gain. Confirm eligibility first, as the rules are detailed. And for a rental, the depreciation-created slice of the gain — unrecaptured section 1250 gain — can be taxed at up to 25% rather than 15%.

How Do Capital Losses Work? Netting Your Gains and Losses

Not every sale makes money, and the tax code lets losses do useful work. Netting runs in a fixed order:

  1. Net your short-term gains against your short-term losses.
  2. Net your long-term gains against your long-term losses.
  3. If one category still has a net loss and the other a net gain, offset them against each other.

If you end up with an overall net loss, you can use up to $3,000 of it per year ($1,500 if married filing separately) to reduce your other income, such as wages. Any remaining loss carries forward to future tax years until it is used up — so a $9,000 net loss in 2026 could shelter $3,000 of income in each of 2026, 2027, and 2028.

One trap: the wash-sale rule. Sell at a loss and buy substantially identical shares within 30 days before or after, and the IRS disallows the loss for now (it is added to the new shares’ basis instead).

Do You Owe State Capital Gains Tax Too?

Yes, quite possibly — the part people most often forget. Most states tax capital gains too, usually at ordinary income rates, and the rates vary widely: California taxes gains at ordinary rates up to 13.3%, while states with no income tax, such as Florida, Texas, and Wyoming, levy none. A realistic estimate needs both the federal calculation and your state’s rules.

Common Mistakes That Cost People Money

  • Selling one day too early. Crossing to long-term can cut the rate from 22% or more to 15% — check the purchase date first.
  • Forgetting selling costs and improvements. Every dollar added to basis is a dollar less gain. Dig out the receipts.
  • Ignoring the stacking effect. A big gain can push you into the 20% band or trigger the 3.8% NIIT, even if your salary alone would not.
  • Assuming the 0% rate means no tax at all. It only covers income below the threshold, and state tax may still apply.
  • Missing the wash-sale window. Repurchasing the same shares within 30 days of a loss sale wipes out the deduction.

The Bottom Line

Capital gains tax comes down to four numbers: what you paid, what you sold for, how long you held it, and your total taxable income. Get the basis right, respect the one-year line, stack the gain on top of your other income, and apply the 2026 rates. Run the estimate before you sell. To see how a gain fits into your overall tax picture, try the income tax calculator, and for the wider money habits behind investing, read the personal finance beginner’s guide.

Disclaimer: This article is for general information only and is not tax advice. Figures reflect widely published 2026 IRS thresholds (Revenue Procedure 2025-32). For a significant sale, talk to a qualified tax professional before you sell.

Frequently Asked Questions

How do I calculate capital gains tax on stocks?

Subtract your cost basis (purchase price plus commissions) from the sale price minus selling costs to get your gain. Held for more than a year, it gets the 2026 long-term rates of 0%, 15%, or 20% based on your total taxable income; held for a year or less, it is taxed at your ordinary income rate.

What is the difference between short-term and long-term capital gains tax?

Short-term gains come from assets held for one year or less and are taxed at ordinary income rates (10% to 37% in 2026). Long-term gains come from assets held for more than one year and are taxed at 0%, 15%, or 20%. Holding past the one-year mark is often the single biggest lever on the tax bill.

What are the 2026 long-term capital gains tax brackets?

For 2026, the 0% rate applies to taxable income up to $49,450 for single filers, $98,900 for married couples filing jointly, and $66,200 for heads of household. The 15% rate applies up to $545,500 (single), $613,700 (joint), and $579,600 (head of household), with income above those figures taxed at 20%. These are the IRS figures published in Revenue Procedure 2025-32.

Can capital losses reduce my tax bill?

Yes. Capital losses first offset capital gains of the same type, then the other type. If you still have a net loss, you can deduct up to $3,000 per year ($1,500 if married filing separately) against your other income, and any remaining loss carries forward to future years until it is used up. Watch out for the wash-sale rule if you repurchase the same asset within 30 days.

Do I pay capital gains tax on my primary home?

Possibly, but many homeowners owe nothing. If you owned and lived in the home for at least two of the previous five years, the IRS primary-residence exclusion can shield up to $250,000 of gain for a single filer or $500,000 for a couple filing jointly. Gains above the exclusion are taxed at the usual long-term rates. The eligibility rules are detailed, so confirm them before relying on the exclusion.

What is the 3.8% Net Investment Income Tax?

The Net Investment Income Tax is an additional 3.8% federal tax that can apply to investment income, including capital gains, when modified adjusted gross income exceeds $200,000 for single filers or $250,000 for married couples filing jointly. Unlike the capital gains brackets, these thresholds are not adjusted for inflation. It sits on top of the regular capital gains rate, so a high earner in the 20% bracket could face a combined 23.8% federal rate on a gain.