LawCalculators.com 2026 STATUTORY EDITION
Tax & IRS New By the LawCalculators.com Editorial Team · Published Nov 28, 2026 · 10 min read

Stock Tax Calculator Guide: How to Calculate Tax on Stock Sales in 2026

How a stock tax calculator estimates what you owe when you sell shares in 2026: cost basis, holding period, federal and state tax, wash sales and worked examples.

Quick answer: Tax on a stock sale equals your gain (sale price minus cost basis) times your rate. Shares held more than one year are taxed at 0%, 15% or 20%, while shares held one year or less are taxed at your ordinary rate, up to 37%. On a $40,000 gain, our stock tax calculator estimates $4,552 of federal tax if the shares were held one year or less, versus $0 federal if they were held longer, when the gain is your only income.

Open Stock Tax Calculator →

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.

  1. Find the proceeds. This is the sale price times the number of shares, minus commissions or fees.
  2. 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.
  3. Calculate the gain or loss. Proceeds minus basis.
  4. Check the holding period. More than one year is long-term. One year or less is short-term.
  5. Apply the rate. Long-term gains use 0%, 15% or 20%. Short-term gains use your ordinary bracket.
  6. 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.

RateSingleMarried Filing JointlyHead of Household
0% (long-term)Up to $49,450Up to $98,900Up 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,500Over $613,700Over $579,600
Short-termTaxed 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.

MethodHow it works
First in, first out (FIFO)The default when you do not specify: the oldest shares are sold first.
Specific identificationYou tell your broker which lots to sell, so you can choose higher-basis or long-term shares.
Average costAvailable 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.

ScenarioGainFederal taxState taxTotal estimate
Sell for $85,000, basis $45,000, held over 1 year (CA)$40,000$0 (0% rate)about $1,415about $1,415
Same sale, held 1 year or less (CA)$40,000$4,552 (10% and 12% brackets)about $1,415about $5,967
Sell for $500,000, basis $150,000, held over 1 year (federal only)$350,000$45,083 (0% and 15%) + $6,312 NIITVaries$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

  1. Open the stock tax calculator and choose your state.
  2. Enter your gross stock sale proceeds.
  3. Enter your adjusted cost basis.
  4. Choose your filing status and enter your other taxable income, after deductions.
  5. Select Long-Term (more than one year) or Short-Term (one year or less).
  6. 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

For large or complex sales, a licensed tax professional can review your full situation, including state rules and equity compensation.

Open Stock Tax Calculator → ← Back to All Blog Posts

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.

Frequently Asked Questions

Subtract your adjusted cost basis from the sale proceeds to find the gain. If you held the shares for more than one year, the gain is long-term and taxed at 0%, 15% or 20% depending on your income and filing status. If you held them one year or less, it is short-term and taxed at your ordinary rate of 10% to 37%. Add the 3.8% Net Investment Income Tax if your income is above the threshold, then any state tax.
Long-term gains are taxed at 0%, 15% or 20%. For Single filers the 0% rate applies up to $49,450 of taxable income, 15% up to $545,500 and 20% above that. Short-term gains are taxed as ordinary income at 10% to 37%. Our stock tax calculator stacks a short-term gain on your other income and applies the actual 2026 brackets.
You must hold the shares for more than one year. The holding period starts the day after you acquire the shares and ends on the day you sell. Selling on the one-year anniversary is still short-term, so waiting one extra day can lower your federal rate.
Your broker reports cost basis on Form 1099-B for most shares bought after 2010. Your basis is generally the purchase price plus commissions, and reinvested dividends add to it. For inherited stock, the basis is generally the market value on the date of death, and for gifted stock it generally carries over from the giver.
Yes. Capital losses first offset capital gains in the same year. If your losses are larger than your gains, you can deduct up to $3,000 ($1,500 if Married Filing Separately) against other income and carry the remainder forward to later years.
A wash sale happens when you sell a stock at a loss and buy the same or a substantially identical security within 30 days before or after the sale. The loss is disallowed for now and is added to the basis of the replacement shares, so it is deferred rather than lost.
RSUs are taxed as ordinary income when they vest, based on the market value that day, and that value becomes your cost basis. When you later sell, the difference between the sale price and that basis is a capital gain or loss, long-term if you held the shares more than one year after vesting.
Yes. In a regular taxable brokerage account, you owe tax on the gain in the year you sell, even if you immediately buy other investments. Gains inside a 401(k) or IRA are not taxed when you trade within the account.
Yes, the LawCalculators.com stock tax calculator is free. It gives a planning estimate from your sale proceeds, cost basis and holding period using 2026 federal breakpoints and a state tax model. It stacks the gain on the other taxable income you enter but does not model every deduction or special rate, so confirm your final tax with tax software or a qualified professional.