/* Legacy content CSS (original compiled Tailwind v4) - static, loads first */
Tax Education16 min readJuly 27, 2026

Capital Gains Tax on Stock Sales: How Much You Really Pay When You Sell Shares

Complete guide to capital gains tax when selling stocks. Covers holding periods, short-term vs long-term rates, cost basis, netting gains with losses, and real examples showing how much tax you owe on stock sales.

Capital Gains Tax on Stock Sales: How Much You Really Pay When You Sell Shares

Selling Stocks Triggers a Tax Bill Most People Underestimate

Every time you sell a stock for more than you paid, the IRS wants a cut. That is the basic reality of capital gains tax on stock sales. Yet most investors — even experienced ones — underestimate how much they will owe when they finally cash out.

The problem is not just the tax rate itself. It is the compounding layers. Federal tax, state tax, the Net Investment Income Tax, and the difference between short-term and long-term rates all stack together. A single stock sale can trigger a tax bill that ranges from zero to over 50 percent of your gain, depending on your holding period, your income level, and where you live.

This guide covers every angle of capital gains tax when you sell shares. Holding periods, cost basis, the netting process, real examples, and strategies for keeping more of what you earn. Whether you sold three shares of Apple or unloaded a concentrated position worth hundreds of thousands, the rules are the same — and understanding them before you sell can save you serious money.

Short-Term vs Long-Term: The Rate That Changes Everything

The first thing you need to know about any stock sale is how long you held the shares. The IRS splits capital gains into two categories based on your holding period, and the tax rate difference between them is enormous.

Short-term capital gains come from shares held for one year or less. These gains get taxed at your ordinary income rate — the same rate applied to your salary, freelance income, and interest. That means a short-term gain can land in the 10%, 12%, 22%, 24%, 32%, 35%, or 37% bracket, depending on your total taxable income.

Long-term capital gains come from shares held for more than one year. These gains qualify for preferential rates of 0%, 15%, or 20%. The rate depends on your total taxable income, including the gain itself. For most middle-income taxpayers, the 15% rate applies. For lower-income filers, some or all long-term gains qualify for the 0% rate.

The practical impact is dramatic. On a $50,000 gain, a short-term filer in the 32% bracket owes $16,000. The same gain taxed at the long-term 15% rate costs $7,500. That is an $8,500 difference created entirely by whether you held the stock for 366 days or 365 days.

For a full breakdown of how each rate tier works, including the 0% bracket thresholds, see our short-term vs long-term capital gains tax comparison.

Short-Term vs Long-Term: Holding Period Changes Your Tax Rate

How the Holding Period Clock Works

The holding period starts the day after you purchase the shares and ends on the day you sell them. If you bought 200 shares of Tesla on March 15, 2025, and sold on March 15, 2026, that is exactly 365 days — and it counts as short-term. You must hold until March 16, 2026, to qualify for the long-term rate.

This one-day difference can save or cost you thousands. Before you place a sell order, always check whether you have crossed the one-year threshold. Most brokerage platforms show your holding period for each position, but it is worth double-checking manually.

Cost Basis: What You Really Paid for Those Shares

Your cost basis is the number that determines your gain. It is not just the purchase price — it includes everything you spent to acquire the shares, plus certain adjustments over time.

The starting point is your purchase price. If you bought 100 shares at $50 each, your initial basis is $5,000. But there are additions and adjustments that can change this number:

  1. 1Commissions and fees. The commission you paid when buying and when selling both get added to your basis. A $50 purchase commission and a $50 sale commission effectively increase your basis by $100, reducing your taxable gain by the same amount.
  1. 1Reinvested dividends. If you enrolled in a dividend reinvestment plan (DRIP), each reinvestment creates a separate tax lot with its own basis and holding period. This is one of the most commonly overlooked items on stock tax returns.
  1. 1Stock splits. A 2-for-1 split halves your per-share basis and doubles your share count. Your total basis stays the same, but you need the adjusted per-share number when you sell.
  1. 1Wash sale adjustments. If you sold shares at a loss and bought substantially identical shares within 30 days, the disallowed loss gets added to the basis of your new shares. Our complete wash sale rule guide explains this in detail.

For a deeper dive into how cost basis works with different calculation methods, check our guide on h[how to calculate capital gains tax — it walks through the full formula step by step.

The Netting Process: How Gains and Losses Cancel Each Other

You rarely sell just one stock in a year. Most investors have multiple transactions — some producing gains, others producing losses. The IRS requires you to net these against each other before calculating your final tax bill.

The netting process happens in three steps:

  1. 1Net short-term gains against short-term losses. Add up all your short-term gains and short-term losses for the year. If gains exceed losses, you have a net short-term gain. If losses exceed gains, you have a net short-term loss.
  1. 1Net long-term gains against long-term losses. Same process, but for positions held more than one year. You arrive at either a net long-term gain or a net long-term loss.
  1. 1Net the results against each other. If you have both a net short-term gain and a net long-term gain, they stay separate and are taxed at their respective rates. If one side is a gain and the other is a loss, they offset each other.

Any remaining net capital loss — after all the offsetting — can be deducted against up to $3,000 of ordinary income ($1,500 if married filing separately). Losses beyond that carry forward to future years. Our capital gains tax loss carryover guide explains how the carryforward works year by year.

How the IRS Nets Your Gains and Losses

Why Short-Term Losses Are More Valuable Than Long-Term Losses

Here is a detail most people miss. Short-term losses offset short-term gains first — and short-term gains are taxed at the higher ordinary rate. A $10,000 short-term loss saves you up to $3,700 in tax (at the 37% rate). A $10,000 long-term loss saves you at most $2,000 (at the 20% rate).

This is why strategic tax-loss harvesting throughout the year focuses on harvesting short-term losses whenever possible. You get more tax savings per dollar of loss.

Real Example: Selling a Concentrated Stock Position

Let me walk you through a complete calculation. Meet Daniel — single filer, $85,000 W-2 salary, and a concentrated position in Nvidia he has held for different periods.

Daniel has three tax lots:

  • Lot A: 50 shares bought at $25/share ($1,250) — held 14 months (long-term)
  • Lot B: 100 shares bought at $180/share ($18,000) — held 8 months (short-term)
  • Lot C: 150 shares bought at $320/share ($48,000) — held 3 months (short-term)

He sells all 300 shares at $450/share. Total proceeds: $135,000.

Using specific identification (choosing which lots to sell), the gains look like this:

  • Lot A gain: $135,000 allocation — but let us calculate per lot. 50 shares at $450 = $22,500 proceeds. Basis $1,250. Long-term gain: $21,250.
  • Lot B gain: 100 shares at $450 = $45,000. Basis $18,000. Short-term gain: $27,000.
  • Lot C gain: 150 shares at $450 = $67,500. Basis $48,000. Short-term gain: $19,500.

Net short-term gain: $27,000 + $19,500 = $46,500 (no short-term losses to offset).

Net long-term gain: $21,250 (no long-term losses to offset).

Now the tax calculation. Daniel's salary of $85,000 minus the $15,700 standard deduction leaves $69,300 in ordinary income. The short-term gain of $46,500 stacks on top, giving Daniel $115,800 total ordinary income — landing in the 24% bracket for most of that gain.

Short-term tax: roughly $10,800.

Long-term tax: Total taxable income = $69,300 + $46,500 + $21,250 = $137,050. The 15% long-term bracket covers up to $492,300 for single filers, so the entire $21,250 long-term gain gets 15%.

Long-term tax: $21,250 × 15% = $3,187.50.

Total capital gains tax: $10,800 + $3,187.50 ≈ $13,988.

If Daniel had waited to sell Lot B and Lot C until they crossed the one-year mark, the entire $68,000 would qualify as long-term. Total taxable income: $69,300 + $89,250 = $158,550. Still in the 15% bracket for long-term gains.

Long-term tax: $89,250 × 15% = $13,387.50.

That is actually less total tax than the mixed scenario — $13,388 vs $13,988 — and the difference grows dramatically at higher income levels.

The NIIT Surtax That Sneaks Up on High Earners

If your modified adjusted gross income exceeds $200,000 (single) or $250,000 (married filing jointly), the Net Investment Income Tax adds a 3.8% surcharge on your investment income. This includes both short-term and long-term capital gains from stock sales.

The NIIT applies to the lesser of your net investment income or the amount your MAGI exceeds the threshold. So if you are a single filer with $230,000 MAGI and $80,000 in capital gains, the NIIT hits $30,000 (the excess over $200,000) at 3.8%, adding $1,140 to your bill.

This tax stacks on top of whatever rate you are already paying. A 20% long-term rate plus 3.8% NIIT gives you an effective federal rate of 23.8%. Add state capital gains tax and you can easily reach 30% or more on long-term gains alone.

State Tax on Stock Sales: Another Layer to Calculate

Most states tax capital gains at the same rate as ordinary income. California charges up to 13.3%, New York up to 10.9%, and New Jersey up to 10.75%. On a $100,000 gain, California state tax alone could add $13,300 to your federal bill.

Nine states charge zero state income tax: Alaska, Florida, Nevada, South Dakota, Texas, Washington, Wyoming, and New Hampshire (no tax on wages, but taxes interest and dividends). If you live in one of these states, your combined rate stays much lower.

For a complete breakdown of every state rate, see our state capital gains tax rates comparison. The difference between living in California versus Texas on the same $100,000 gain can exceed $13,000.

Strategies to Reduce Your Stock Sales Tax Bill

Strategy 1: Wait for the One-Year Threshold

This is the single most impactful strategy. If you are within a few weeks of crossing the one-year mark on an appreciated position, do not sell early unless you have a compelling reason. The rate difference — up to 22 percentage points between short-term and long-term — is the largest tax savings available to most investors.

Strategy 2: Harvest Losses to Offset Gains

Before year-end, review your portfolio for losing positions you can sell to offset gains. This is called tax-loss harvesting, and it works like this: if you have $40,000 in short-term gains, selling losing positions that produce $40,000 in short-term losses wipes out the entire gain — and the entire tax bill on it.

Our tax-loss harvesting complete guide covers the mechanics, timing, and wash sale rules in detail. The key rule: do not repurchase the same or substantially identical stock within 30 days, or the loss gets disallowed per the wash sale rule.

Strategy 3: Use Specific Lot Identification

When you sell partial positions, you can choose which specific shares (lots) you are selling. Tell your broker to sell the shares with the highest cost basis first, and you minimize the gain on the sale. Most brokers default to FIFO, which often produces the largest gain because your oldest shares usually have the lowest basis.

For the full breakdown of lot identification methods, see our guide on capital gains tax cost basis methods — it compares FIFO, specific identification, and average cost with real examples.

Strategy 4: Donate Appreciated Stock to Charity

If you were planning to make a charitable donation anyway, donate the appreciated shares directly instead of selling and donating cash. You skip the capital gains tax entirely, and you still deduct the full fair market value as a charitable contribution. This strategy only works for long-term holdings donated to qualified charities.

For more avoidance strategies, see our legal strategies to avoid capital gains tax.

Strategy 5: Consider Deferral Strategies for Large Gains

If you are facing a very large gain, deferral options like opportunity zone investments and installment sales can spread the tax across multiple years. These strategies are complex and have strict requirements, but they can dramatically reduce your current-year tax burden.

How to Report Stock Sales on Your Tax Return

Every stock sale goes on Form 8949, then flows to Schedule D, then to your Form 1040. Here is the exact path:

  1. 1Form 8949, Part I — list each short-term transaction (held one year or less)
  2. 2Form 8949, Part II — list each long-term transaction (held more than one year)
  3. 3Schedule D — summarize the totals and apply the netting rules
  4. 4Form 1040 — the net capital gain flows into your total income

For a complete walkthrough of every form and line, our guide on how to report capital gains on your tax return covers Form 8949 and Schedule D step by step.

What Your Broker Reports to the IRS

Your brokerage sends Form 1099-B to both you and the IRS. This form lists every sale, the proceeds, and (for covered securities) the cost basis. The IRS matches your 1099-B against your tax return automatically. If your return does not include a sale that appears on your 1099-B, you will get a CP2000 notice proposing additional tax.

For shares acquired before the basis reporting rules took effect (generally before 2011), your 1099-B may show "basis not reported to IRS." In that case, you must calculate and enter the correct basis yourself on Form 8949. Leaving the basis blank means the IRS treats your entire sale proceeds as a gain — which massively overstates your tax.

Special Situations That Change the Rules

Inherited Stock

Stock you inherit gets a "stepped-up" basis equal to the fair market value on the date of the original owner's death. You also automatically qualify for long-term treatment regardless of how long you or the deceased held the shares. Our guide on capital gains tax on inherited property covers this in detail.

Stock Options and RSUs

RSU holding periods start on the vesting date, not the grant date. Stock option holding periods start on the exercise date. These timing rules are critical for tax planning. Our stock options and RSU tax guide covers the full breakdown.

Mutual Fund and ETF Sales

Mutual funds allow the average cost basis method, which individual stocks do not. ETFs follow the same rules as individual stocks. See our mutual fund and ETF capital gains tax guide for the details.

The Bottom Line on Stock Sales Tax

Capital gains tax on stock sales is not a single rate — it is a system. Your holding period, your income level, your cost basis method, your state, and the NIIT all interact to determine your final bill. The biggest lever is the holding period: crossing the one-year threshold can cut your rate by more than half. The second biggest lever is loss harvesting: offsetting gains with strategic losses wipes out tax on those gains entirely. The third lever is specific lot identification: choosing which shares to sell lets you minimize the reported gain.

Before you sell any appreciated stock, run the numbers. Check your holding period. Review your portfolio for losses to harvest. Choose your lot identification method. And always factor in state tax and the NIIT for the real combined rate you will pay. For more detailed strategies and calculations, explore our full collection of capital gains tax articles and tools.

Fact-Checked & Reviewed

This article was written by Sarah Mitchell (CPA, MST (Master of Science in Taxation)) and reviewed for accuracy by David Chen (JD, LLM in Taxation (New York University)). Published by Wasim Akram, Founder & Lead Researcher at TaxGainsCalc. All tax rates, thresholds, and rules referenced are based on IRS publications and current tax law as of the date published. Tax laws change frequently — always consult a qualified tax professional for advice specific to your situation.

SM
Written by
Sarah Mitchell

Certified Public Accountant (CPA)

Sarah Mitchell is a Certified Public Accountant with over 15 years of experience in individual and business taxation. She holds a Master of Science in Taxation from Golden Gate University and specializes in capital gains tax planning, investment tax ...

CPA, MST (Master of Science in Taxation)LinkedInView full profile
DC
Reviewed by
David Chen

Tax Attorney & Legal Editor

David Chen is a tax attorney with a Juris Doctor and a Master of Laws in Taxation from New York University School of Law. With over 10 years of legal practice, he specializes in 1031 exchanges, capital gains tax law, and IRS dispute resolution. David...

JD, LLM in Taxation (New York University)LinkedInView full profile
Wasim Akram
Published by
Wasim Akram

Founder & Lead Researcher, TaxGainsCalc

Wasim Akram is an independent web publisher and digital entrepreneur based in India. Since 2018, he has been building custom CMS platforms, WordPress plugins, niche websites, and AI-powered digital products with over 8 years of real-world experience....

capital gains tax on stock salesstock capital gains tax rateselling stocks taxholding period for stockscost basis stock salesnetting stock gains and lossesstock tax strategies

Disclaimer: This article is for informational purposes only and does not constitute tax, legal, or financial advice. Tax laws and regulations change frequently, and the information presented here may not reflect the most current updates. You should consult with a qualified CPA, tax attorney, or financial advisor before making any tax-related decisions. TaxGainsCalc is not responsible for any actions taken based on the information provided in this article.

Continue Reading