Estimate your stock capital gains tax before you sell.
Enter your buy price, sell price, shares, income, and holding period to estimate your federal capital gains tax.
Why it matters: Selling stock for a profit? Your actual take-home amount may be lower after taxes. Estimate the impact before you make a move.
Example calculation
Suppose you bought 100 shares at $50 ($5,000 cost basis) and sold them at $80 ($8,000 proceeds), for a $3,000 gain. You're single with $75,000 of other taxable income.
If you held the shares more than a year, the gain is long-term. At $75,000 of income you're in the 15% long-term bracket, so the estimated federal tax is about $450 (15% × $3,000), leaving roughly $7,550 in after-tax proceeds.
If you held them one year or less, the $3,000 is short-term and taxed as ordinary income at your 22% marginal rate — about $660 — noticeably more than the long-term result.
How the capital gains tax calculator works
When you sell a stock, ETF, or other investment for more than you paid, the profit is a capital gain and it is generally taxable. This capital gains tax calculator estimates the federal tax on that gain so you can see roughly how much of your profit you keep. You enter your filing status, other taxable income, what you paid (your cost basis), what you sold for, the number of shares, and how long you held the investment. The calculator does the rest and shows your cost basis, proceeds, gain or loss, the tax classification, and the estimated tax and after-tax proceeds.
Short-term vs long-term capital gains
The single most important factor in your capital gains tax is how long you held the investment. The tax code splits gains into two buckets:
- Short-term capital gains apply to assets held for one year or less. They are taxed as ordinary income at the same rates as your wages — from 10% up to 37% for 2024.
- Long-term capital gains apply to assets held for more than one year. They receive preferential federal rates of 0%, 15%, or 20% depending on your total taxable income.
Because the difference can be large, many long-term investors are careful to hold a position for at least a year and a day before selling. Use our dedicated short-term capital gains calculator and long-term capital gains calculator to focus on each scenario.
The 0%, 15%, and 20% long-term brackets
Long-term capital gains "stack" on top of your ordinary income to decide which bracket applies. For 2024, a single filer pays 0% on long-term gains while total taxable income stays under about $47,025, 15% up to roughly $518,900, and 20% above that. Married-filing-jointly thresholds are roughly double. This means a low-income year can let some investors realize gains at the 0% rate.
What is the Net Investment Income Tax (NIIT)?
Higher earners may owe an additional 3.8% NIIT on investment income, including capital gains. It applies when your modified adjusted gross income (MAGI) exceeds $200,000 for single filers or $250,000 for married filing jointly. The 3.8% is charged on the smaller of your net investment income or the amount your MAGI exceeds the threshold. Toggle the NIIT option in the calculator to include this estimate.
How capital losses help
Not every sale is a gain. If you sell for less than your cost basis, you have a capital loss, which can offset capital gains dollar-for-dollar. If your losses exceed your gains, you can deduct up to $3,000 of net losses against ordinary income each year and carry the rest forward to future years. Keep the "include losses" toggle on to model a losing position.
What this calculator does not include
This is a simplified federal estimate. It does not calculate state capital gains taxes, which vary widely — some states tax gains as ordinary income while others have no income tax at all. It also does not model the alternative minimum tax, wash sales, the qualified dividend interaction, deductions, or credits. Treat the result as a ballpark figure and confirm the specifics with a qualified tax professional before you act.
Tips for using your results
- Compare the short-term and long-term outcomes before selling a position you've held close to a year.
- If you're near a bracket threshold, realize how additional income could push part of your gain into a higher rate.
- Consider tax-loss harvesting to offset gains — but watch the wash sale rule.
- Remember that tax-advantaged accounts like IRAs and 401(k)s generally don't trigger capital gains tax on trades inside them.
Keep going — related calculators
Answer your next investing question in under a minute.
Should I sell now or wait for long-term?
See the exact dollar tax difference between selling today and waiting for long-term capital gains — opportunity cost included.
Tax savings • Days to long-term • Net advantage
Is this gain short-term or long-term?
Stocks held under a year are taxed as ordinary income. Estimate your short-term capital gains tax.
Ordinary rate • vs long-term • What you'd save
What's my long-term capital gains rate?
Stocks held over a year qualify for lower 0%, 15%, or 20% federal rates. Estimate your long-term tax.
0% / 15% / 20% tier • NIIT • After-tax
Trading in multiple accounts?
Your broker may not catch wash sales across Robinhood, Fidelity, Schwab, Webull, IRAs, and options trades. Upload CSVs and check possible matches locally.
Cross-account • Options • Privacy-first
Frequently asked questions
Educational use only — not financial advice
StockLeo is for educational purposes only and does not provide financial, investment, legal, or tax advice. Calculations are estimates and may not reflect your full tax or financial situation. Consult a qualified professional before making financial decisions.