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.
Key points
- The gain. Sale price − cost − fees.
- Only on selling. No tax on gains you still hold.
- 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 up to $3,000 of income a year.
2 minute lesson, optionalWait a year, pay less taxGuess first, see the answer, then try it yourself. Five quick steps. You can skip it any time. Play the lessonClose the lessonOpen
Your path
Do today’s challenge, then tap Up next.
Capital gains tax calculator
Step 1 of 5
How much federal tax do you save by waiting?
Tap a guess. Wrong guesses cost nothing.
Free · No signup · 2 minutes · Revision review pending · Updated
Step 2 of 5
Next: try it yourself.
Step 3 of 5
Your turn
Drag a slider or tap an option. Watch the number change.
Type exact numbers
Quick version for learning. The full capital gains tax calculator below has every option.
Step 4 of 5
What if you changed one thing?
Tap a change to see what it does to .
Step 5 of 5
Tap an answer. You see why either way.
Lesson complete
More
Learn it in 4 short parts
Each part answers one question. Open any part. Tap Got it when you are done.
How it worksHow is capital gains tax calculated?
You are taxed on the gain, not the sale price, and only when you sell.
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.
What are the steps?
- Gain = sale price − cost basis − selling fees.
- Taxable gain = the gain after any allowance or discount you enter. For U.S. stocks, both are usually 0.
- Tax = taxable gain × your tax rate.
- What you keep = gain − tax.
$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.
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 help, but your broker’s cost basis records are the ones the IRS uses.
When do I owe it?
Only when you sell. A stock that has doubled but that you still hold has an unrealized gain, and no tax is due on it yet. Selling inside an IRA or 401(k) does not trigger it either.
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.
You are taxed on the gain, not the sale price, and only when you sell.
Marks part 1 of 4 done and opens the next one.
Short vs long termWhy does holding for over a year matter?
Hold for more than one year and the same gain is usually taxed at a lower rate.
The same gain can be taxed at very different rates depending on how long you owned the investment.
How much difference does it make?
Selling a few weeks later, after the one year mark, would save $1,350 here if your rate drops from 24% to 15%.
Which long term rate applies to me?
| Rate | Single filer | Married filing jointly |
|---|---|---|
| 0% | Up to $49,450 | Up to $98,900 |
| 15% | $49,451 to $545,500 | $98,901 to $613,700 |
| 20% | Above $545,500 | Above $613,700 |
Higher earners may also owe the 3.8% net investment income tax, and most states tax gains as regular income.3
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, run the sale twice, once at 0% for the part under the threshold and once at 15% for the rest, then add the two tax figures.
Hold for more than one year and the same gain is usually taxed at a lower rate.
Marks part 2 of 4 done and opens the next one.
Losses and other rulesWhat does this calculator leave out?
Use this to see the size of the bill. Check the details with a tax professional before you sell.
The calculator multiplies your gain by the rate you enter. Real tax returns have more moving parts.
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 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.
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 the same stock back within 30 days 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.
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 calculatorHow 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 can reduce your other income, and the rest carries forward.1 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 a similar fund that is not identical, such as one tracking a different index.
Harvesting saves tax only in a taxable account. Gains and losses inside an IRA or 401(k) are not taxed or deducted.
Use this to see the size of the bill. Check the details with a tax professional before you sell.
Marks part 3 of 4 done and opens the next one.
Watch outThree mistakes to avoid, and what to do instead
Common slips 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 up to $3,000 of net loss can offset ordinary income each year. Look at the whole account, not one sale.
Marks part 4 of 4 done.
Capital Gains Tax Calculator FAQ
Tap a question to open the answer.
What does the capital gains tax calculator do, and is it free?
Estimate the tax on an investment gain, using the rates you choose. You enter sale proceeds, cost, fees and your tax assumptions. You get your gain, the taxable amount and an estimated tax. It is free to use with no signup. Keep in mind: you choose the rates. The tool does not look up your bracket.
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 most states tax capital gains as ordinary income.
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. You also owe nothing until you sell. A stock that has doubled while you still own it has an unrealized gain, and no tax is due on it yet. 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.
Show 4 more questionsShow fewer questions
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, 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 a similar but not identical fund.
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.
What should I do next?
Pick the step that fits what you just did.
Who checks this page, and the sources
Real people check the numbers and the wording. Every source is listed.
- Updated
- Sources listed below
- Education, not advice
- Review of this update in progress
Sources and methodEvery source used on this page, how the tool works and the page history.
- IRS Topic No. 409, Capital gains and losses. Short and long term rules, rates and the $3,000 loss limit.
- IRS Topic No. 703, Basis of assets. What counts in your cost basis.
- IRS Topic No. 559, Net investment income tax. The 3.8% tax and its income thresholds.
- IRS: Inflation adjusted tax items by tax year. The 2026 capital gains rate thresholds.
- 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.
- IRS Topic No. 701, Sale of your home. The $250,000 and $500,000 home sale exclusions and the ownership and use tests.
- 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. Every figure on this page came from this calculator on October 15, 2026. All amounts are in U.S. dollars.
Page history. November 27, 2026: page simplified into numbered sections, missing tables restored and the questions reordered. The tool itself has not changed. October 21, 2026: content expanded, sources added and the page reviewed by Associate Professor Charles Lo, CPA, PhD. The tool itself has not changed.
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.
