← Back to calculator
Long-Term Gains

How to Calculate Long-Term Capital Gains Tax (2026)

If you sold stock, real estate, or another investment this year, understanding long-term capital gains tax is essential before you file. The difference between short-term and long-term treatment can mean paying 15% instead of 32% on the same profit — a difference of thousands of dollars on a $100,000 gain. This guide walks through every step of the calculation with IRS-accurate 2026 brackets and three complete worked examples.

What counts as a long-term capital gain?

A capital gain is long-term when you sell an asset you have held for more than one year. This applies to stocks, mutual funds, ETFs, real estate, crypto, collectibles, and most other investment assets. The IRS measures the holding period from the day after you acquired the asset to the day you sold it.

For example, if you buy shares on March 15, 2024, the one-year mark is March 16, 2025. Selling on March 15, 2025 would be short-term; selling on March 16, 2025 or later is long-term. A single day's difference can change your entire tax rate.

Long-term treatment matters because Congress deliberately set preferential rates for patient investors. Qualifying means you could pay as little as 0% instead of up to 37% for the same dollar of gain at ordinary income rates.

Assets that always use special rates

Not everything gets the standard 0/15/20% rates even after holding for over a year. Watch for these exceptions:

2026 long-term capital gains rate brackets (all filing statuses)

Long-term gains are taxed at one of three rates based on your taxable income (line 15 of Form 1040 — after all deductions). For 2026 (IRS Rev. Proc. 2025-32):

RateSingleMarried Filing JointlyHead of HouseholdMarried Filing Separately
0%Up to $49,450Up to $98,900Up to $66,200Up to $49,450
15%$49,451 – $545,500$98,901 – $613,700$66,201 – $579,600$49,451 – $306,850
20%Over $545,500Over $613,700Over $579,600Over $306,850

Most taxpayers with significant gains — including those with six-figure incomes — fall into the 15% bracket. The 0% rate is available to lower-income earners and retirees living off investments. The 20% rate applies only to very high earners.

Important: These thresholds apply to your total taxable income, not just the gain. Your ordinary income is measured first, then your long-term gains are stacked on top to determine which bracket they fall into.

Step-by-step calculation formula

  1. Calculate your gross capital gain: Sale price − Adjusted cost basis
    Adjusted basis = purchase price + commissions + improvements − any return of capital
  2. Subtract any capital losses: Net gains against losses from other sales in the same year. Excess losses (up to $3,000) can offset ordinary income.
  3. Find your taxable income: Gross income − standard deduction (or itemized) = taxable income. For 2026: $15,000 single / $30,000 MFJ standard deduction.
  4. Stack your gain on top of ordinary income: Add your net long-term gain to your ordinary taxable income. This total determines which bracket your gain falls in.
  5. Apply the bracket rates: If your gain spans a bracket boundary, split it. Each portion pays its own rate.
  6. Check for NIIT: If your MAGI exceeds $200,000 (single) or $250,000 (MFJ), add 3.8% on the smaller of (net investment income) or (excess MAGI over threshold).

Worked examples

Example 1: Gain entirely in the 0% bracket

Maria is retired, filing single, with $38,000 in Social Security and pension income (taxable amount: $24,000 after deductions). She sells $30,000 of appreciated index fund shares held for 3 years.

Key takeaway: If Maria could reduce her income by $4,550 more (e.g., through additional deductions), she would owe $0 in federal capital gains tax. This is why 0%-bracket planning is a powerful strategy for early retirees.

Example 2: Standard 15% scenario

James is single with $80,000 in ordinary taxable income (wages minus standard deduction). He sells stock for a $55,000 long-term gain.

Example 3: High earner with NIIT and bracket boundary

Susan and her husband file jointly. Their ordinary taxable income is $580,000. They sell rental property with a $300,000 long-term gain (simplified — ignoring Section 1250 recapture for this example).

The 3.8% Net Investment Income Tax (NIIT) explained

The NIIT is an additional Medicare surtax enacted by the Affordable Care Act (IRC §1411). It applies to the lesser of:

Filing StatusMAGI Threshold for NIIT
Single / Head of Household$200,000
Married Filing Jointly$250,000
Married Filing Separately$125,000

Unlike most tax thresholds, the NIIT thresholds are not inflation-adjusted — they have been $200,000/$250,000 since 2013. This means more taxpayers get caught each year through bracket creep.

The NIIT is calculated on IRS Form 8960 and added to your regular income tax. It cannot be reduced by deductions from Schedule A. However, investment expenses that are properly allocated against investment income can reduce your net investment income.

Combined top rate: For gains in the 20% bracket with NIIT, the effective federal rate is 20% + 3.8% = 23.8%. Add state taxes and the all-in rate can exceed 30% in high-tax states like California (13.3% state rate).

Understanding cost basis — the number that determines your gain

Your taxable gain depends entirely on getting your cost basis right. Using too low a basis means overpaying tax; claiming too high a basis is inaccurate and can trigger penalties.

What counts as basis

Basis in inherited assets

Property received through inheritance gets a stepped-up basis equal to the fair market value on the date of the decedent's death (or the alternate valuation date, if elected by the estate). This means decades of accumulated gains are permanently wiped out. If you inherit stock that appreciated from $5,000 to $200,000 and sell it immediately, you owe zero capital gains tax.

Basis in gifted assets

Property received as a gift carries over the donor's basis — you cannot reset it. If the donor's basis was $10,000 and the gift was worth $80,000 at the time of the gift, your basis is still $10,000. However, if you sell at a loss, your basis becomes the lower of the donor's basis or fair market value at the time of the gift.

How to report long-term gains on your tax return

Your broker sends a Form 1099-B each January listing every sale from the prior year, including the cost basis and whether it's short-term or long-term. You then report these on:

Most tax software (TurboTax, H&R Block, FreeTaxUSA) can import Form 1099-B directly from major brokerages, eliminating manual data entry. If your broker did not report basis to the IRS (sometimes the case for older positions), you will need to research and enter it yourself using historical purchase records.

Capital gains are reported in the year they are realized — the year you sold, regardless of when you receive the proceeds. A December 31 sale is taxable in that tax year even if the funds don't settle into your account until January.

State capital gains taxes

Federal rates are just part of the picture. Most states add their own tax on capital gains, and unlike the federal system, most states do not offer a preferential long-term rate — they simply tax gains as ordinary income at their regular income tax rate.

State CategoryExamplesEffective Rate on Gains
No state income taxFlorida, Texas, Nevada, Alaska, Wyoming, South Dakota, Tennessee0%
Low flat rateArizona (2.5%), Indiana (2.95%), Pennsylvania (3.07%)2.5% – 3.1%
Moderate rateColorado (4.4%), Georgia (5.19%), Illinois (4.95%)4% – 5.5%
High rateNew York (10.9%), New Jersey (10.75%), Oregon (9.9%)9% – 11%
Highest rateCalifornia (13.3%), Hawaii (11%)11% – 13.3%

California is the most notable: it taxes capital gains as ordinary income with no preferential rate, and at the top 13.3% bracket, a high-income Californian can pay a combined federal + state rate of over 37% on long-term gains (23.8% federal + 13.3% state). This is nearly the same as the top federal ordinary income rate.

See our individual state guides for exact brackets: California, New York, Texas, Florida.

Strategies to reduce long-term capital gains tax

1. Tax-loss harvesting

Sell investments that have declined in value to realize a capital loss. Losses directly offset gains dollar-for-dollar. If losses exceed gains, up to $3,000 of excess can offset ordinary income, with any remainder carrying forward indefinitely to future years. Be careful of the wash-sale rule: you cannot repurchase the same security within 30 days before or after the sale.

2. 0% bracket planning

If your taxable income is below $49,450 (single) or $98,900 (MFJ), you can realize long-term gains completely tax-free at the federal level. This is particularly valuable for early retirees, people in low-income years between jobs, or those who can control their income through deductions. You can sell appreciated positions, reset your cost basis, and reinvest immediately with a higher basis — permanently reducing future gain.

3. Qualified Opportunity Zone (QOZ) investments

By reinvesting gains into a Qualified Opportunity Fund within 180 days of a sale, you can defer tax on the original gain until December 31, 2026 at the latest. More significantly, if you hold the QOZ investment for at least 10 years, any appreciation in the fund itself becomes permanently tax-free. This is one of the most powerful but complex strategies available.

4. Donating appreciated stock to charity

Instead of selling appreciated stock and donating cash, donate the stock directly to a qualified charity or a donor-advised fund (DAF). You avoid capital gains tax entirely on the appreciation, and you get a charitable deduction for the full fair market value. On $100,000 of appreciated stock with a $10,000 basis, this can save $13,500+ in federal capital gains tax compared to selling first.

5. Holding until death (stepped-up basis)

Gains on assets held until death are never taxed under the current system, because heirs receive a stepped-up basis. For very large, highly appreciated positions, holding and passing them to heirs can permanently eliminate the embedded capital gains tax. Estate tax may apply separately, but for most estates below the exemption ($13.99 million per person in 2026), this strategy can eliminate capital gains tax entirely.

6. Harvesting gains in low-income years

The mirror image of tax-loss harvesting — if you expect to be in a higher bracket in future years, realize gains now while you are in a lower bracket or the 0% bracket. Pay 0% or 15% now rather than 20% + NIIT later.

7. Spousal income shifts (married couples)

If one spouse has little or no income, it may be possible to transfer appreciated assets and have the lower-income spouse sell them, capturing the 0% bracket. This requires actual ownership transfer (a gift), proper documentation, and should be done well in advance — consult a CPA before attempting.

Always consult a CPA or tax advisor before implementing tax strategies. Individual circumstances — AMT exposure, state taxes, estate planning — can change the calculus significantly. Our calculator gives you an accurate estimate; a professional can confirm the right approach for your situation.

Frequently asked questions

Does a long-term capital gain push me into a higher ordinary income tax bracket?

No. Long-term capital gains are taxed in their own parallel bracket system and do not push your wages or other income into higher ordinary income brackets. However, they do count toward your total income for other purposes — including phaseouts for deductions, IRMAA Medicare premiums, and the NIIT threshold. The stacking rule means your gains are taxed at their own rate, but the rate is determined by where the gain falls when stacked on top of ordinary income.

What if I have both long-term gains and short-term gains in the same year?

They are offset category by category first. Long-term losses offset long-term gains; short-term losses offset short-term gains. Net remaining gains and losses can then be offset against each other. If you end up with a net long-term gain and a net short-term loss (or vice versa), they are combined. The surviving net gain is taxed at the appropriate rate — long-term rates for a net long-term gain, ordinary rates for a net short-term gain.

Do capital gains affect my Social Security benefits?

Capital gains are included in combined income used to determine how much of your Social Security benefits are taxable. If your combined income exceeds $25,000 (single) or $32,000 (MFJ), up to 50% of benefits are taxable. Above $34,000 (single) or $44,000 (MFJ), up to 85% of benefits become taxable. A large capital gain in retirement can unexpectedly trigger taxation of Social Security and increase Medicare IRMAA premiums — both worth modeling in advance.

Can I use capital losses from prior years?

Yes. Capital loss carryforwards from prior years retain their character (long-term or short-term) and are applied in the current year as if they arose this year. There is no time limit — a carryforward from 2016 is still fully valid in 2026. These are reported on Schedule D.