To report a sale of stock on your tax return, list each transaction on Form 8949, then carry the totals to Schedule D, which flows to Line 7 of your Form 1040. Your taxable gain or loss on each sale is the proceeds minus your cost basis, and the rate you pay depends on whether you held the shares for one year or less (short-term, taxed as ordinary income) or more than one year (long-term, taxed at preferential rates).{1Internal Revenue Service. About Form 8949, Sales and Other Dispositions of Capital Assets} The mechanics are straightforward. The details that trip people up almost always involve cost basis.
Calculate the Gain or Loss on Each Sale
Start with the proceeds. Your broker reports gross proceeds from every sale on Form 1099-B, which is the total cash the sale generated.{2Internal Revenue Service. Instructions for Form 1099-B (2026)} Subtract any selling costs like commissions that weren’t already netted out, and you have your net proceeds.
Then subtract your cost basis. Basis is what the shares cost you originally, adjusted for reinvested dividends, stock splits, and purchase commissions. A positive result is a capital gain. A negative result is a capital loss. You run this calculation separately for every lot you sold during the year.
If you bought the same stock at different prices over time and sold only part of the position, which shares count as sold matters. Unless you told your broker otherwise before the trade settled, the broker used First-In, First-Out and treated the oldest shares as sold first.{3Internal Revenue Service. Stocks (Options, Splits, Traders) 3} At tax time, use whatever lot identification the broker actually applied to the trade. That’s what the 1099-B reflects, and it’s what your return has to match.
Read Your Form 1099-B Carefully
Your brokerage sends Form 1099-B for every stock sale in a taxable account, usually as part of a consolidated tax statement arriving by mid-February. The form shows gross proceeds, the sale date, and the acquisition date. For stock purchased in 2011 or later, brokers are also required to report cost basis to you and to the IRS.{4Internal Revenue Service. IRS Issues Final Regulations on New Basis Reporting Requirement} Those are “covered” securities.
Stock purchased before 2011 is “non-covered.” The broker wasn’t required to track basis, so the cost basis box may be blank. You still have to calculate and report the correct basis using your own trade confirmations, old statements, or reinvested dividend records. If the IRS questions the number, the burden of proof is on you.
Check the reported figures against your own records before you file. Acquisition dates and basis figures can be wrong, especially after mergers, spin-offs, or a transfer of shares between brokers. If something looks off, contact the broker for a corrected form rather than filing what you know is inaccurate.
Fill Out Form 8949
Form 8949 is where every individual sale gets listed. Part I is for short-term transactions (stock held one year or less). Part II is for long-term transactions (held more than one year).
Within each part, check the box that matches your 1099-B:
- Box A (short-term) or Box D (long-term): basis was reported to the IRS.
- Box B or E: proceeds reported, but basis was not.
- Box C or F: no 1099-B was issued.
For each sale, enter the stock name, the date acquired, the date sold, the proceeds, and the cost basis. Subtract basis from proceeds to get the gain or loss in the final column.
If the 1099-B has an error you need to correct, or if you’re claiming an adjustment, use column (f) for the code and column (g) for the dollar amount. The codes that come up most often on stock sales:{5Internal Revenue Service. 2025 Instructions for Form 8949}
- Code B: the basis on your 1099-B is wrong. Enter the reported basis in column (e) and the correction in column (g).
- Code W: a wash sale loss that isn’t deductible. Enter the disallowed loss as a positive number in column (g), which reduces or wipes out the loss.
- Code E: selling expenses not already reflected on the 1099-B. Enter as a negative number in column (g).
Anyone who sold shares acquired through an employer compensation plan will likely need Code B. The reason is worth its own section below.
Total Everything on Schedule D
Once every transaction sits on Form 8949, total the columns for short-term and long-term separately and transfer those totals to Schedule D.{6Internal Revenue Service. About Schedule D (Form 1040), Capital Gains and Losses} Schedule D combines your net short-term result with your net long-term result into a single capital gain or loss figure, which then moves to Line 7 of Form 1040 and feeds into your adjusted gross income.{7Internal Revenue Service. 2025 Schedule D (Form 1040) – Capital Gains and Losses}
If your only capital gains for the year came from distributions on a 1099-DIV (with no actual sales), you may be able to skip Form 8949 entirely and use the worksheet in the Schedule D instructions. Any actual stock sale, though, requires both forms.
Short-Term Versus Long-Term Rates
The holding period is the biggest factor in what you’ll owe. Federal law draws the line at one year: shares held one year or less produce a short-term gain, and shares held more than one year produce a long-term gain.{8Office of the Law Revision Counsel. 26 USC 1222 – Definitions}
Short-term gains are taxed at your ordinary income rate. For 2026, that ranges up to 37%, which hits single filers above $640,600 in taxable income and married joint filers above $768,700.{9Internal Revenue Service. IRS Releases Tax Inflation Adjustments for Tax Year 2026} Even mid-bracket filers pay 22% or 24% on short-term stock gains.
Long-term gains get preferential rates of 0%, 15%, or 20% depending on your taxable income and filing status.{10Internal Revenue Service. Topic No. 409, Capital Gains and Losses} The 2026 brackets:
- 0% rate: taxable income up to $49,450 (single), $98,900 (married filing jointly), or $66,200 (head of household).
- 15% rate: taxable income above the 0% threshold up to $545,500 (single), $613,700 (married filing jointly), or $579,600 (head of household).
- 20% rate: taxable income above the 15% threshold.
The gap is real. On a $50,000 gain, the difference between selling a day short of a year and a day past it can be 24% versus 15%.
The 3.8% Net Investment Income Tax
High earners owe an additional 3.8% Net Investment Income Tax on top of the regular capital gains rate. NIIT applies to the lesser of your net investment income or the amount by which your modified adjusted gross income exceeds a filing-status threshold: $200,000 for single filers, $250,000 for married filing jointly, or $125,000 for married filing separately.{11Internal Revenue Service. Net Investment Income Tax} These thresholds are not indexed for inflation and haven’t changed since 2013. A married couple filing jointly with $300,000 of modified AGI pays NIIT on $50,000 of investment income, not the entire amount.{12Internal Revenue Service. Questions and Answers on the Net Investment Income Tax}
Capital Losses and the Wash Sale Rule
Losses offset gains dollar for dollar. Short-term losses first offset short-term gains, long-term losses first offset long-term gains, and any leftover of either kind crosses over to offset the other. If you still have a net loss after all that netting, you can deduct up to $3,000 of it against ordinary income ($1,500 if married filing separately).{13Office of the Law Revision Counsel. 26 USC 1211 – Limitation on Capital Losses}
Anything past the $3,000 cap carries forward indefinitely. The carryover keeps its short-term or long-term character and can offset gains or ordinary income in later years.{14Office of the Law Revision Counsel. 26 USC 1212 – Capital Loss Carrybacks and Carryovers} A large realized loss may take years to use up, but it doesn’t expire.
Watch out for the wash sale rule. If you sell stock at a loss and buy the same or substantially identical security within 30 days before or after the sale, the IRS disallows the loss.{15Office of the Law Revision Counsel. 26 USC 1091 – Loss From Wash Sales of Stock or Securities} The disallowed amount isn’t gone forever. It gets added to the basis of the replacement shares, which defers the deduction until you eventually sell those shares without triggering another wash sale. The 30-day window applies both ways, so a repurchase shortly before the loss sale counts too. On Form 8949, flag the disallowed portion with Code W.
Inherited, Gifted, and Employer Stock Have Different Basis Rules
Most reporting mistakes involve cost basis, and three situations produce the majority of the trouble.
Inherited Stock
When you inherit stock, your basis is the fair market value on the date the previous owner died.{16Office of the Law Revision Counsel. 26 USC 1014 – Basis of Property Acquired From a Decedent} If the decedent bought at $10 and it was worth $80 at death, your basis is $80. All the gain that accumulated during their lifetime disappears. If the estate’s executor elected an alternate valuation date six months after death, use the value on that date.
Inherited stock is always long-term, no matter how briefly you actually hold it. Sell it a week after receiving the shares and the preferential long-term rate still applies.
Gifted Stock
Stock received as a gift carries over the donor’s original basis.{17Office of the Law Revision Counsel. 26 USC 1015 – Basis of Property Acquired by Gifts and Transfers in Trust} If a parent bought for $5,000 and gifted the stock to you when it was worth $20,000, your basis for calculating a gain is $5,000. You also inherit the donor’s holding period, so their years count toward yours.{18Office of the Law Revision Counsel. 26 USC 1223 – Holding Period of Property}
If the stock had declined below the donor’s basis at the time of the gift, a special rule kicks in: use the donor’s basis to calculate a gain, but the lower fair market value at the time of the gift to calculate a loss. Sell somewhere between those two numbers and you have neither a gain nor a loss.{19Internal Revenue Service. Property (Basis, Sale of Home, Etc.)}
Stock From an Employer Plan
If you sold stock acquired through an employer compensation plan, the basis on your 1099-B is probably wrong from a tax standpoint. Brokers typically report only the exercise price or grant price and leave out the amount you already recognized as ordinary income when the shares vested or the option was exercised.{20Internal Revenue Service. Instructions for Form 8949}
For non-qualified stock options, the spread between the exercise price and the market price at exercise was included in your W-2 wages. Add it to your basis on Form 8949, or you’ll pay tax on it twice. Restricted stock units work the same way: the full market value at vesting was already taxed as ordinary income, so that value is your basis.
Incentive stock options are more complicated. If you held the shares long enough to satisfy both the two-year and one-year holding requirements, the gain above your exercise price qualifies for long-term capital gains rates. Sell earlier (a disqualifying disposition), and part of the gain is taxed as ordinary income. Either way, use Code B on Form 8949 to adjust basis for the income already recognized. Your employer’s stock plan administrator should provide a supplemental statement showing the amount included on your W-2.
If the Gain Is Large, Think About Estimated Tax
Regular paycheck withholding usually won’t cover the tax on a large realized gain. The IRS expects payment as you go, and waiting until April can trigger an underpayment penalty.
You generally owe estimated tax if you expect to owe $1,000 or more after withholding and refundable credits, and your withholding will cover less than the smaller of 90% of your current-year tax or 100% of your prior-year tax (110% if your prior-year adjusted gross income was over $150,000).{21Internal Revenue Service. Large Gains, Lump Sum Distributions, Etc.} If a gain hits in one quarter, the annualized income installment method lets you size the payment to the quarter the gain actually occurred instead of spreading it evenly across the year. Increasing your W-2 withholding for the rest of the year is another way to catch up.{22Internal Revenue Service. Underpayment of Estimated Tax by Individuals Penalty}
Check Your State Return Too
Federal reporting is only part of it. Most states tax capital gains as ordinary income, with top rates ranging from roughly 3% to over 13%. A few states have no income tax at all. In a high-tax state, the combined federal, state, and NIIT hit on a short-term gain can approach or exceed 50%. State returns typically use the same figures from your federal Schedule D, but some states have their own exclusions or additional surtaxes on investment income. Confirm your state’s rules before you assume the federal return covers everything.