Stock Sale: Cost Basis, Holding Period, and Tax Reporting

Selling stock is a two-part exercise: you place a sell order through your brokerage, and then you settle up with the IRS on the profit. How to sell stock and taxes owed on the sale come down to a few variables you control before you click the button, chiefly which shares you sell and how long you have held them. Long-term gains are taxed at 0%, 15%, or 20%; short-term gains are taxed as ordinary income at rates up to 37% in 2026.1Internal Revenue Service. Topic No. 409, Capital Gains and Losses

Placing the Sell Order

You sell shares through your brokerage platform using either a market order or a limit order. A market order executes immediately at the best price available, which works well for widely traded stocks where the price is unlikely to move much between clicking sell and the trade filling. A limit order sets the minimum price you will accept, and the sale only happens if a buyer meets it.

Trades settle on a T+1 cycle, meaning the shares and cash legally change hands one business day after the trade date.2U.S. Securities and Exchange Commission. Shortening the Securities Transaction Settlement Cycle Your proceeds show as “unsettled” until then. You can generally reinvest unsettled funds right away, but moving cash out to a bank account usually has to wait for settlement.

One surprise to watch for: if your broker doesn’t have a valid taxpayer identification number for you, or the IRS has flagged your account, 24% of your proceeds may be held back as backup withholding. That amount is credited against your taxes when you file, but it reduces what lands in your account on sale day.3Internal Revenue Service. Topic No. 307, Backup Withholding

Cost Basis and Choosing Which Shares to Sell

Your cost basis is what you originally paid for the shares, including any commissions.4Office of the Law Revision Counsel. 26 USC 1012 – Basis of Property Cost If you bought 100 shares at $50 and paid a $10 commission, your basis is $5,010. The IRS uses that number to determine your gain: sale price minus basis. Most brokerages display basis by tax lot in your positions view.

When you bought the same stock at different times and prices, which lot you sell changes what you owe. Three methods are common:

  • First-in, first-out treats your oldest shares as sold first, and it is the default if you say nothing.5Internal Revenue Service. Stocks (Options, Splits, Traders) 1
  • Specific identification lets you tell the broker exactly which lot to sell. This gives you the most control, letting you pick high-basis shares to shrink a gain, or low-basis shares in a low-income year.
  • Average cost is available only for mutual fund shares and shares from dividend reinvestment plans; you divide total cost by total shares.6Internal Revenue Service. Mutual Funds (Costs, Distributions, etc.) 1

If you want specific identification, tell the broker before or at the time of the trade. Once the sale settles, you can’t change which lot was sold.7Internal Revenue Service. Publication 551 – Basis of Assets

How Long You Held the Stock Drives the Tax Rate

The single biggest tax variable is your holding period. Shares held one year or less produce short-term capital gains, taxed as ordinary income at 10% to 37% in 2026. Shares held more than one year produce long-term capital gains, taxed at preferential rates of 0%, 15%, or 20%.8Office 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. Shares bought on January 15, 2025 need to be held until at least January 16, 2026 to qualify for long-term treatment. Which long-term rate applies depends on your total taxable income and filing status, with the 0% rate reaching up to $49,450 of taxable income for single filers and $98,900 for joint filers in 2026, and the 20% rate kicking in above roughly $545,500 single or $613,700 joint.9Tax Foundation. 2026 Tax Brackets and Federal Income Tax Rates

The gap between the two treatments is large. Someone in the 32% ordinary bracket who sells at 11 months pays close to double what they would pay by waiting one more month. On a substantial gain, that patience is worth thousands.

The 3.8% Net Investment Income Tax

Higher-income sellers owe an extra 3.8% on net investment income, including capital gains. It applies when modified adjusted gross income exceeds $200,000 single or $250,000 joint, and hits the smaller of your net investment income or the amount you are over the threshold.10Internal Revenue Service. Questions and Answers on the Net Investment Income Tax These thresholds aren’t indexed to inflation. At the top of the long-term rate schedule, the effective rate becomes 23.8%.

Selling at a Loss

If you sell for less than your basis, the loss offsets gains from other sales: short-term against short-term first, long-term against long-term first. If a net loss remains, you can deduct up to $3,000 per year against ordinary income ($1,500 if married filing separately). Anything above that carries forward indefinitely at $3,000 a year until it is used up or absorbed by future gains, and a long-term loss stays long-term when it carries.11Office of the Law Revision Counsel. 26 USC 1211 – Limitation on Capital Losses

The $3,000 cap catches people off guard. A $30,000 loss with no gains to absorb it produces a $3,000 deduction this year and $27,000 carried forward.

The Wash Sale Rule

You cannot sell at a loss and buy the same stock right back to claim the deduction. If you repurchase substantially identical shares within 30 days before or after the sale, the loss is disallowed, giving you a 61-day window to steer clear of.12Office of the Law Revision Counsel. 26 USC 1091 – Loss From Wash Sales of Stock or Securities

The loss is not erased. It attaches to the basis of the replacement shares, delaying the tax benefit until you eventually sell those without triggering another wash sale. Sell shares at a $250 loss and buy replacements for $800, and your new basis is $1,050.13Internal Revenue Service. Wash Sales The rule reaches further than most people expect: buying in a different account, having a dividend reinvestment run during the window, or picking up a call option on the same stock can all trip it.

Reporting the Sale on Your Return

Your broker sends you and the IRS a Form 1099-B listing each sale. The statute requires the statement by February 15.14Office of the Law Revision Counsel. 26 USC 6045 – Returns of Brokers You report each transaction on Form 8949, and the totals flow to Schedule D, which nets your short-term and long-term results.

For shares bought on or after January 1, 2011, brokers report cost basis to the IRS directly (these are called covered shares). For older lots, the broker sends basis only to you, and getting it right is on you. If the 1099-B shows no basis on an old position, dig up your purchase records; reporting zero basis means being taxed on the full sale price as if it were all profit.

The IRS matches your return against the 1099-B automatically, and mismatches generate notices. A substantial understatement can add a 20% accuracy penalty on top of the tax.15Office of the Law Revision Counsel. 26 USC 6662 – Imposition of Accuracy-Related Penalty on Underpayments If the broker’s numbers are wrong, correct them on Form 8949 rather than accepting them as filed.

Estimated Tax After a Big Gain

Nothing is withheld from a normal stock sale, so a large gain mid-year can leave you underpaid. You generally owe estimated tax if you expect to owe at least $1,000 at filing and your withholding won’t cover at least 90% of this year’s liability or 100% of last year’s (110% if last year’s AGI exceeded $150,000).16Internal Revenue Service. Large Gains, Lump Sum Distributions, Etc.

The cleanest fixes are making an estimated payment in the quarter you took the gain, or bumping up wage withholding for the rest of the year to close the gap.17Internal Revenue Service. Underpayment of Estimated Tax by Individuals Penalty A $100,000 long-term gain at 15% is $15,000 in federal tax, and the IRS expects at least a portion of that during the year.

Sales Inside a Retirement Account Work Differently

If you are selling shares held inside a traditional IRA, 401(k), or similar account, none of the capital gains rules above apply. The sale itself is not taxed, and holding period doesn’t matter. Tax comes later, at ordinary income rates, when you withdraw from the account. Qualified withdrawals from Roth accounts are tax-free, since you funded them with after-tax dollars. The rest of this article is about sales in taxable brokerage accounts.

Don’t Forget State Tax

Most states tax capital gains as ordinary income. State rates run from 0% in no-income-tax states to above 13% at the top. A few states treat capital gains specially, but the common pattern is simple: your gain gets added to state taxable income and taxed at the same rate as wages. Add your state rate to the federal number to see the real tax bill on a sale.