Taxes

Capital Gains Tax on Stocks: What Investors Rarely Think About Until It’s Too Late

Investor reviewing capital gains tax rates and holding period timelines on a laptop

Fact-checked by the MyFinancial101 editorial team

Quick Answer

To minimize capital gains tax on stocks, you need to track your holding periods carefully (short-term gains are taxed at ordinary income rates up to 37%, while long-term gains top out at 20%), use tax-loss harvesting strategically, and time your sales around income thresholds. Most investors can cut their bill significantly by waiting just one year before selling.

Capital gains tax on stocks is one of the most predictable expenses in investing, and one of the most consistently underestimated. Investors spend years picking the right stocks, then hand back a chunk of their profits because they sold at the wrong time, held the wrong account type, or never thought about the tax consequences until the brokerage sent a 1099-B in February. According to IRS data on capital gains distributions, the effective tax rate on capital gains across all taxpayers averages just 5%, not because rates are low, but because low realization levels mask how hard the tax hits when gains are actually taken.

, the rules have not changed dramatically from prior years, but the stakes have risen. Equity valuations are elevated, more households hold appreciated stock through 401(k) rollovers and brokerage accounts than ever before, and the 3.8% Net Investment Income Tax (NIIT) quietly adds to the burden for higher earners. A $200,000 gain that feels like a windfall can shrink fast when federal rates, NIIT, and state taxes stack up.

This guide is for investors who actually have gains to protect, whether that is a concentrated position in a single stock, a mutual fund that threw off unexpected distributions, or a portfolio you are thinking about rebalancing. Work through each step before you sell anything, and you will make better decisions with real numbers instead of guesses.

Key Takeaways

  • Short-term capital gains, on stocks held one year or less, are taxed as ordinary income at rates up to 37%, while long-term rates top out at 20% according to IRS Topic 409.
  • High earners also owe a 3.8% Net Investment Income Tax (NIIT) on top of the standard capital gains rate, pushing the effective federal ceiling to 23.8% on long-term gains.
  • Single filers with 2025 taxable income below $47,025 (and joint filers below $94,050) owe 0% on long-term capital gains, a bracket most working investors overlook.
  • The wash-sale rule permanently disallows a loss deduction if you repurchase a substantially identical security within 30 days before or after the sale, per IRS guidance.
  • Heirs who inherit appreciated stock receive a full step-up in cost basis to fair market value at the date of death, erasing decades of embedded gains tax for the original owner.
  • Donating appreciated stock held longer than one year to a qualified charity lets you deduct the full fair market value without ever recognizing the capital gain, a strategy that beats selling and donating cash in almost every scenario.

Step 1: Why the Tax Bill Often Feels Like a Surprise

Most investors think of a stock gain as the difference between what they paid and what they sold for. That part is right. What they miss is how that gain interacts with everything else on their return, and how quickly the “advertised” rate of 15% or 20% becomes something considerably higher.

How Realized Gains Stack With Ordinary Income

Long-term capital gains are taxed at preferential rates, but they are still added to your ordinary income when the IRS calculates whether you owe the 3.8% Net Investment Income Tax. If your modified adjusted gross income (MAGI) exceeds $200,000 for single filers or $250,000 for married filing jointly, the NIIT applies to the lesser of your net investment income or the amount by which your MAGI exceeds the threshold. That means a couple earning $230,000 in wages who realizes a $100,000 stock gain could owe NIIT on the full gain, pushing the effective federal rate on that gain to 23.8% before state taxes enter the picture. For California residents, add another 13.3% at the top marginal rate, since California taxes all capital gains as ordinary income.

The interaction is the surprise. Investors see “20% long-term rate” and plan accordingly, then receive a bill that reflects 23.8% federal plus state, often exceeding 33% total in high-tax states. Understanding this stacking effect is the first real step in managing capital gains tax on stocks.

Paper Gains Are Not the Same as After-Tax Cash

A $500,000 position that has doubled from $250,000 has $250,000 in embedded gain. At a combined 28% effective rate (federal long-term plus NIIT, no state tax), selling it costs $70,000 in taxes. You net $430,000, not $500,000. That distinction matters enormously for retirees who are mentally spending the full value, and for anyone calculating whether it makes sense to sell a concentrated position and diversify.

By the Numbers

The IRS reports an effective capital gains tax rate of just 5% across all taxpayers, a figure driven down by low realization rates, not low statutory rates. When investors do sell, particularly in large lump sums, they face rates far above that average.

Chart showing federal capital gains tax rates stacked with NIIT and state taxes by income bracket

Step 2: The One-Year Holding Period Trap

One day separates a short-term gain from a long-term one, and that single day can mean the difference between paying your ordinary income rate and paying 15% or 20%. That is not an exaggeration; it is how the calendar mechanics work.

Short-Term Versus Long-Term: The Exact Math

According to IRS Topic 409, a capital asset must be held for more than one year to qualify for long-term treatment. “More than one year” means 366 days for most securities, not 365. Sell on day 365 and you owe ordinary income rates, which top out at 37% in 2025. Wait one more day and the maximum rate drops to 20%. For someone in the 32% income bracket selling $50,000 worth of stock, that single day is worth $6,000 in avoided taxes ($32,000 vs. $10,000 at the 20% long-term rate on that gain, with the difference approximating real bracket math).

RSUs (restricted stock units) and ESPPs (employee stock purchase plans) make this particularly treacherous. RSUs vest as ordinary income, the vesting date is your acquisition date for holding period purposes. If you sell immediately after vesting, the entire gain above the vested value is short-term. Employees often sell RSUs on autopilot to cover taxes and never realize they could hold the shares to shift future appreciation into long-term territory.

The Market Risk Trade-Off

Holding a stock for one more day, one more week, or even two more months purely for tax reasons carries real risk. A 10% drop in a volatile position can easily wipe out the tax savings from achieving long-term status. The calculus is straightforward: if the tax savings from waiting exceed the expected risk-adjusted cost of holding, wait. If the stock is volatile and the gain is modest, selling short-term and paying the higher rate can be the rational move. There is no universal right answer, only a real trade-off that deserves deliberate consideration rather than a default decision.

Watch Out

Holding a position past the one-year mark specifically for tax purposes can backfire if the stock declines more than your tax savings. Run the actual numbers: calculate the tax saved by waiting, then compare it to the dollar value of a realistic downside scenario. If those numbers are close, the tax tail may be wagging the investment dog.

Step 3: The 0% Long-Term Capital Gains Bracket Most Investors Ignore

For investors with taxable income below the 15% threshold, long-term capital gains are taxed at exactly 0%. This is not a loophole, it is a statutory rate that most working investors never reach but that retirees, part-time workers, and those in transition years can deliberately target.

Who Qualifies and How to Get There

In 2025, the 0% long-term capital gains rate applies to single filers with taxable income up to $47,025 and married filing jointly filers up to $94,050. Taxable income, not gross income, is what matters here. That means the standard deduction, retirement contributions, and other above-the-line deductions all reduce the number you are measuring against. A retired couple with $70,000 in Social Security (partially excluded) and $20,000 in IRA withdrawals might have taxable income well under $94,050, leaving room to realize tens of thousands in stock gains at 0%.

This strategy, sometimes called “gain harvesting,” is the mirror image of tax-loss harvesting. You deliberately realize gains in years when your income is low, reset the cost basis on those shares, and reduce the taxable gain you will owe in future years. It works best in years with unusually low income, sabbatical years, early retirement before Social Security begins, or years with large above-the-line deductions. Pairing gain harvesting with smart retirement account sequencing can extend how long you stay in the 0% bracket.

What to Watch Out For

Realizing large gains to “fill up” the 0% bracket can push you into the 15% bracket for the excess, or trigger the NIIT if your MAGI crosses the $200,000/$250,000 threshold. Run the projection in tax software before you sell, not after. Also note that capital gains added to your income can make a greater share of your Social Security benefits taxable, effectively increasing your marginal rate beyond what the bracket alone suggests.

Pro Tip

If you are in a low-income year and hold appreciated stock, consider selling shares up to, but not exceeding, the top of the 0% bracket, then immediately repurchasing them at the higher basis. Unlike tax-loss harvesting, this technique has no wash-sale restriction because you are realizing a gain, not a loss. You lock in a higher cost basis with zero federal tax owed.

Infographic showing 2025 capital gains tax brackets for single and married filers side by side

Step 4: Capital Gains Distributions From Funds and Why They Catch Investors Off Guard

You do not have to sell a single share to owe capital gains tax. Mutual funds, especially actively managed ones, pass taxable gains through to all shareholders every year, regardless of whether you sold anything.

How Phantom Taxable Events Work

When a fund manager sells securities within the fund at a profit, those gains are distributed to shareholders, typically in November or December. You receive a Form 1099-DIV showing capital gains distributions, and you owe tax on them, even if you reinvested the distribution and the fund’s net asset value has barely moved. In volatile years, a fund can decline in value while still distributing large capital gains because the manager sold appreciated older positions to rebalance or meet redemptions from other shareholders. That is a real scenario investors experience: their fund loses money, and they still get a tax bill.

Exchange-traded funds (ETFs) are more tax-efficient by structure. Because ETFs use in-kind redemptions through authorized participants, they rarely distribute capital gains. But “rarely” is not “never”, and some actively managed ETFs can distribute gains. Individual stocks, by contrast, give you full control over when you realize gains; nothing is triggered until you sell. That control is one of the underappreciated advantages of holding individual securities, alongside the risks of concentration. If you are thinking through the broader discipline of starting a stock portfolio, this guide to investing with zero experience covers the foundational steps.

What to Watch Out For

Before buying a mutual fund in a taxable account in October or November, check when the fund distributes gains. Buying shares the week before a large distribution means you owe tax on gains you never actually benefited from, the distribution reduces the NAV by the exact amount you receive, leaving you at the same position economically but with a new tax liability. Most major fund companies post estimated year-end distribution amounts in October; look before you buy.

Investment Type Tax Control Annual Capital Gains Risk Typical Tax Drag
Individual Stocks Full, you choose when to sell None until you sell Low (deferral until sale)
Index ETFs High, in-kind redemptions minimize distributions Very low (rare distributions) Very low (0–0.1% annually typical)
Active Mutual Funds None, manager decides when to sell holdings High in volatile or high-turnover years 0.5–2%+ annually in taxable accounts
Active ETFs Moderate, structure helps, but not guaranteed Moderate depending on strategy 0.1–0.5% annually typical

The table above reflects general characteristics; actual tax drag depends on the specific fund and market conditions in a given year. Review a fund’s historical distribution record and prospectus before placing it in a taxable account.

Did You Know?

Placing tax-inefficient investments, high-yield bond funds, actively managed equity funds, REITs, inside tax-advantaged accounts like IRAs or 401(k)s, while keeping index ETFs and individual growth stocks in taxable accounts, is a strategy called “asset location.” Done consistently, it can improve after-tax returns without changing what you own, only where you hold it.

Step 5: Tax-Loss Harvesting Gone Wrong and Wash-Sale Realities

Tax-loss harvesting is a legitimate and valuable strategy, but it fails in very specific, predictable ways that catch investors off guard every year. The wash-sale rule is the most common trap, and violating it does not just delay the deduction; it can eliminate it permanently in certain circumstances.

What the Wash-Sale Rule Actually Says

You cannot sell a security at a loss and then repurchase a “substantially identical” security within 30 days before or after the sale, and claim the loss for tax purposes. If you do, the loss is disallowed. The disallowed loss is added to the cost basis of the repurchased security, so in most cases you recover it eventually when you sell again. The danger is in IRAs: if you sell a stock at a loss in a taxable account and repurchase the same stock inside an IRA within the wash-sale window, the loss is permanently disallowed, because the basis adjustment cannot be applied to a tax-advantaged account. That is a common and genuinely painful mistake. The IRS outlines the wash-sale rule in Topic 409, and your broker is required to track and report it on Form 1099-B.

Using Losses Against Ordinary Income and Carrying Forward

Net capital losses, losses exceeding your gains in a given year, can offset up to $3,000 of ordinary income annually. Any amount above $3,000 carries forward indefinitely to future tax years. If you have accumulated $30,000 in harvestable losses, that is 10 years of $3,000 ordinary income offsets if you have no gains to absorb them sooner. Those carryforwards are valuable and should be tracked on Schedule D each year. If you are carrying significant consumer debt alongside investment losses, the $3,000 deduction strategy pairs well with a broader debt-reduction plan, our overview of how to prioritize and negotiate credit card debt covers the income side of that equation.

Beyond Basic Harvesting: Direct Indexing and Exchange Funds

Two strategies rarely mentioned in basic guides deserve attention here. Direct indexing, owning the individual stocks that comprise an index rather than a fund, allows continuous, precise tax-loss harvesting at the security level. Providers like Parametric and Fidelity Managed Accounts offer this, typically requiring $100,000 or more to start. The second strategy, Section 351 exchange funds (sometimes called “swap funds”), allows multiple investors with concentrated single-stock positions to pool their holdings into a diversified fund without triggering a taxable sale, provided they hold the fund for at least seven years. This is not a retail strategy; it requires working with a specialized investment manager, and the tax benefits come with real liquidity restrictions. But for someone sitting on $2 million in a single stock, it is worth knowing it exists.

Watch Out

Substantially identical does not mean only the exact same ticker. The IRS has broad authority to determine similarity, and selling an S&P 500 ETF at a loss while buying a nearly identical S&P 500 ETF from a different provider is a gray area. Most tax professionals recommend using funds that track different indexes or have meaningfully different compositions to stay safely outside the wash-sale window.

Step 6: Estate, Gift, and Step-Up Basis Consequences You Cannot Fix Later

This is the step most investors skip until it is actually too late to act, and the decisions here are irreversible.

When you die holding appreciated stock, your heirs receive a full step-up in cost basis to the fair market value on the date of your death. A position you bought at $10 per share that is worth $200 per share at your death transfers to heirs with a $200 basis. They owe zero capital gains tax on that appreciation, it simply disappears. This is one of the most powerful tax advantages in the entire tax code, and it argues strongly for holding appreciated positions rather than gifting them during life. If you gift the same shares while alive, the recipient receives your original cost basis. When they sell at $200, they owe tax on the full $190 per share gain. The IRS’s guidance on stock basis and identification rules covers how this is calculated and reported. Charitable donation of appreciated stock sidesteps the problem entirely, you deduct the full fair market value, the charity sells without owing tax, and nobody pays capital gains. That is superior to selling the stock yourself and donating the after-tax proceeds in nearly every scenario.

Did You Know?

State estate taxes can compound the federal picture significantly. Massachusetts and Oregon impose estate taxes starting at just $1 million, and Washington state’s top rate reaches 20%. An estate with large unrealized stock gains can face both estate tax on the full value of the position and capital gains tax when heirs eventually sell, though the step-up in basis at death eliminates the capital gains on pre-death appreciation for federal purposes.

Side-by-side diagram comparing step-up in basis at death versus gifting appreciated stock during life

Step 7: Life Events That Force Sales at the Worst Tax Time

Tax planning around capital gains works best when you control the timing. Life does not always cooperate.

When You Have No Choice But to Sell

Job loss, divorce settlements, a home purchase requiring a large down payment, or unexpected medical costs can force stock sales in years when the tax timing is genuinely bad. A year with low W-2 income might seem ideal for realizing gains, until a severance package or freelance income in the same year pushes your taxable income into a higher bracket, turning what looked like a 0% or 15% scenario into a 20% one. Divorce settlements involving investment accounts can require sales to equalize assets, and those sales generate taxable events even though no cash changed hands for investment purposes. The sequencing of which accounts to draw from, and in what order, can matter as much as which assets you sell.

The ACA, Medicare, and Student Aid Interactions

Large capital gains do not just affect your income tax directly. Realizing a significant gain in a year when you are covered by an ACA marketplace plan can push your MAGI above the subsidy cliff, meaning you repay premium tax credits you already received during the year. Medicare IRMAA surcharges work similarly: a one-time large gain in any given year triggers higher Part B and Part D premiums two years later, because Medicare looks at income from two years prior. These are real costs that rarely appear in basic capital gains planning guides. If you are approaching Medicare eligibility or currently enrolled in an ACA plan, model the full MAGI impact of any large stock sale before executing it. The tax bill on the gain is only part of the picture. For context on how income-based benefit calculations affect other areas of household finance, the 2026 poverty guideline changes article illustrates how income thresholds ripple across multiple programs simultaneously.

Pro Tip

If a forced sale is unavoidable, spreading it across two tax years, selling a portion in late December and the remainder in January, can split the gain across two income years and potentially keep you in a lower bracket in both. This requires knowing your projected income well before year-end, which is a good reason to do a tax projection in October or November rather than waiting for tax season.

Also worth noting: the approaching tax season makes late November and December the best window to take action on any of the strategies in this guide, harvesting losses, making charitable transfers of appreciated stock, or deliberately realizing gains in low-income years. Waiting until January means waiting a full year for another opportunity.

Frequently Asked Questions

How much tax will I owe if I sell stock I have held for less than a year?

Short-term capital gains, on stock held one year or less, are taxed at your ordinary income rate, which ranges from 10% to 37% depending on your total taxable income in 2025. Add any applicable state income tax on top of that. There is no preferential rate for short-term gains; they are treated exactly like wages or self-employment income on your tax return.

What is the capital gains tax rate on stocks in 2025?

Long-term capital gains rates in 2025 are 0%, 15%, or 20% depending on your taxable income. Single filers with taxable income up to $47,025 owe 0%; those between $47,025 and $518,900 owe 15%; and above $518,900 the rate is 20%. High earners also owe an additional 3.8% NIIT, bringing the top effective federal rate to 23.8%, per IRS Topic 409.

Can I avoid capital gains tax on stocks by putting them in a Roth IRA?

You cannot transfer appreciated shares from a taxable account into a Roth IRA without selling them first, and that sale triggers the tax. However, stocks held and sold inside a Roth IRA generate no capital gains tax at all, because qualified Roth withdrawals are entirely tax-free. The strategy is to buy growth-oriented investments inside the Roth from the start, not to move gains that already exist.

What happens if I sell stocks at a loss, can I use that to reduce my tax bill?

Capital losses first offset capital gains dollar-for-dollar. If your losses exceed your gains, up to $3,000 of the remaining net loss can be deducted against ordinary income in the same tax year. Any amount above $3,000 carries forward indefinitely to future years. The carryforward does not expire and can be applied to future gains or another $3,000 of ordinary income each year.

Does selling stock affect my Social Security or Medicare benefits?

A large capital gain can increase the taxable portion of your Social Security benefits, up to 85% of benefits become taxable once combined income exceeds certain thresholds. For Medicare, a high-gain year triggers IRMAA surcharges on Part B and Part D premiums two years later. A $100,000 stock gain in 2025 could result in hundreds of dollars in additional monthly Medicare premiums in 2027, depending on your total income.

How do I calculate the cost basis of stocks I bought years ago?

Your cost basis is the purchase price plus any commissions or fees paid at the time of purchase, per IRS guidance on stock basis. For shares bought at different times, you can identify specific lots (specific identification method) or default to FIFO (first in, first out) if you have not specified. Brokers are now required to track and report cost basis for shares purchased after 2011, but older positions may require you to reconstruct records from old statements or trade confirmations.

Is there a way to sell a concentrated stock position without paying capital gains tax?

Several strategies reduce or defer, but rarely eliminate, the tax. Donating shares to a qualified charity removes the gain entirely while providing a full fair-market-value deduction. A Section 351 exchange fund allows pooling with other investors without triggering a taxable sale, but requires at least a seven-year holding period and is only available through specialized managers. Charitable remainder trusts (CRTs) allow a sale inside the trust with deferred tax treatment, converting gains into an income stream. Each has real trade-offs in liquidity and complexity.

What if I received stock as a gift, what is my cost basis?

When you receive stock as a gift, your basis is generally the donor’s original cost basis. If the fair market value on the date of the gift is less than the donor’s basis and you later sell at a loss, the loss is calculated from the lower of the two figures. This asymmetric treatment is a specific and often misunderstood rule, and a primary reason why gifting appreciated stock to someone who will sell it is usually less advantageous than holding it until death for the step-up in basis.

How do I report stock sales on my taxes?

Stock sales are reported on Form 8949 and summarized on Schedule D of your Form 1040. Your broker provides a Form 1099-B each February showing proceeds and, for most shares, the cost basis. You are responsible for correcting any basis errors before filing, particularly for older shares, reinvested dividends, or shares received through employee compensation programs. The IRS guidance on capital gains reporting requirements covers the full documentation chain.

Should I sell appreciated stock before the end of the year or wait until January?

Selling before December 31 locks in the gain (and the tax bill) for the current tax year. Waiting until January defers the tax by one full year, which has real value, particularly if you expect to be in a lower bracket next year or want more time to offset gains with other losses. If your income is unusually high this year and will likely be lower next year, waiting is almost always better. If you expect income to rise, selling before year-end may be preferable. Model both scenarios with your projected income before deciding.

CJ

Camille Jourdain

Staff Writer

Camille Jourdain is a CPA and tax strategist with a passion for helping small business owners and entrepreneurs minimize their tax burden legally and efficiently. She spent eight years at a Big Four accounting firm before launching her own consulting practice focused on independent business owners. Her writing breaks down complex tax code into actionable, plain-English guidance.