Free calculator · No signup · Method shown

Capital gains tax calculator

Enter your sale price, what you paid and your tax rate to see the gain, the tax due and what you keep.

Example Gain $15,000

StockEducation Editorial Team · Updated · 15 min read · How we check our tools

The calculator

Estimate the tax on your sale

Output Calculated from your inputs

Before you start: The rate box is an estimate you choose (15% long term, 24% short term by default), not a calculation from your income.

Try an example
↓ Capital Gains Tax Calculator ↓
Capital Gains Tax Calculator
FREE · RESEARCH TOOL

Your capital gains details

Choose your country, holding period and sale details. The rate, discount and allowance are editable so you can adjust the assumptions.

Entered-assumption estimate. Gain = proceeds − cost − fees; taxable gain = max(0, gain − allowance) × (1 − discount ÷ 100); tax = taxable gain × rate ÷ 100. Net gain subtracts that tax. Country presets are examples, not verified current rates or a check of eligibility. No income brackets, NIIT, loss benefits or special-asset rules are applied. Full method and limits.

Capital Gains Summary
$—
Gain: — · Taxable Amount: — · Effective Rate: —
Disclaimer: Educational only. Actual outcomes depend on income, residency, thresholds, timing and local rules.
Capital Gain$—
Taxable Amount$—
Effective Rate—
Net Gain After Tax$—
CGT Summary
ItemValueNotes
CountrySelected context; entered assumptions control the arithmetic
Asset TypeSome assets have special rules
Holding PeriodLong means more than one year
ProceedsSale price
Cost BasisPurchase plus costs
Selling FeesDeductible where allowed
Capital GainProceeds minus cost minus fees
Taxable AmountAfter discounts and allowances
Estimated TaxUsing the editable assumptions
Effective CGT RateTax divided by gain
Tax RateThe rate you entered
DiscountShare of the gain left out
AllowanceTax free amount subtracted first
Educational gain estimate: entered assumptions and limits

This applies your entered flat rate, allowance and discount to one sale. Country and holding-period presets are illustrative starting points, not verified current rates. Selecting a country does not determine your personal tax treatment; confirm every assumption.

The arithmetic subtracts allowance before discount and ignores income brackets, additional taxes, exemptions, losses/carryforwards, eligibility and special-asset rules. Real rules may use a different order. This is not tax advice or a tax-return calculation. Use the relevant tax authority or a qualified professional for your actual situation.

Can I use this for my tax return?

No. This is not tax advice.

Tax rules depend on your country, your state, your income, your holding period and your personal circumstances. They also change.

This tool applies simplified general rules and knows none of that about you. The number it produces may be wrong for your situation.

Do not file, report or plan around this figure. Confirm it with a licensed tax professional or directly with the IRS before you act.

Educational estimate only. This is not tax, legal or financial advice. Always confirm with a qualified tax professional before acting.

How to use it (three steps)

Enter your sale price, your cost and any selling fees, pick how long you held it, check the tax rate, then press Calculate tax estimate. Not sure what to try? Load an example.

  1. 1Enter the sale price, your cost and any fees, then pick how long you held it
  2. 2Press Calculate tax estimate and read the tax owed in words
  3. 3Switch between short term and long term to see the difference

Your result in words

Tax estimate

Your result will appear here once the calculator runs.

    Compare two plans

    Keep or share this result

    Saved numbers and images stay on this device. A copied link holds only the tool inputs, nothing else.

    Quick answer

    How much tax will I pay when I sell a stock?

    You pay tax on the gain, not the whole sale: what you sold for, minus what you paid and any fees. How long you held it sets the rate. Held more than one year, U.S. federal long term rates are 0%, 15% or 20% depending on your income; held a year or less, the gain is taxed like your paycheck.1 Sell for $25,000 what cost $10,000 and the gain is $15,000. At 15%, the tax is $2,250 and you keep $12,750 of the gain.

    Gain$15,000
    Tax at 15%$2,250
    You keep$12,750
    Tax if held under a year at 24%$3,600

    Checked against IRS · Investor.gov · see sources

    Key takeaways
    • The gain. Sale price − cost − fees.
    • On disposal. Unsold price gains are generally unrealized.
    • Over a year. Long term rates: 0%, 15% or 20%.
    • A year or less. Taxed like your paycheck.
    • Example. $15,000 gain at 15%: $2,250 tax, $12,750 kept.
    • Losses help. They offset gains, plus generally up to $3,000 of other income a year ($1,500 if married filing separately).

    How the gain is worked outShort vs long termLosses and other rulesTest yourself

    Part 1 of 3 · How it works

    How is capital gains tax calculated?

    Capital gains tax is the tax on the profit when you sell something for more than you paid, such as a stock, a fund or crypto.

    1

    What are the steps?

    1. Gain = sale price − cost basis − selling fees.
    2. Taxable gain = the gain after any allowance or discount you enter. For U.S. stocks, both are usually 0.
    3. Tax = taxable gain × your tax rate.
    4. What you keep = gain − tax.
    The default, step by step

    $25,000 − $10,000 = a $15,000 gain. At 15%, the tax is $2,250, leaving $12,750. A $100 selling fee would cut the gain to $14,900 and the tax to $2,235.

    2

    What is cost basis?

    Usually what you paid, plus purchase costs such as commissions.2 If you bought in several lots, the average price calculator can explain purchase arithmetic, but U.S. tax basis must follow the permitted identification rules for the shares sold. Reconcile your broker’s reported basis with your own records.

    3

    When do I owe it?

    Generally when you sell or otherwise dispose of the investment. A price increase while you still hold a stock is an unrealized gain. Funds can also distribute taxable gains or income even when you do not sell your shares. Selling inside an IRA or 401(k) does not trigger it either.

    4

    Does the same gain math apply when I sell my home?

    The first step is the same: sale price minus your cost basis. The difference is a large exclusion. If you sell your main home, you can exclude up to $250,000 of gain from tax, or up to $500,000 if you file a joint return with your spouse.6

    Say a single filer bought a home for $300,000 and sells it for $500,000. The gain is $200,000. That is under the $250,000 exclusion, so no federal tax is due on it. Had the gain been $320,000, only the $70,000 above the exclusion would be taxable, at long term rates if the home was owned more than a year.

    To qualify, you generally must have owned the home and lived in it as your main home for at least 24 months during the five years before the sale, and you usually cannot have used the exclusion on another home in the previous two years.6 To model a home sale in the calculator, enter the exclusion in the allowance box. The exclusion applies only to your main home.

    The rule

    Tax is generally based on the realized gain, not the whole sale price. Other taxable investment income can arise without a share sale.

    Marks Part 1 done

    Part 2 of 3 · Short vs long term

    Why does holding for over a year matter?

    The same gain can be taxed at very different rates depending on how long you owned the investment.

    5

    How much difference does it make?

    Tax on a $15,000 gain at different rates

    Selling a few weeks later, after the one year mark, would save $1,350 here if your rate drops from 24% to 15%.
    6

    Which long term rate applies to me?

    2026 federal long term capital gains rates by taxable income
    RateSingleMarried filing jointly
    0%Up to $49,450Up to $98,900
    15%Up to $545,500Up to $613,700
    20%Above $545,500Above $613,700

    Source: IRS inflation adjusted tax items for 2026. Taxable income includes the gain itself.

    Higher earners may also owe the 3.8% net investment income tax, and state taxes can also apply.3

    7

    How can a gain be taxed at 0%, and when does part of it cost 15%?

    The 0% long term rate applies to the part of your taxable income that falls under the 2026 threshold, $49,450 for a single filer.4 The key detail is that your other income fills the bracket first, and the gain sits on top.

    Say a single filer has $30,000 of taxable income from work and a $30,000 long term gain, for $60,000 in total. The first $19,450 of the gain fits under $49,450 and is taxed at 0%. The remaining $10,550 is taxed at 15%, which is $1,582.50. The whole gain is not taxed at 15%, and it is not all tax free either.

    This is why some investors plan sales for lower income years, such as a gap between jobs or early retirement, or split a large sale across two tax years. Short term gains get no such treatment: they are taxed at your ordinary income rates.1 To use this in the calculator, calculate the tax on each portion separately, then add those amounts, or use a blended rate for the whole gain. Do not apply both rates to the entire gain. This flat-rate calculator does not allocate your gain across income brackets.

    The rule

    Hold for more than one year and the same gain is usually taxed at a lower rate.

    Marks Part 2 done

    Part 3 of 3 · Losses and other rules

    What does this calculator leave out?

    The calculator multiplies your gain by the rate you enter. Real tax returns have more moving parts.

    8

    What happens if I sell at a loss?

    You owe no tax on that sale, and the loss can offset other gains. If losses are bigger than gains, up to $3,000 a year ($1,500 if married filing separately) can reduce your other income, and the rest carries forward.1 The calculator shows $0 tax on a loss but does not model these benefits.

    9

    What else is not included?

    • Your income brackets. You pick the rate. Part of a large gain can fall in a higher bracket.
    • The 3.8% net investment income tax and state tax.
    • Wash sales. Buying substantially identical securities within 30 days before or after the sale can disallow a loss.
    • Special assets. Collectibles and some property have different rules.

    The tool also lists a few other countries, but this page explains the U.S. rules.

    Your turn

    Get a fuller U.S. estimate. The stock profit after tax calculator fills your gain into the 2026 federal brackets from your income, and adds the net investment income tax and state tax.

    Open the after tax calculator Free, no signup.
    10

    How does tax loss harvesting work, and what is the wash sale trap?

    Harvesting means selling an investment that is below what you paid to offset gains elsewhere. If you have a $15,000 long term gain and sell another holding at a $5,000 loss, your net gain falls to $10,000. At 15%, the tax drops from $2,250 to $1,500. If losses are larger than gains, up to $3,000 a year ($1,500 if married filing separately) can reduce your other income, and the rest carries forward.1 For a single filer, a $10,000 net loss gives a $3,000 deduction this year and $7,000 to use in later years.

    The wash sale rule stops you from selling for the loss and buying straight back. If you buy substantially identical securities within 30 days before or after the sale, the loss cannot be deducted for now.5 Many investors stay invested by moving into another investment only after checking that it is not substantially identical; a different fund name alone does not settle that test.

    Harvesting saves tax only in a taxable account. Gains and losses inside an IRA or 401(k) are not taxed or deducted.

    The rule

    Use this to see the size of the bill. Check the details with a tax professional before you sell.

    Marks Part 3 done

    Mistakes to avoid

    Three mistakes to avoid, and what to do instead

    Selling one day too early

    Holding for more than a year moves a gain from ordinary income rates to lower long term rates. Check the purchase date before you sell.

    Forgetting state tax

    Federal tax is only part of the bill in most states. Add your state rate to see what you actually keep.

    Ignoring losses elsewhere

    Realized losses offset gains, and generally up to $3,000 of net loss ($1,500 if married filing separately) can offset ordinary income each year. Look at the whole account, not one sale.

    Quick check

    Three quick questions and one why

    0 of 3 answered

    1. You sell shares for $12,000 that cost you $8,000. What is the gain?

    Answer: A, $4,000.Gain = sale price − cost. Tax applies to the $4,000, not the $12,000.

    2. You held a stock for 8 months. How is the gain taxed federally?

    Answer: C, like ordinary income.A year or less is short term, taxed at your regular income tax rate.

    3. Your gain is $10,000 and your long term rate is 15%. How much do you keep?

    Answer: B, $8,500.Tax is $10,000 × 15% = $1,500, so you keep $8,500 of the gain.
    Why: why can waiting a few weeks to sell save money?

    If you are close to the one year mark, waiting can move the gain from short term to long term. For many people that drops the rate from their income tax rate to 15% or even 0%. The price can also move while you wait, so it is a trade off.

    Common questions

    Capital Gains Tax Calculator FAQ

    How much tax will I pay when I sell a stock?

    You pay tax on the gain, not the whole sale: the sale price minus what you paid and any fees. How long you held the stock sets the rate. Held more than one year, the gain is taxed at federal long term rates of 0%, 15% or 20% depending on your taxable income. Held a year or less, it is taxed at your ordinary income rate. Selling for $25,000 a stock that cost $10,000 gives a $15,000 gain, and at 15% the federal tax is $2,250.

    What are the 2026 long term capital gains tax rates?

    For 2026, the federal long term rate is 0% on taxable income up to $49,450 for single filers and $98,900 for married couples filing jointly. It is 15% up to $545,500 single and $613,700 joint, and 20% above those amounts, according to the IRS. Taxable income includes the gain itself, so a large gain can spread across two rates. Higher earners may also owe the 3.8% net investment income tax, and state taxes can also apply.

    Is capital gains tax charged on the whole sale price?

    No. This is a common misconception. The tax applies only to the gain, which is the sale price minus your cost basis and selling fees. If you sell shares for $25,000 that cost $10,000, only $15,000 is a gain. A price increase while you still own a stock is generally unrealized. A sale or other taxable disposal can realize the gain; fund distributions and investment income can still be taxable without a sale of your shares. Keep your broker’s cost basis records, because they show what you paid for each lot.

    What are legal ways to reduce capital gains tax?

    The main legal ways are holding investments for more than a year so gains qualify for long term rates, using losses to offset gains, timing sales for lower income years when part of a gain can be taxed at 0%, and investing through tax advantaged accounts such as a 401(k) or IRA. For your main home, up to $250,000 of gain, or $500,000 for married couples filing jointly, can be excluded if you meet the ownership and use tests. Each method has rules worth checking first.

    How does tax loss harvesting work with the wash sale rule?

    Tax loss harvesting means selling investments that are below what you paid so the losses offset your gains. A $5,000 loss cuts a $15,000 gain to $10,000, saving $750 at a 15% rate. Losses beyond your gains can reduce other income by up to $3,000 a year ($1,500 if married filing separately), with the rest carried forward. The wash sale rule disallows the loss if you buy substantially identical securities within 30 days before or after the sale, so many investors switch to another investment only after checking that it is not substantially identical.

    Do I pay capital gains tax in a 401(k) or IRA?

    No. Buying and selling inside a 401(k), traditional IRA or Roth IRA does not create capital gains tax when the trades happen. That is one of the simplest ways long term investors avoid the tax. Withdrawals follow each account’s own rules instead, which differ between traditional and Roth accounts. The flip side is that losses inside these accounts cannot be deducted, so tax loss harvesting only works in a taxable brokerage account.

    Is crypto taxed the same way as stocks?

    Mostly, yes. The IRS treats digital assets such as crypto as property, not currency, so selling, trading or spending them can create a capital gain or loss. The same holding period rules apply: more than a year gets long term rates, and a year or less is taxed as ordinary income. Trading one coin for another is a disposal too, which surprises many new holders. Keep records of what you paid for each purchase, because you need that cost basis to work out each gain.

    What does this capital gains tax calculator include?

    It works out your gain, the tax at the rate you choose and what you keep after tax. You enter the sale price, cost basis, selling fees and a rate, and choosing short term sets the rate to 24% as an example. It does not apply the income brackets for you, add the 3.8% net investment income tax or state tax, or model loss offsets and wash sales. Save my numbers keeps your inputs on this device, and Copy link to these numbers shares them.

    Next steps

    You know how gains are taxed. Now learn how holding time changes the bill.

    A free account saves your course progress and opens the $1,000,000 practice simulator, where you can watch real U.S. stocks rise and fall with virtual money before any of your own is at stake.

    Free, no card. Lessons and tools stay free to use without an account.

    Capital gains tax on one card, and where to go next
    1. Step 1 · DoneHow capital gains tax works
      See it on one card
      1. The gain. Sale price − cost − fees.
      2. On disposal. Unsold price gains are generally unrealized.
      3. Over a year. Long term rates: 0%, 15% or 20%.
      4. A year or less. Taxed like your paycheck.
      5. Example. $15,000 gain at 15%: $2,250 tax, $12,750 kept.
      6. Losses help. They offset gains, plus generally up to $3,000 of other income a year ($1,500 if married filing separately).
    2. 2
      Step 2 · NowGet the full U.S. picture

      Fill your gain into the federal brackets, with state tax and NIIT.

      Open the after tax calculator Free, no signup.
    3. 3
      Step 3Follow the learning path
      The learning pathFree

      Learn the rest in the right order

      Lessons, videos, tools and quizzes, ordered so each step builds on the last, from market basics to building a portfolio.

      Start the learning path

    Want the full sequence? See the course outline →

    Sources and assumptions

    1. IRS Topic No. 409, Capital gains and losses. Short and long term rules, rates and the $3,000 loss limit.
    2. IRS Topic No. 703, Basis of assets. What counts in your cost basis.
    3. IRS Topic No. 559, Net investment income tax. The 3.8% tax and its income thresholds.
    4. IRS: Inflation adjusted tax items by tax year. The 2026 capital gains rate thresholds.
    5. Investor.gov (U.S. Securities and Exchange Commission): Wash sales. The rule that disallows a loss when you buy substantially identical securities within 30 days before or after the sale.
    6. IRS Topic No. 701, Sale of your home. The $250,000 and $500,000 home sale exclusions and the ownership and use tests.
    7. IRS: Digital assets. Digital assets are treated as property, so selling them can create a capital gain or loss.

    Method: gain = sale proceeds − cost basis − selling fees; taxable gain = the larger of zero and the gain minus any allowance, reduced by any discount; tax = taxable gain × the rate entered; net gain after tax = gain − tax. Income brackets, the net investment income tax, state tax, loss offsets and special asset rules are excluded. Choosing short term with United States selected sets the rate to 24% as an example. Illustrative arithmetic was checked on October 23, 2026; the 2026 federal thresholds were checked against IRS Revenue Procedure 2025-32. All amounts are in U.S. dollars.

    Page history. October 23, 2026: V11 design and expanded guide applied, preserving the working calculator, country controls, validation, comparison, sharing and save/restore fixes.

    StockEducation provides general education, not personal financial, tax or legal advice. Results are illustrations based on the assumptions you enter, not forecasts or promises of any return. Investing involves risk, including the loss of money you invest.

    Up nextPart 1
    Next ↓