Capital gains tax on stocks applies when you sell shares for more than you paid, and the federal rate depends on how long you held them. Stock held one year or less produces a short-term gain taxed at your ordinary income rate, up to 37%. Stock held longer than one year produces a long-term gain taxed at 0%, 15%, or 20%, depending on your taxable income. A 3.8% surtax can apply on top of that for higher earners.
You Owe the Tax Only When You Sell
Paper gains don’t create a tax bill. The IRS taxes capital gains on realization, meaning you owe nothing until you actually sell the shares or exchange them for something else. Stock is treated as a capital asset, and your gain or loss is the difference between your adjusted cost basis and what you received from the sale.1Internal Revenue Service. Topic No. 409, Capital Gains and Losses
This gives you real control over timing. You can hold an appreciated stock for years without owing anything, or sell a losing position at year-end to lock in a deductible loss. Once you sell, the result belongs to that tax year whether or not you reinvest the money.
How the Holding Period Sets Your Rate
Federal law draws a hard line at one year. Stock held for one year or less produces a short-term capital gain; stock held for more than one year produces a long-term capital gain.2Office of the Law Revision Counsel. 26 USC 1222 – Other Terms Relating to Capital Gains and Losses
The clock starts the day after you buy and includes the day you sell. Buy on March 1, 2026, and the earliest sale date for long-term treatment is March 2, 2027. Selling on the one-year anniversary itself still counts as short-term.3Internal Revenue Service. Fact Sheet FS-2007-19, Reporting Capital Gains The one-day difference can move a large gain from a 15% bracket into a 32% or 37% bracket, so purchase dates matter.
Capital Gains Tax Rates for 2026
Short-Term Gains
Short-term gains get no special rate. The IRS stacks them on top of your other ordinary income and taxes them in whatever bracket they land in. For 2026, federal rates run from 10% to 37%, with a single filer hitting the top 37% bracket once taxable income exceeds $640,600.4Internal Revenue Service. IRS Releases Tax Inflation Adjustments for Tax Year 2026 If you earn $80,000 in salary and flip a stock for a $20,000 short-term gain, that gain is taxed at your marginal 22% or 24% rate.
Long-Term Gains
Long-term gains have their own three-tier rate structure. For 2026, single filers face these thresholds:5Tax Foundation. 2026 Tax Brackets and Federal Income Tax Rates
- 0% on taxable income up to $49,450
- 15% on taxable income from $49,451 through $545,500
- 20% on taxable income above $545,500
For married couples filing jointly, the 0% rate applies through $98,900, the 15% rate runs from $98,901 to $613,700, and the 20% rate begins above $613,700.5Tax Foundation. 2026 Tax Brackets and Federal Income Tax Rates Most investors with moderate income fall in the 15% bracket. The 0% rate is a real benefit for retirees and lower-income investors who can realize long-term gains without federal tax each year.
The 3.8% Net Investment Income Tax
Higher earners pay an additional 3.8% surtax on investment income, including capital gains. The Net Investment Income Tax applies when your modified adjusted gross income exceeds $200,000 for single filers or $250,000 for joint filers, and it’s assessed on the lesser of your net investment income or the amount by which your income exceeds the threshold.6Internal Revenue Service. Net Investment Income Tax These thresholds aren’t indexed for inflation.
A single filer with $270,000 in modified adjusted gross income and $90,000 in net investment income would owe the 3.8% on $70,000, the amount above the threshold, not on the full $90,000.7Internal Revenue Service. Questions and Answers on the Net Investment Income Tax A top-bracket investor selling long-term stock can effectively pay 23.8% in federal tax on the gain.
Your Cost Basis Is the Starting Point
Cost basis is what you paid for the shares, and it’s subtracted from the sale proceeds to produce your taxable gain. Basis includes the purchase price plus any commissions or transaction fees you paid to acquire the stock.8Internal Revenue Service. Publication 551, Basis of Assets Bought 100 shares at $50 with a $10 commission? Your basis is $5,010.
Corporate actions adjust basis automatically. A two-for-one split doubles your share count and halves your per-share basis, leaving the total unchanged. Reinvested dividends add to your basis, because you already paid tax on those dividends the year you received them. Skipping this step means paying tax on the same money twice when you sell.
Choosing Which Shares to Sell
If you bought the same stock at different prices over time, which shares count as sold changes your tax bill. The default is first-in, first-out: the IRS assumes the oldest shares go first.8Internal Revenue Service. Publication 551, Basis of Assets Older shares usually have a lower basis, which produces larger gains.
You can override FIFO by using specific identification: tell your broker exactly which lot to sell, and get written confirmation. If you own shares purchased at $40 and later at $70, designating the $70 shares produces a smaller gain. Most online brokerages let you pick individual tax lots before you execute the trade.
Using Losses to Cut Your Tax Bill
Capital losses offset capital gains dollar for dollar. Sell one stock for a $10,000 gain and another for a $6,000 loss, and you pay tax on $4,000. Short-term losses offset short-term gains first, long-term losses offset long-term gains first, and any leftover from either category can offset the other.
If your total losses exceed your total gains, you can deduct up to $3,000 of the excess against ordinary income each year, or $1,500 if married filing separately.1Internal Revenue Service. Topic No. 409, Capital Gains and Losses Anything left over carries forward indefinitely to offset gains or ordinary income in later years. The carryforward never expires.
The Wash Sale Rule Limits Loss Harvesting
You can’t claim a loss if you buy back the same stock, or a substantially identical security, within 30 days before or after the sale. The 61-day window exists to stop investors from selling purely for the deduction and immediately buying back in.9Office of the Law Revision Counsel. 26 USC 1091 – Loss From Wash Sales of Stock or Securities
The disallowed loss isn’t lost forever. It gets added to the basis of the replacement shares, deferring the tax benefit until you sell those new shares. Automatic dividend reinvestment in the same stock during the window can trigger a wash sale without you noticing.
The phrase “substantially identical” is where it gets murky. Buying back the exact same stock clearly triggers the rule. Buying a completely unrelated company clearly does not. Swapping one S&P 500 index fund for a near-clone from a different provider sits in a gray area the IRS hasn’t addressed with bright-line guidance, so investors harvesting losses with index funds tend to pick replacements that track a meaningfully different benchmark.
Trades Inside Retirement Accounts Don’t Count
Capital gains tax doesn’t apply to buying and selling inside a 401(k), traditional IRA, or Roth IRA. You can trade freely inside these accounts without triggering a tax event. What matters is the account type.
A traditional 401(k) or traditional IRA defers taxes until withdrawal, at which point everything comes out as ordinary income regardless of whether the underlying gains were short- or long-term. A Roth IRA works in reverse: contributions are after-tax, but qualified withdrawals in retirement, including all growth, are federally tax-free. For frequent traders, holding those positions in a tax-advantaged account eliminates the annual capital gains drag.
Reporting and Paying What You Owe
Your brokerage issues Form 1099-B for any year you sold stock, showing the proceeds and, in most cases, the cost basis for each sale. You transfer that information to Form 8949, which lists each transaction individually.10Internal Revenue Service. Instructions for Form 8949 The totals flow to Schedule D of your Form 1040, where short-term and long-term results are netted separately.11Internal Revenue Service. About Schedule D (Form 1040), Capital Gains and Losses
If you sell at a substantial gain and don’t have enough withheld from a paycheck to cover the extra tax, you may need quarterly estimated payments. For tax year 2026, the deadlines are April 15, June 15, and September 15 of 2026, and January 15, 2027.12Internal Revenue Service. When to Pay Estimated Tax You generally avoid the underpayment penalty by paying at least 90% of the current year’s tax liability through withholding and estimated payments combined.13Internal Revenue Service. Pay As You Go, So You Won’t Owe The IRS charges interest on underpayments at a rate that adjusts quarterly; for early 2026, that rate is 7%.14Internal Revenue Service. Quarterly Interest Rates
Most states also tax capital gains, generally as ordinary income, with state rates ranging from 0% in states with no income tax to over 13% in the highest-rate states. Check your state’s rules before estimating the total bite on a large sale.