StructureX

Home › Guides › Markets & the economy

How is capital gains tax calculated?

This page is for United States, federal rules (IRS); state taxes are not covered

You do not tax the whole sale. You tax the gain, and the rate depends on how long you held the asset and what else is in your taxable income. Four steps give you the number.

Beginner guide · 8-minute read · By Paspir · Updated 2026-11-29

The short answer

This page is about United States federal tax, from the IRS. It does not cover state tax. Every dollar figure is for tax year 2026 unless a line says otherwise.

Capital gains tax takes four steps:

  1. Find the gain. What you got, minus what you paid, costs included.
  2. Count the time. More than one year is long-term. One year or less is short-term.
  3. Stack the gain. Your other taxable income goes first. The gain sits on top.
  4. Apply the rates. Long-term gain is taxed at 0%, 15% or 20% by where it lands on the stack. Short-term gain is taxed like pay.

You can run all four on the capital gains tax calculator.

Step 1: find the gain

Publication 550 says you figure gain or loss "by subtracting the adjusted basis of the property from the amount you realize on the sale or trade." Source: irs.gov.

Gifts and inheritances have their own basis rules. The IRS sends you to Publication 551 for those.

Step 2: long-term or short-term

The IRS rule: more than one year is long-term. One year or less is short-term. You count "from the day after the day you acquired the asset up to and including the day you disposed of the asset." Source: irs.gov.

Publication 550 gives an example. Buy on January 31, 2024 and sell on January 29, 2025, and you did not pass one year. The result is short-term.

Because counting starts the day after you buy, the first long-term day is one day after your one-year date. Buy on March 10, 2026, and a sale on March 10, 2027 is still short-term. March 11, 2027 is long-term.

Step 3: stack the gain on your income

Your taxable income is your income after your deduction. The IRS rates for long-term gain look at that number. They do not look at the gain alone.

Picture a stack of blocks. Your other taxable income goes in first. The gain sits on top. The tax lines mark heights on the stack.

Step 4: apply the rates

For 2026 the IRS lines are in Rev. Proc. 2025-32 section 4.03. The 0% rate covers taxable income up to the first number. The 15% rate covers the part up to the second. The 20% rate covers the rest.

2026, United States0% up to15% up to
Single$49,450$545,500
Married filing jointly$98,900$613,700
Head of household$66,200$579,600
Married filing separately$49,450$306,850

Source: irs.gov. The 2027 lines are on capital gains tax brackets for 2027. For other years, see capital gains tax rates by year.

A short-term gain skips this table. The IRS says net short-term gains "are subject to taxation as ordinary income at graduated tax rates." Source: irs.gov.

Hypothetical: a long-term gain at 0% and 15%

Say a single filer bought shares for $12,000 and paid a $20 fee. Later they sold for $30,000 and paid a $30 fee. They held more than a year. Their other taxable income in 2026 is $40,000.

StepAmount
Amount realized ($30,000 − $30)$29,970
Adjusted basis ($12,000 + $20)$12,020
Gain$17,950
Room under the 0% line ($49,450 − $40,000)$9,450
Gain taxed at 0%$9,450
Gain taxed at 15% ($17,950 − $9,450)$8,500
Tax at 15%$1,275

The first $9,450 of the gain costs nothing. The last $8,500 costs $1,275.

Hypothetical: the same gain, held eight months

Now say the same sale happened after eight months. The gain is still $17,950, and now it is taxed as ordinary income. The 2026 United States single brackets are 12% up to $50,400 and 22% above. Source: irs.gov.

StepAmount
Stack before the gain$40,000
Stack with the gain$57,950
Gain taxed at 12% ($50,400 − $40,000)$10,400
Gain taxed at 22% ($57,950 − $50,400)$7,550
Tax at 12%$1,248
Tax at 22%$1,661
Total$2,909

That is $1,634 more than the long-term case. The only change was time.

Hypothetical: a gain that crosses the 15% line

Say a married couple files jointly in 2026. Their other taxable income is $600,000. They have a long-term gain of $50,000.

StepAmount
Stack with the gain$650,000
15% line (married filing jointly, 2026)$613,700
Gain taxed at 15% ($613,700 − $600,000)$13,700
Gain taxed at 20% ($650,000 − $613,700)$36,300
Tax at 15%$2,055
Tax at 20%$7,260
Total$9,315

A gain can cross a line. Each part is taxed at the rate of its own zone.

Hypothetical: a loss

Losses net against gains first. If you have only losses, the IRS lets you use "the lesser of" $3,000 ($1,500 if married filing separately) or your total net loss. The rest carries to the next year. Source: irs.gov.

Say a single filer sells one stock for a $9,000 loss and has no gains. Their other taxable income is $40,000.

StepAmount
Net loss−$9,000
Deduction this year$3,000
Taxable income after the deduction$37,000
Tax saved at 12%$360
Carried to next year$6,000

What the four steps leave out

Some gains have higher top rates. The IRS names collectibles and section 1202 small business stock at a top rate of 28%, and the section 1250 part of a real estate gain at 25%. Source: irs.gov. High earners may also owe the 3.8% net investment income tax. The net investment income tax guide covers it. Selling a home has its own exclusion.

You report sales on Form 8949 and total them on Schedule D.

Questions

How is capital gains tax calculated?

Subtract your adjusted basis from the amount you realized. Long-term gain is taxed at 0%, 15% or 20% by where it sits on top of your taxable income. Short-term gain is taxed as ordinary income.

Is capital gains tax figured on the whole sale price?

No. It is figured on the gain only: the sale price minus fees, minus what you paid plus fees.

How long must I hold to get the long-term rate?

More than one year. The IRS counts from the day after you buy through the day you sell.

Does my gain change which rate I pay?

Yes. The gain is part of the stack, so a big gain can push part of itself into a higher zone.

Can a capital loss lower my other income?

Yes, up to $3,000 a year ($1,500 married filing separately). The rest carries to later years.

Reminder: this page is for United States, federal rules (IRS); state taxes are not covered

Follow along

XTradingViewFacebook