Skip to main content

How Can I Avoid Capital Gains Tax On Stocks?

by
Last updated on 6 min read

Quick Fix: You’ve got a few solid options here: sell some losers to offset gains (tax-loss harvesting), gift stock you’ve held long-term to charity, or just hold your assets until you pass away. For quick flips, stick to tax-friendly accounts like a Roth IRA.

What’s Actually Happening with Capital Gains Tax

Here’s the deal: whenever you sell an investment for more than you paid, Uncle Sam wants his cut. The tax rate hinges on two things—how long you held the asset and your income level. Right now, the IRS still splits gains into short-term (under a year) and long-term (over a year), with long-term rates usually kinder to your wallet.

That tax bill hits the moment you sell, even if you immediately plow the money back into something else. The IRS isn’t fooled by reinvesting—you still owe the tax. But here’s the good news: with the right moves, you can shrink or even wipe out that bill, depending on your finances.

Here’s How to Actually Do It

1. Sell Your Losers to Cancel Out Gains (Tax-Loss Harvesting)

Think of this as financial judo: you offset your gains by dumping investments that are underwater.

  1. Log into your brokerage—Fidelity, Schwab, Vanguard, whatever you use.
  2. Head to the Tax Center or pull up the Gain/Loss Report (some platforms might call it “Tax Efficiency Tools” in 2026).
  3. Scan your year-to-date gains and losses.
  4. Sell enough losing positions to wipe out or cut down your net capital gain. Just don’t buy the same stock back within 30 days—IRS wash-sale rules will ruin the party.
  5. Move the cash into similar but not identical assets to keep your portfolio balanced without triggering new taxes.

Say you made $10,000 selling ABC stock. If you sell $10,000 of XYZ stock at a loss, suddenly your taxable gain vanishes for the year.

2. Give Away Your Winning Stock to Charity

Here’s a two-for-one deal: skip the capital gains tax *and* get a full deduction for the stock’s current value.

  1. Double-check that your chosen charity takes stock donations (most big ones do).
  2. In your brokerage app, go to Transfer > Transfer Securities Out and pick the charity as the recipient.
  3. Enter the share count and confirm. The charity sells the stock, and you claim the full market value as a deduction on Schedule A (Form 1040).
  4. Hold onto the paperwork: a receipt from the charity and a brokerage statement showing the transfer date and value.

As of 2026, you can still deduct up to 30% of your adjusted gross income for donations to public charities, or 20% for private foundations, when gifting appreciated stock.

3. Hold Until You Die (Step-Up in Basis)

This one’s grim but effective: when you pass away, your heirs get a free “step-up” in cost basis to the stock’s value on the day you die. That wipes out any built-in capital gains tax.

  1. Keep those appreciated investments until the very end.
  2. Make sure your estate plan spells out exactly who gets what.
  3. When the asset transfers, the new owner’s cost basis resets to the value at inheritance—no tax on all those years of appreciation.

Just remember: this doesn’t shield huge estates from estate taxes (over $13.61 million per person in 2026, adjusted for inflation).

4. Stash Stocks in Tax-Free Retirement Accounts

Roth IRAs, 401(k)s, and HSAs let your money grow and come out tax-free (if you follow the rules).

  1. Max out your Roth IRA: $7,000 in 2026, or $8,000 if you’re 50+. That’s free reinvestment growth.
  2. Buy and sell stocks inside the Roth—no tax on the gains.
  3. After age 59½, withdrawals are tax-free as long as the account’s been open at least five years.
  4. If you’re flipping stocks fast, keep those trades inside the Roth to avoid triggering capital gains in a taxable account.

5. Bet on Small Business Stock (QSBS Exclusion)

Section 1202 lets you exclude up to 100% of gains from certain small business stock—if you hold it long enough.

  1. Put money into early-stage C-corp startups through QSBS-eligible funds or direct equity.
  2. Check the boxes: the company must be under $50 million in assets when it issues the stock and actively running a real business.
  3. Hang onto the stock for at least five years before selling.
  4. In 2026, the max exclusion is still $10 million or 10 times your original investment—whichever’s bigger.

Still Stuck? Try These

Park Your Gains in an Opportunity Zone Fund

Roll your capital gains into a Qualified Opportunity Fund within 180 days of selling, and you can defer—and possibly shrink—the tax bill.

  1. Find a fund focused on a low-income area.
  2. Sell your appreciated asset and move the gain into the fund within six months.
  3. You won’t owe tax on the original gain until 2026 (yes, 2026), but the bill shrinks by 10% if you hold five-plus years, or 15% if you hold seven-plus years.
  4. Keep the fund for a decade, and any future gains vanish entirely.

Heads up: this only works for gains from 2019–2025. After December 31, 2026, new investments no longer qualify.

Set Up a Charitable Remainder Trust (CRT)

A CRT can give you income for life while cutting your capital gains and estate taxes.

  1. Hire an estate attorney to draft the trust.
  2. Dump your appreciated stock into it—the trust sells it tax-free.
  3. You get annual income from the trust for a set term or your lifetime.
  4. Whatever’s left goes to charity when the term ends.

This isn’t a DIY project, but it can dramatically shrink your taxable estate—if you’re comfortable with the complexity.

Ways to Keep the Bill Low Next Time

  • Give your stocks more than a year to marinate. That pushes you into the lower long-term capital gains brackets (0%, 15%, or 20%). In 2026, single filers making up to $47,025 (or $94,050 for married couples) pay 0% on long-term gains.
  • Pick tax-efficient funds for taxable accounts. Index ETFs beat actively managed mutual funds here—ETFs almost never hand out capital gains to shareholders.
  • Never buy back the same stock within 30 days of selling at a loss. The IRS will call it a wash sale and disallow the loss. Plan your trades carefully.
  • Max out retirement accounts. Every dollar you stuff into an IRA, 401(k), or HSA is a dollar the IRS can’t touch. In 2026, 401(k) limits are $23,000 ($30,500 if you’re 50+).
  • Track your cost basis precisely. Brokers default to FIFO (first-in, first-out), but you can usually elect to sell specific lots with higher bases to minimize gains.
  • Run a tax projection before big trades. Rules shift every year. A quick chat with a CPA can reveal smart moves like bunching deductions or timing gains across tax years.
David Okonkwo
Author

David Okonkwo holds a PhD in Computer Science and has been reviewing tech products and research tools for over 8 years. He's the person his entire department calls when their software breaks, and he's surprisingly okay with that.

How Do You Describe A Startup On A Resume?How Can I Skip EBay Fees?