Financial PlanningTax PlanningHow to Legally Avoid Capital Gains Tax on Stocks (2025 Planner's Guide)

How to Legally Avoid Capital Gains Tax on Stocks (2025 Planner’s Guide)

Use these seven IRS-approved strategies to protect your investment profits from a massive tax bill.

How to avoid capital gains tax on stocks
How to avoid capital gains tax on stocks

“Michael, I just sold my company stock to fund a down payment… my accountant says I owe a fortune in taxes. How is that possible?”

This was the panicked call I got from a client, Marcus a few years ago. He sold about $100,000 in stock he’d held for years and was blindsided by a tax bill that felt punishingly high. The culprit wasn’t just one tax; it was a combination of long-term capital gains tax and the sneaky Net Investment Income Tax (NIIT).

Marcus’s story is incredibly common. In 2025, with many investors sitting on significant gains from the last decade, knowing how to legally reduce and avoid paying capital gains tax on stocks is no longer an advanced strategy. It’s essential financial planning.

This isn’t about shady loopholes; it’s about understanding the rules the IRS has in place and using them to your advantage.

In this guide, I’ll use my 25+ years of experience to give you the planner’s playbook on tax-efficient investing. We’ll cover the core strategies every investor should know and the advanced moves that can save you thousands.

Key Takeaways

  • Time is Your Greatest Ally: Holding a stock for more than one year is the single easiest way to cut your tax rate nearly in half.
  • Harvest Your Losses: Tax-loss harvesting is a powerful, legal strategy to use losing investments to offset the taxes on your winners.
  • Use the Right Accounts: You pay zero capital gains tax on investments held within tax-advantaged accounts like a Roth IRA or 401(k).

Myth Buster:
You don’t have to sell to access your portfolio’s value. Advanced strategies can provide liquidity without triggering a taxable event.

First, What Are the Capital Gains Tax Rules You Need to Know?

What is A Capital Gains Tax on a Stock Sale

Before you can reduce your tax bill, you need to understand how gains are taxed. The IRS separates them into two categories.

Short-Term Capital Gains

This applies to any stock you sell after holding it for one year or less. The profit is taxed at your ordinary income tax rate—the same as your salary. For many, this can be as high as 24%, 32%, or even 37%.

Long-Term Capital Gains

This applies to stock you sell after holding it for more than one year. The tax rates are much more favorable: 0%, 15%, or 20%, depending on your total taxable income.

💡 Advisor Tip

The “one year and one day” holding period is the simplest and most effective tax-saving strategy in the book. Before you sell a winner, always check the purchase date. Waiting a few more days or weeks could save you a significant amount of money.

Press pay below to watch a quick slideshow to help explain your capital gains avoidance ideas:

The Hidden 3.8% Surtax: Are You Subject to the Net Investment Income Tax (NIIT)?

This is the tax that shocked my client, Marcus. The Net Investment Income Tax (NIIT) is an additional 3.8% surtax that applies to investment income (including capital gains) for individuals with a Modified Adjusted Gross Income (MAGI) above certain thresholds.

For 2025, those thresholds are:

  • $200,000 for Single or Head of Household filers
  • $250,000 for Married Filing Jointly couples

This tax is stacked on top of your regular capital gains tax, which is how a 15% rate can suddenly feel like 18.8%. For authoritative details, you can refer to the IRS explanation of the NIIT.

Yes! Send Me Free Money Tips by Email

Free weekly newsletter with smarter ways to grow your wealth.

The Planner’s Playbook: 4 Core Strategies Every Investor Must Know

These are the foundational, must-know strategies for managing taxes in a standard taxable brokerage account.

How To Avoid Stock Sale Capital Gains

1. Hold for the Long Term

As we covered, holding an investment for at least a year and a day is your first and best line of defense, ensuring you qualify for the lower long-term rates.

2. Harvest Your Losses to Offset Gains

This is the most powerful tool in your tax-planning arsenal. Tax-loss harvesting is the practice of selling losing investments to realize a capital loss. That loss can then be used to cancel out, or “offset,” capital gains you’ve realized from selling winners.

📘 A Planner’s War Story: The Power of a “Loser”

I had a client, “David,” who needed to sell $50,000 of appreciated Apple stock for a kitchen remodel, facing a big tax bill. We dug into his portfolio and found a mutual fund he’d bought years ago that was down $15,000. By selling the losing fund first, he “harvested” that loss, which completely offset his gain from the Apple stock. His tax bill on the sale went to zero.

According to IRS Topic No. 409, you can use losses to offset all of your gains, plus up to $3,000 of your ordinary income each year.

3. Beware the “Wash Sale Rule”

The IRS won’t let you sell a stock to claim a loss and then immediately buy it back. The Wash Sale Rule disallows a tax loss if you buy the same or a “substantially identical” security within 30 days before or after the sale.

4. Use the Right Accounts (Tax-Advantaged Investing)

The easiest way to avoid capital gains tax is to invest within accounts that are designed to be tax-free or tax-deferred. You don’t pay any capital gains tax for trades made inside:

  • Roth and Traditional IRAs
  • 401(k)s, 403(b)s, and other employer-sponsored plans
  • Health Savings Accounts (HSAs)

Federal Capital Gains Tax Estimator (2025)

Estimated Federal Tax Impact

Total Capital Gain: $0.00

Applicable Tax Rate: 0%

Estimated Federal Tax Owed: $0.00

This is a simplified estimator for federal taxes only and does not account for state taxes, the Alternative Minimum Tax (AMT), or other complex situations. Consult a qualified tax professional for personalized advice.

Advanced Moves: 3 Strategies for Specific Financial Goals

For investors with specific objectives, these advanced strategies can provide even greater tax benefits.

5. Be Strategic About Which Shares You Sell

When you sell a portion of a stock you’ve bought at different times and prices, your brokerage defaults to selling the “First-In, First-Out” (FIFO) shares.

However, you can instruct them to use “Specific Share Identification,” allowing you to sell the shares with the highest cost basis, which minimizes your taxable gain.

6. Gift Appreciated Stock

You can gift stock to a friend or family member. While this doesn’t eliminate the tax, it can shift the liability. The recipient inherits your original cost basis and holding period.

If they are in a lower tax bracket (e.g., the 0% long-term capital gains bracket), they can sell the stock and pay significantly less tax than you would have.

7. Donate Appreciated Stock to Charity

This is one of the most powerful tax-saving strategies. If you donate appreciated stock you’ve held for more than a year directly to a qualified charity or a Donor-Advised Fund, you can typically deduct the full fair market value of the stock, and you pay zero capital gains tax on the appreciation.

It’s a win-win.

Conclusion: Your Final Takeaway on Capital Gains

Capital Gains Tax Rates Through The years

After 25 years of practice, the most costly mistake I’ve seen isn’t picking the wrong stock; it’s failing to have a tax plan for the winners. An investment strategy isn’t complete until you have a tax-efficient exit strategy. The difference between a smart sale and an uninformed one can be tens of thousands of dollars in your pocket versus the IRS’s.

Your goal isn’t to never sell; it’s to sell smart. Use the strategies in this playbook to build a plan that lets you enjoy your hard-earned gains.

🚀 Next Steps

Ready to put this into practice? Start by reviewing your portfolio for any losing positions you could use for tax‑loss harvesting. For a more tailored plan, consider discussing these strategies with a qualified financial advisor or CPA. And if you’re selling a home, be sure to understand how to avoid capital gains tax on a home sale .

(For those interested in building a solid financial foundation, I highly recommend the book I Will Teach You to Be Rich from Amazon for its practical approach to building an automated investment plan.)

❓ Frequently Asked Questions

How does state capital gains tax work in 2025?

State taxes are a critical, often overlooked layer. Some states, like Florida, have no state capital gains tax, offering a significant advantage. Others, like California, tax capital gains at high ordinary income rates. Always factor in your state’s specific rules.

Can TurboTax or other software handle tax-loss harvesting?

Yes, tax software like TurboTax can handle the reporting of capital losses on IRS Form 8949 and Schedule D. However, the software does not tell you which assets to sell or when. The strategy of tax-loss harvesting must be executed by you or your advisor first.

What is the holding period for Qualified Small Business Stock (QSBS)?

The QSBS exclusion is a powerful but complex rule. To potentially exclude up to 100% of the capital gains, you must have held the stock for more than five years, among other strict requirements defined by IRS Section 1202.

Does gifting stock to my children trigger any gift tax limits?

Yes. For 2025, you can gift up to $18,000 per person per year without having to file a gift tax return. Gifting stock above this annual exclusion amount may require filing a gift tax return, though it typically won’t result in paying taxes unless you exceed your lifetime gift tax exemption.


Subscription Form (#3)
  • Sharing the article with your friends on social media – and like and follow us there as well.
  • Sign up for the FREE personal finance newsletter, and never miss anything again.
  • Take a look around the site for other articles that you may enjoy.

Note: The content provided in this article is for informational purposes only and should not be considered as financial or legal advice. Consult with a professional advisor or accountant for personalized guidance.

und with. A bit further down, I created a tool for you to play with that will estimate your federal capital gains tax bracket.

We are audience supported - when you make a purchase through our site, we may earn an affiliate commission.

Michael Ryan
Michael Ryanhttps://michaelryanmoney.com/
Michael Ryan, Retired Financial Planner | Founder, MichaelRyanMoney.com With nearly three decades navigating the financial world as a retired financial planner, former licensed advisor, and insurance agency owner, Michael Ryan brings unparalleled real-world experience to his role as a personal finance coach. Founder of MichaelRyanMoney.com, his insights are trusted by millions and regularly featured in global publications like The Wall Street Journal, Forbes, Business Insider, US News & World Report, and Yahoo Finance (See where he's featured). Michael is passionate about democratizing financial literacy, offering clear, actionable advice on everything from budgeting basics to complex retirement strategies. Explore the site to empower your financial future.