When you sell stock, the profit is taxed as a capital gain at a federal rate between 0% and 37%, and how stock is taxed when you sell comes down to two things: how long you owned the shares and how much total income you have for the year. Shares held more than one year get preferential long-term rates of 0%, 15%, or 20%. Shares held a year or less are taxed at your ordinary income rate. The taxable amount is the difference between what you received and what you originally paid, and losses on other stocks can reduce the bill.
Short-Term vs. Long-Term Rates
The holding period is the single biggest factor. A stock held for one year or less produces a short-term capital gain; a stock held for more than one year produces a long-term capital gain.1Office of the Law Revision Counsel. 26 USC 1222 – Other Terms Relating to Capital Gains and Losses
Short-term gains get stacked on top of your wages and other income and taxed at your ordinary rate. For 2026, those rates run from 10% to 37%.2Internal Revenue Service. IRS Releases Tax Inflation Adjustments for Tax Year 2026 Selling a stock a week before your one-year anniversary can therefore cost significantly more than selling a week after.
Long-term gains get their own set of brackets. For 2026:3Internal Revenue Service. Revenue Procedure 2025-32
- 0% on taxable income up to $49,450 single, $98,900 married filing jointly, $66,200 head of household, or $49,450 married filing separately.
- 15% above those thresholds up to $545,500 single, $613,700 married filing jointly, $579,600 head of household, or $306,850 married filing separately.
- 20% on amounts above the 15% ceiling for your filing status.
These thresholds look at your total taxable income, not just investment income. A retiree with modest wages and a large long-term gain can still fall inside the 0% bracket if the combined figure stays below the cutoff.
High earners owe an extra 3.8% net investment income tax on capital gains once modified adjusted gross income passes $200,000 single or $250,000 married filing jointly.4Internal Revenue Service. Net Investment Income Tax
Figuring the Taxable Amount
Your gain is the sale proceeds minus your cost basis. Cost basis is what you originally paid, including any commissions or fees on the purchase.5Internal Revenue Service. Publication 551 – Basis of Assets Buy 100 shares at $50 with a $10 commission and your basis is $5,010.
On the sale side, subtract any selling fees from the proceeds to get your “amount realized.” Sell those 100 shares for $6,000 with a $10 fee and you realized $5,990. The taxable gain is $980.
Reinvested dividends raise your basis. If dividends bought you an additional $400 in shares over time, that $400 adds to your total basis and reduces the gain you’ll be taxed on later.5Internal Revenue Service. Publication 551 – Basis of Assets Forgetting to include reinvested dividends is one of the most common ways people overpay.
Inherited and Gifted Shares
Shares you didn’t buy follow different basis rules.
Inherited stock generally gets a “step-up” to the fair market value on the date the previous owner died.6Office of the Law Revision Counsel. 26 USC 1014 – Basis of Property Acquired From a Decedent A parent who bought shares for $10,000 that were worth $80,000 at death leaves an heir with an $80,000 basis. Selling soon after for $82,000 produces only a $2,000 gain. Inherited shares also count as long-term automatically, no matter how briefly you actually held them.
Gifted stock is different. You take the donor’s original basis.7Internal Revenue Service. Property (Basis, Sale of Home, etc.) Shares bought by the donor for $5,000 and gifted to you when worth $15,000 give you a $5,000 basis and a $10,000 gain if you sell at $15,000. If the shares had dropped below the donor’s basis by the time of the gift, a split rule applies: use the donor’s basis to figure a gain, use the lower gift-date value to figure a loss, and if the sale price falls between the two, there is no gain or loss.
Picking Which Shares to Sell
Buy the same stock over years and you’ll have lots at different prices. Which lot you sell changes the tax. The default is first in, first out, meaning your broker treats the oldest shares as sold first.8Internal Revenue Service. Stocks (Options, Splits, Traders) 3 Those are often the cheapest, which means the largest gain.
You can instead specifically identify which lot to sell — the shares you paid the most for, for example — to shrink the reported gain. You have to make the choice at the time of sale and keep records.9Internal Revenue Service. Stocks (Options, Splits, Traders) 1 Most online brokerages let you pick lots before you click sell.
Using Losses to Reduce the Bill
Losing trades can cancel out winners. Net short-term losses against short-term gains and long-term against long-term first. Anything left over crosses categories.10Internal Revenue Service. Topic No. 409, Capital Gains and Losses
If total losses exceed total gains, up to $3,000 of the excess can be deducted against ordinary income like wages ($1,500 if married filing separately).11Office of the Law Revision Counsel. 26 USC 1211 – Limitation on Capital Losses Whatever remains carries forward to future years, offsetting future gains or another $3,000 of ordinary income each year until it’s used up.10Internal Revenue Service. Topic No. 409, Capital Gains and Losses
Watch the Wash Sale Rule
You can’t sell a stock at a loss and claim the deduction if you buy the same or a substantially identical security within 30 days before or after the sale.12Office of the Law Revision Counsel. 26 USC 1091 – Loss From Wash Sales of Stock or Securities The window runs both directions, so buying replacements in late November and selling the originals in early December still triggers it. Options and contracts to buy the same stock count too.
A disallowed loss isn’t gone forever. It gets added to the basis of the replacement shares, so you recover it when you eventually sell those.13Internal Revenue Service. Capital Gain or Loss Workout – Wash Sales A $250 disallowed loss on shares you rebought for $800 gives those replacement shares a $1,050 basis.
The Account Type Changes Everything
Where the stock lives matters as much as how long you held it.
In a regular taxable brokerage account, every profitable sale creates a tax bill for that year, even if you reinvest every dollar and take nothing out.
Inside a traditional IRA or 401(k), sales don’t create current tax. You pay ordinary income tax when you eventually withdraw, and withdrawing before 59½ generally adds a 10% penalty.14Internal Revenue Service. Traditional and Roth IRAs One catch: everything comes out as ordinary income, so long-term capital gain rates never apply to money held in these accounts.
Roth IRAs and Roth 401(k)s give the best result. Sales inside the account trigger no tax, and qualified withdrawals — generally those after 59½ and at least five years after the account was opened — are tax-free.14Internal Revenue Service. Traditional and Roth IRAs
Some HSAs also allow stock investments. Gains grow tax-free, and withdrawals for qualified medical expenses aren’t taxed. Non-medical withdrawals before 65 are taxed as ordinary income plus a 20% penalty.15Internal Revenue Service. Publication 969, Health Savings Accounts and Other Tax-Favored Health Plans
Reporting and Paying
Your broker sends Form 1099-B by February 15, listing every sale, the acquisition and sale dates, the proceeds, and (for shares bought after certain cutoff dates) the cost basis. The IRS gets a copy, so your return needs to match.
The transactions go on Form 8949, which separates short-term from long-term.16Internal Revenue Service. Instructions for Form 8949 If the basis reported by your broker is wrong — often because reinvested dividends or a wash sale adjustment weren’t captured — you enter a correction on that form. The totals flow to Schedule D of your Form 1040.17Internal Revenue Service. About Form 8949, Sales and Other Dispositions of Capital Assets
A large gain during the year can leave your paycheck withholding short. The IRS generally expects estimated tax payments if you’ll owe at least $1,000 after withholding.18Internal Revenue Service. Form 1040-ES – Estimated Tax for Individuals Underpayment triggers a penalty that accrues interest at a rate the IRS resets quarterly, 7% as of early 2026.19Internal Revenue Service. Quarterly Interest Rates You avoid the penalty entirely by paying at least 90% of the current year’s tax through withholding and estimates, or 100% of last year’s total (110% if your prior-year AGI was over $150,000, or $75,000 married filing separately).
Don’t Forget State Tax
Federal tax is only part of it. Most states tax capital gains as ordinary income, so the combined bite depends on where you live. State rates on investment income range from 0% in states with no income tax to over 13% in the highest-tax states, and a few states treat gains differently from wages. Check with your state revenue department before you count the check.