The tax treatment of stock sales depends on several factors: how long you held the shares, your income level, the type of account the stock is held in and whether you are selling at a gain or a loss. Each of these variables affects how much of your proceeds you actually keep. The difference between short-term and long-term capital gains rates can amount to thousands of dollars on a single transaction, which makes it worth thinking through the tax implications before you sell.
If you want to manage the tax impact of selling stock, a financial advisor can help you think through the timing and tax implications before you sell.
When Do You Pay Taxes on Sold Stock?
Taxes apply only when gains are realized, meaning you actually sell the stock and lock in a profit. As long as you continue holding shares you owe no taxes as they increase in value. This is the fundamental difference between realized and unrealized gains.
An unrealized gain exists when a stock you own has increased in value but you have not sold it. For example, if you bought shares at $50 and they are now worth $100, you have a $50 unrealized gain per share.
A realized gain occurs when you sell the stock. Using the same example, if you sell your shares at $100 after buying them at $50, you have realized a $50 gain per share. This is when the IRS requires you to report the transaction and potentially pay capital gains taxes.
Selling at a Gain vs. a Loss
If you sell stock for more than you paid, you have a capital gain and may owe taxes. If you sell for less than you paid, you have a capital loss. This can offset other capital gains and reduce your tax liability. Losses can even offset up to $3,000 of ordinary income per year. Any remaining losses get carried forward to future tax years.
Taxable vs. Tax-Advantaged Accounts
The type of account where you hold stock dramatically affects whether you owe taxes when you sell:
- Taxable brokerage accounts: Sales trigger capital gains taxes in the year you sell. This applies whether you reinvest the proceeds or withdraw them.
- Traditional IRA or 401(k): Sales inside these accounts do not trigger immediate taxes. You can buy and sell freely without tax consequences until you withdraw money. Then the IRS taxes withdrawals as ordinary income.
- Roth IRA or Roth 401(k): Sales inside Roth accounts are not taxed. Qualified withdrawals are also tax-free, making Roth accounts the most tax-efficient for stock trading.
It’s important to note that dividends are taxed separately from capital gains. Qualified dividends receive preferential tax rates similar to long-term capital gains, while non-qualified dividends are taxed as ordinary income. You owe taxes on dividends even if you reinvest them automatically.
Meanwhile, employee stock compensation creates more complex tax situations. Restricted stock units (RSUs) are taxed as ordinary income when they vest. Stock options can be taxed at exercise (for non-qualified stock options) or at sale (for incentive stock options), depending on the type and how they are handled.
Capital Gains Tax Rates: Short-Term vs. Long-Term
The length of time you hold stock before selling is crucial. This timeframe determines whether the IRS taxes your gain at short-term or long-term capital gains rates. If you hold stock for one year or less before selling, any gain is classified as short-term. It gets taxed at your ordinary income tax rate. The table below breaks down 2026 short-term capital gains tax rates by fling status bracket 1 :
| Rate | Single Filers | Married Filing Jointly |
|---|---|---|
| 10% | Up to $12,400 | Up to $24,800 |
| 12% | $12,401 – $50,400 | $24,801 – $100,800 |
| 22% | $50,401 – $105,700 | $100,801 – $211,400 |
| 24% | $105,701 – $201,775 | $211,401 – $403,550 |
| 32% | $201,776 – $256,225 | $403,551 – $512,450 |
| 35% | $256,226 – $640,600 | $512,451 – $768,700 |
| 37% | Above $640,600 | Above $768,700 |
Keeping the table in mind, for someone in the 24% tax bracket, a $10,000 short-term gain results in $2,400 in federal taxes. But, if you sell stock after holding for more than one year, the gain qualifies for preferential long-term capital gains tax rates. And these rates are significantly lower than ordinary income rates.
2026 Federal Long-Term Capital Gains Tax Rates
For 2026, the long-term capital gains tax rates are 0%, 15%, or 20%. Your rate depends on your taxable income and filing status 2 . The table below breaks down 2026 long-term capital gains tax rates by filing status bracket:
| Rate | Single Filers | Married Filing Jointly |
|---|---|---|
| 0% | Up to $49,450 | Up to $98,900 |
| 15% | $49,451 – $545,500 | $98,901 – $613,700 |
| 20% | $545,501+ | $613,701+ |
Keep in mind that most states tax capital gains as ordinary income. This adds another layer of taxation on top of federal rates.
How to Calculate Taxes When You Sell Stock

Calculating your tax liability from a stock sale requires determining your capital gain or loss. This depends on accurately establishing your cost basis.
Basic Formula
- Capital gain or loss = Sale price – Cost basis
If you bought 100 shares of stock at $50 per share and sold them at $80 per share, your calculation would be:
- Sale price: 100 shares × $80 = $8,000
- Cost basis: 100 shares × $50 = $5,000
- Capital gain: $8,000 – $5,000 = $3,000
What Counts in Cost Basis
Your cost basis is not always simply the purchase price. Several factors can affect it:
- Purchase price: The amount you paid per share when you bought the stock
- Commissions and fees: Trading fees, commissions, and other costs associated with buying the stock can be added to your cost basis, reducing your taxable gain
- Reinvested dividends: If you automatically reinvest dividends to purchase additional shares, each reinvestment creates a new cost basis for those shares at the price they were purchased
Reporting Your Stock Sales
Your brokerage will send you Form 1099-B after the end of the tax year. It reports all stock sales and the proceeds from each transaction. Many brokerages now also report cost basis information directly to the IRS, though you should verify this information is accurate.
You report capital gains and losses on Schedule D of your tax return. This calculates your net capital gain or loss for the year. Short-term and long-term gains are reported separately because they are taxed at different rates.
Strategies to Reduce Taxes on Stock Sales
Strategic planning can significantly reduce the taxes you pay when selling stock. These approaches range from simple timing decisions to more sophisticated tax-loss harvesting techniques. Here are seven to consider.
Hold Your Stock
The simplest strategy is to hold stocks for a year. The difference between selling with short-term rates (up to 37% plus state taxes) versus long-term rates (0%, 15%, or 20%) can be substantial. For someone in the 32% federal tax bracket, crossing the one-year threshold can save 17 percentage points in federal taxes alone.
Tax-Loss Harvesting
Sell losing positions to realize capital losses that offset capital gains from winning positions. This is called tax-loss harvesting. If you have $15,000 in gains from one stock and $8,000 in losses from another, sell both. If sell them in the same year you only pay taxes on $7,000 of net gains. You can also use up to $3,000 of excess losses to offset ordinary income each year, too.
Sell When Income Is Low
If you expect your income to be unusually low in a particular year, consider realizing gains during that period as your tax bracket may be lower. This works great when you are between jobs, in early retirement before claiming Social Security, or during a sabbatical. You may even fall into the 0% long-term capital gains bracket.
Charitable Donation
Donating appreciated stock directly to a qualified charity can lower your tax liability. It allows you to deduct the full fair market value of the shares without ever paying capital gains taxes. If you bought stock for $10,000 and it is now worth $30,000, donating it gives you a $30,000 charitable deduction without recognizing the $20,000 gain. This provides greater tax efficiency than selling the stock, paying taxes on the gain, and donating the after-tax proceeds.
Gift Stock to Family
Gifting appreciated stock to family members in lower tax brackets (such as adult children or retired parents) can reduce the overall family tax bill when they sell the shares. However, be aware of gift tax rules and the kiddie tax for children under 19.
Tax-Advantaged Accounts
Hold stocks you plan to trade frequently in tax-advantaged accounts like IRAs where you can buy and sell without triggering capital gains taxes. Keep buy-and-hold positions in taxable accounts where you can benefit from long-term capital gains rates and eventually receive a step-up in basis if you hold them until death.
Year-End Tax Planning
Review your portfolio in November and December to assess your capital gains and losses for the year. If you have significant gains, consider harvesting losses to offset them before year-end. If you have losses, you might realize some gains to use up those losses without increasing your tax bill.
Common Mistakes and What Investors Should Watch
Even experienced investors make tax mistakes when selling stock. Avoiding these common errors can save thousands of dollars and prevent unintended tax consequences. Here are six things to watch out for.
Don’t Sell Too Early
Many investors sell profitable positions just shy of the one-year mark, inadvertently triggering short-term capital gains rates that can be more than double the long-term rate. If you are close to the one-year anniversary of a purchase, waiting a few extra days or weeks can result in substantial tax savings.
Cost Basis Adjustments
Failing to adjust your cost basis for stock splits, reinvested dividends, or return of capital distributions can result in overpaying taxes. Keep detailed records and verify the cost basis information your brokerage reports, especially for shares held for many years or transferred between brokerages.
State Taxes and NIIT
Many investors focus only on federal capital gains rates and forget that state taxes and the 3.8% Net Investment Income Tax can add significantly to the total tax bill. A high-income California resident could pay federal tax of 20%, state tax of 13.3%, and NIIT of 3.8%, for a combined rate exceeding 37% on long-term gains.
The Wash Sale Rule
Selling a stock to harvest a tax loss and then immediately buying it back triggers the wash sale rule, which disallows the loss. This mistake is especially common with investors who use automatic dividend reinvestment or who buy the same stock across multiple accounts without coordinating purchases and sales.
Taxes Over Returns
While tax efficiency is important, it should not be the sole driver of investment decisions. Holding a losing position simply to avoid realizing a gain, or refusing to rebalance your portfolio due to tax concerns, can result in poor investment outcomes that cost far more than the taxes saved. Taxes are a consideration, but not the primary factor in sound investing.
Long-Term Consequences
Selling stock without considering your other income for the year can push you into a higher tax bracket or trigger phase-outs of deductions and credits. Large capital gains can affect Medicare premiums, the taxation of Social Security benefits, and eligibility for certain tax benefits.
Bottom Line

The tax consequences of selling stock depend on how long you held the shares, what you paid for them, which account they are held in and where your total income lands for the year. Short-term gains are taxed as ordinary income, while long-term gains qualify for lower preferential rates. The difference between the two can be substantial: a single sale of appreciated stock could be taxed at anywhere from 0% to 37% depending on those variables. Strategic decisions around timing, tax-loss harvesting and account type can meaningfully affect what you actually keep after a sale.
Investment Planning Tips
- A financial advisor can help you develop tax-efficient strategies for managing your portfolio to minimize investment taxes. Finding a financial advisor doesn’t have to be hard. SmartAsset’s free tool matches you with vetted financial advisors who serve your area, and you can have a free introductory call with your advisor matches to decide which one you feel is right for you. If you’re ready to find an advisor who can help you achieve your financial goals, get started now.
- If you want to diversify your portfolio, here’s a roundup of 13 investments to consider.
- If you want to know how much your next tax refund or balance could be, SmartAsset’s tax return calculator can help you get an estimate.
Photo credit: ©iStock.com/Sergey_P, ©iStock.com/Maximusnd, ©iStock.com/Marco_Bonfanti
Article Sources
All articles are reviewed and updated by SmartAsset’s fact-checkers for accuracy. Visit our Editorial Policy for more details on our overall journalistic standards.
- “IRS Releases Tax Inflation Adjustments for Tax Year 2026, Including Amendments from the One, Big, Beautiful Bill | Internal Revenue Service.” Home, https://www.irs.gov/newsroom/irs-releases-tax-inflation-adjustments-for-tax-year-2026-including-amendments-from-the-one-big-beautiful-bill. Accessed May 8, 2026.
- 26 CFR 601.602: Tax Forms and Instructions. https://www.irs.gov/pub/irs-drop/rp-25-32.pdf. Accessed May 8, 2026.
