Tax on Stock Gains: How Selling Stocks Is Taxed (2025–2026)
Learn how stock gains are taxed, including short-term vs long-term rates, cost basis methods, wash sale rules, and strategies to reduce your stock tax bill.
Tax on stock gains ranges from 0% to 37% depending on how long you held the shares. Stocks held over one year qualify for long-term capital gains rates of 0%, 15%, or 20%, while stocks sold within a year are taxed at your ordinary income rate. If you are selling real estate instead, see our capital gains tax on real estate guide. Below we cover how stock gains are taxed, cost basis methods, and strategies to keep more of your profits.
Key Takeaways
- You only owe tax when you sell — unrealized gains are not taxed.
- Short-term gains (held 1 year or less) are taxed at ordinary income rates up to 37%.
- Long-term gains (held more than 1 year) are taxed at 0%, 15%, or 20%.
- Your cost basis method (FIFO vs specific ID) directly affects how much you owe.
- The wash sale rule blocks you from harvesting a loss if you repurchase within 30 days.
Short-Term vs Long-Term: The Holding Period Rule
The single biggest factor in your stock tax bill is how long you held the shares before selling.
| Holding Period | Tax Treatment | 2025–2026 Rates |
|---|---|---|
| 1 year or less | Short-term (ordinary income) | 10% – 37% |
| More than 1 year | Long-term (preferential) | 0%, 15%, or 20% |
For the full bracket thresholds by filing status, see our capital gains tax rates guide.
The one-day difference matters. If you buy stock on March 1, 2025 and sell on March 1, 2026 — that is exactly one year, which counts as short-term. You need to sell on March 2, 2026 or later to qualify for long-term treatment.
How Gains Stack on Your Income
Capital gains do not get their own separate tax calculation. Long-term gains stack on top of your ordinary income to determine which capital gains bracket applies. If your wages and other ordinary income partially fill the 0% bracket, only the remaining room qualifies for the 0% rate — the rest spills into 15% or 20%.
For a detailed example of how stacking works, see how capital gains stack on income.
Cost Basis: The Key to Calculating Your Gain
Your taxable gain equals the sale price minus your cost basis. Cost basis is what you originally paid for the shares, including any commissions or fees.
If you purchased shares at different times and prices, the cost basis method you choose determines which shares are considered “sold” first:
FIFO (First In, First Out) — The default method. Your earliest purchased shares are sold first. In a rising market, FIFO typically produces the largest gain because those oldest shares have the lowest cost basis.
Specific Identification — You choose exactly which shares to sell. This gives you the most control. You can select high-cost-basis shares to minimize your gain, or select shares held longer than one year to qualify for long-term treatment.
Average Cost — Available only for mutual fund shares. Your basis is the average price of all shares you own.
Most brokerages let you set your default method and select specific lots at the time of sale. Check your brokerage settings — switching to specific identification before you sell can save you significant tax.
Worked Example: Selling 100 Shares
Suppose you bought shares of a stock over time:
| Purchase Date | Shares | Price Per Share | Cost Basis |
|---|---|---|---|
| Jan 2024 | 50 | $80 | $4,000 |
| Aug 2024 | 30 | $100 | $3,000 |
| Jun 2025 | 20 | $120 | $2,400 |
You sell all 100 shares in April 2026 at $140/share for $14,000 total proceeds.
Using FIFO: Gain = $14,000 - $9,400 = $4,600. The 50 shares from Jan 2024 (held > 1 year) get long-term rates. The 30 shares from Aug 2024 (held > 1 year) also get long-term rates. The 20 shares from Jun 2025 (held < 1 year) get short-term rates.
Using Specific ID: If you wanted to minimize tax, you could sell the 20 highest-cost shares first, realizing a smaller gain on those lots.
The Wash Sale Rule
If you sell stock at a loss to harvest a tax deduction, the IRS disallows the loss if you buy a “substantially identical” security within 30 days before or after the sale. This 61-day window (30 days before + sale day + 30 days after) is the wash sale rule.
Key points:
- The disallowed loss is not gone forever — it gets added to the cost basis of the replacement shares.
- The rule applies across all your accounts, including IRAs.
- Buying a similar but not identical ETF (e.g., switching from one S&P 500 fund to another total market fund) is a common workaround, though the IRS has not defined “substantially identical” precisely.
The 3.8% Net Investment Income Tax
High earners may owe an additional 3.8% on stock gains under the Net Investment Income Tax (NIIT) when modified AGI exceeds $200,000 (Single) or $250,000 (Married Filing Jointly). This pushes the top effective rate on long-term stock gains to 23.8%.
Tax Forms for Stock Sales
When you sell stock, your brokerage sends you a 1099-B reporting proceeds and cost basis. You report the transactions on:
- Form 8949 — Individual transaction detail (each sale)
- Schedule D — Summary of all capital gains and losses
- Schedule B — If you received dividends or interest from the same holdings
Review your 1099-B carefully. Brokerages sometimes report incorrect cost basis, especially for ESPP shares, RSUs, or shares transferred between brokers.
Strategies to Reduce Tax on Stock Gains
- Hold for more than one year. The simplest move: qualify for the lower long-term rate.
- Use specific identification. Select high-basis lots to minimize your taxable gain.
- Tax loss harvest. Offset gains with losses from other positions. You can also carry forward $3,000 in net losses against ordinary income.
- Harvest gains at 0%. During low-income years (sabbatical, early retirement, career change), you may fall into the 0% capital gains bracket.
- Use tax-advantaged accounts. Gains inside a Roth IRA or 401(k) are tax-free or tax-deferred.
- Donate appreciated stock to charity to avoid gains entirely and get a charitable deduction.
How sharper.tax Helps
sharper.tax analyzes your tax return to identify capital gains on stock sales, calculate your effective rate, and model strategies like tax loss harvesting and asset location against your real numbers. The tax code is complicated, but better tools have leveled the playing field — we make sophisticated stock tax planning available for free.
Sources
- IRS Topic 409: Capital Gains and Losses
- IRS Publication 550: Investment Income and Expenses
- IRS Publication 551: Basis of Assets
- IRS: About Form 8949
The information above is educational and not tax advice.