Most investors check their account balance far more often than they check their tax bill. The two meet on the day you sell. Whether you are trimming a winner, rebalancing or cashing out to buy a home, the tax can change how much you actually keep. A stock tax calculator lets you test a sale before you place the order, when you can still adjust the timing, pick which shares to sell or pair the gain with a loss. This guide covers how the tax works in 2026, the numbers that matter, and examples you can verify by hand.
What a stock tax calculator does
A stock tax calculator takes your sale proceeds, your adjusted cost basis and your holding period, then estimates the federal tax, the 3.8% Net Investment Income Tax (NIIT) and your state tax. People search for it as a stock sale tax calculator, a stock gain tax calculator or a tax calculator for stocks. The idea is the same: what you sold it for, what you paid, and what you owe on the difference.
Our stock tax calculator uses the 2026 long-term breakpoints from IRS Rev. Proc. 2025-32 and the NIIT rules in IRC Section 1411, plus a state estimate for all 50 states and D.C. It also asks for your filing status and other taxable income, so the gain is stacked on top of your wages. For a gain entered directly rather than as proceeds and basis, use the capital gains tax calculator.
How to calculate capital gains tax on a stock sale
If you want to know how to calculate capital gains tax on a stock sale without software, follow these steps.
- Find the proceeds. This is the sale price times the number of shares, minus commissions or fees.
- Find your adjusted cost basis. Usually the purchase price plus commissions, plus any reinvested dividends. If you bought at different times, find the basis for the specific shares you sold.
- Calculate the gain or loss. Proceeds minus basis.
- Check the holding period. More than one year is long-term. One year or less is short-term.
- Apply the rate. Long-term gains use 0%, 15% or 20%. Short-term gains use your ordinary bracket.
- Add NIIT and state tax if they apply to you.
Stock sale tax calculator: long-term vs short-term
The holding period is the single biggest lever you control. Here is how the 2026 long-term breakpoints compare with short-term treatment.
| Rate | Single | Married Filing Jointly | Head of Household |
|---|---|---|---|
| 0% (long-term) | Up to $49,450 | Up to $98,900 | Up to $66,200 |
| 15% (long-term) | $49,451 to $545,500 | $98,901 to $613,700 | $66,201 to $579,600 |
| 20% (long-term) | Over $545,500 | Over $613,700 | Over $579,600 |
| Short-term | Taxed as ordinary income at 10% to 37% | ||
These breakpoints apply to taxable income, including the gain. The holding period starts the day after you buy and ends on the day you sell, so a sale on the one-year anniversary is still short-term. Checking your purchase dates before you sell can turn a 22% or 24% federal rate into 15%.
Cost basis: the number that decides your stock gain
Most mistakes in a stock sale calculation come from the basis, not the rate. If you bought shares at different prices, the method you use to pick which shares you sold changes your gain.
| Method | How it works |
|---|---|
| First in, first out (FIFO) | The default when you do not specify: the oldest shares are sold first. |
| Specific identification | You tell your broker which lots to sell, so you can choose higher-basis or long-term shares. |
| Average cost | Available for mutual funds and some dividend reinvestment plans, using one blended basis per share. |
Reinvested dividends raise your basis, so including them prevents you from paying tax twice on the same money. Stock splits change the basis per share but not your total basis. Your broker reports basis and proceeds on Form 1099-B, and the details flow to Form 8949 and Schedule D on your return.
Stock gain tax calculator examples
These examples use the same logic as our stock tax calculator: gain equals proceeds minus basis, the federal rate is based on the gain, and the state estimate uses the state tax model. The first two use California, the calculator's default state. All three assume no other taxable income.
| Scenario | Gain | Federal tax | State tax | Total estimate |
|---|---|---|---|---|
| Sell for $85,000, basis $45,000, held over 1 year (CA) | $40,000 | $0 (0% rate) | about $1,415 | about $1,415 |
| Same sale, held 1 year or less (CA) | $40,000 | $4,552 (10% and 12% brackets) | about $1,415 | about $5,967 |
| Sell for $500,000, basis $150,000, held over 1 year (federal only) | $350,000 | $45,083 (0% and 15%) + $6,312 NIIT | Varies | $51,394 federal |
The first two rows show the cost of selling early: the same $40,000 gain costs $4,552 more when it is short-term. In the third row, the first $49,450 of the gain is taxed at 0% and the rest at 15%. The calculator estimates MAGI by adding the $16,100 standard deduction to the gain, which gives $366,100, so 3.8% applies to the $166,100 above the $200,000 NIIT threshold, which is $6,312. In a state with no income tax, such as Texas or Florida, the state column drops to $0.
What the calculator simplifies
Most people sell shares while also earning wages, which pushes the gain into a higher bracket, so the calculator asks for your other taxable income. Enter $85,000 of other taxable income and the same $40,000 long-term gain is taxed at 15%, or $6,000, instead of 0%. It applies the 2026 brackets for Single, Married Filing Jointly or Head of Household, but it handles one sale at a time, does not net your losses and does not model special rates. For a gain you have already netted, use the capital gains tax calculator, and read the capital gains tax calculator guide for how the stacking works.
Selling stocks: losses and the wash sale rule
Losses can lower your bill. A loss on one stock offsets gains on another in the same year. If your losses exceed your gains, up to $3,000 can reduce other income and the rest carries forward. This is the idea behind tax-loss harvesting.
The wash sale rule limits it. If you buy the same or a substantially identical security within 30 days before or after you sell at a loss, the loss is disallowed for now and added to the basis of the new shares. The rule applies across your accounts, including IRAs, so check before repurchasing.
RSUs, stock options and employee stock plans
If you searched for an RSU stock tax calculator or a restricted stock tax calculator, note that these shares are taxed in two stages. Restricted stock units are taxed as ordinary income when they vest, based on the market value that day. That value becomes your cost basis. When you later sell, only the change since vesting is a capital gain or loss. Employers often withhold federal tax on vesting at a flat 22% supplemental rate, which can be too low for higher earners, so some people owe more at filing time.
Incentive stock options and employee stock purchase plans have their own timing rules and can trigger the alternative minimum tax. Our stock calculator does not model them, so use the AMT calculator for the AMT side and talk to a tax professional before a large exercise.
How to use the stock tax calculator
- Open the stock tax calculator and choose your state.
- Enter your gross stock sale proceeds.
- Enter your adjusted cost basis.
- Choose your filing status and enter your other taxable income, after deductions.
- Select Long-Term (more than one year) or Short-Term (one year or less).
- Read the federal rate, NIIT and state tax in the breakdown.
Run it twice to compare selling now against waiting until the one-year mark, or selling in two tax years instead of one. For qualified dividends from the same stocks, try the dividend tax calculator.
Ways to lower the tax on stock sales
- Hold past one year when you can, so the gain gets long-term rates.
- Choose your lots. Specific identification lets you sell higher-basis shares first and reduce the gain.
- Pair gains with losses and watch the 30-day wash sale window.
- Use low-income years. If your taxable income is under the 0% breakpoint, long-term gains can be federally tax-free.
- Keep basis records, including reinvested dividends, so you do not overpay.
For large or complex sales, a licensed tax professional can review your full situation, including state rules and equity compensation.
Informational estimate: This article and the linked calculator provide general estimates for education only. They are not legal, tax or accounting advice. Figures reflect Tax Year 2026 federal data (IRS Rev. Proc. 2025-32) as used in our calculator; confirm your exact tax with a qualified tax professional or the IRS.