How to Avoid Capital Gains Tax on Stocks [12 Effective Strategies]

If you have have invested wisely and now are sitting on significant gains on your stock investments, congratulations – you are in a great place!

But if you think now is a good time to sell, you are faced with a different problem – how to minimize, eliminate or at least defer capital gains taxes on those appreciated assets. That’s going to be the focus of this article.

I am going to cover 12 strategies you can use to avoid capital gains taxes (and where it cannot be avoided altogether, minimized or deferred).

I will first cover strategies that can be used by almost anyone (there are plenty to explore), and finish with some exotic strategies that are usually reserved for wealthy people who have a significant amount of appreciated investments or high levels of net worth.

Even if you’re not there yet, I think it’s interesting peek into the secret strategies that these uber wealthy people actually use to manage their money and reduce their taxes.

Ok, we’ve got a lot to cover, so let’s get into it!

This post may contain affiliate links. If you click on a link and complete a transaction, I may make a small commission at no extra cost to you. 

The information contained in this post is for informational purposes only.  It is not a recommendation to buy or invest, and it is not financial, investment, legal, or tax advice.  You should seek the advice of a qualified professional before making any investment or other decisions relating to the topics covered by this article.

What Are Capital Gains Taxes?

Before we dive into the strategies, let’s cover the basics. Of course, if you are already familiar with capital gains taxes, you can skip ahead to the strategies by clicking here.

The capital gains tax is a tax that is imposed on the profit you make from an investment (including stocks). In most cases, you incur that tax when your stock is sold. Capital gains tax is different from income tax, which is tax that is imposed on (you guessed it) income that you earn.

There are two types of capital gains taxes that apply to stocks, long term (for investments held for more than a year) and short term (for investments held for a year or less). In general, long term capital gains are taxed at a lower rate than short term capital gains. More on specific tax rates below.

As I alluded to earlier, the capital gains tax only kicks in when you sell your stock – if you just hold on to it, the appreciation on that stock is viewed as “unrealized” and you will not be taxed on it.

If you want a more detailed understanding of the capital gains tax, check out the Investopedia article on the topic here.

How Are You Taxed on Capital Gains for Stocks?

As we discussed, you are generally taxed on capital gains when you sell your stock. So what is the capital gains rate when you actually are taxed?

As of the date of this article, short term capital gains are taxed as ordinary income, which means it is generally taxed like your wages or salary. I think everyone is familiar with ordinary income tax rates and how they are determined, but if not, here is a link to an article explaining it.

Long term capital gains are treated differently.

The tax rate is based on your taxable income for the applicable year, but the rate structure is quite different from ordinary income tax rates. Below is a chart that summarizes the capital gains rates.

Filing Status0%15%20%
SingleUp to $41,675$41,675 – $459,750More than $459,750
Head of HouseholdUp to $55,800$55,800 – $488,500More than $488,500
Married filing jointly and surviving spouseUp to $83,350$83,350 – $517,200More than $517,200
Married filing separatelyUp to $41,675$41,675 – $258,600More than $258,600

It’s also worth noting that if you are a high earner, you may have to pay additional taxes on investment gains. This is called the net investment income tax and it is currently set at 3.8%.

Ok, now that we’ve got the introductory stuff out of the way, let’s get into the 12 strategies for avoiding capital gains taxes on stocks.

1. Reinvest Proceeds in Opportunity Zones

One little known way to avoid paying capital gains taxes upon the sale of appreciated stock is to reinvest the proceeds into an opportunity zone fund.

What is an opportunity zone?

It’s basically a community or neighborhood nominated by the state and certified by the Treasury Department as qualifying for this program. The Treasury has certified zones in all 50 states, as well as Washington, D.C., and U.S. territories.

As of the date of this article, there around 8,700 opportunity zones across the country.

If you want a list of opportunity zones, you can find them here.  

There are some rules you need to follow in order to qualify for this tax break, including reinvesting the proceeds within 180 days. You can gain a host of benefits by doing this, including deferred capital gains taxes, potential stepped up basis, and more.

There are a lot of opportunity zone funds out there, but here is a directory of some of them if you are interested in exploring this option.

2. Buy Stock Through Tax-Advantaged Vehicles

One of the most popular ways to avoid paying capital gains on stock is to invest through a tax-advantaged vehicle. These can include 401(k)s, IRAs (including traditional and Roth versions), Health Savings Accounts, 529 plans, and many more.

Each tax-advantaged vehicle operates differently and may be used for different purposes, but as a general rule, you can sell investments within the tax advantaged vehicle without paying capital gains taxes at the time of sale.

As with many tax breaks, you may be getting a deferral on those taxes, rather than an outright elimination of them, but, as you probably can appreciate, even a deferral can be enormously valuable because that money that would have otherwise gone to the IRS can be deployed to make you even more money.

3. Use a Margin Loan to Cover Short Term Cash Needs

If the reason you want to sell your appreciated stock is to cover a one-time expense, like a tax bill, a down payment on a house, and so on, you may want to consider taking out a margin loan against assets in your brokerage account, rather than liquidating appreciated stock.

What is a margin loan? It’s a loan that you get from your broker that is based on the value of the assets in your brokerage account. To access this, you would need to apply for and get approved for a margin account at your brokerage.

The reason why taking a temporary margin loan may be better than selling stock is that the interest you pay on the loan may be less than the capital gains hit you may take if you sell your stock. Of course, you should do the math to make sure that’s the case.

Now I want to emphasize that using a margin account entails some risk – if the value of the securities falls below certain thresholds, you may experience a “margin call” which will require you to add more money to your account.

In some case, the brokerage firm may even liquidate some of your stock without your permission if the stock price is rapidly declining, which would lock you into a loss, so you should definitely proceed with caution.

4. Use a HELOC or Other Line of Credit

If you don’t like the risk of a margin call, you may want to look at other low-cost lines of credit, like a home equity line of credit (HELOC) if you have a one-time expense coming up. These tend to have fairly attractive interest rates as well, but you want to make sure you don’t default on payments.

Remember that HELOCs are secured by your home, so defaulting on payments could really put you in a serious jam.

5. Be Strategic With Your Tax Brackets

One of the simplest ways to reduce capital gains taxes is to hold on to the appreciated stock for more than a year.

This will convert the gains on that stock from a short term capital gain to a long term capital gain. In general, tax rates may be lower for long term capital gains than for short term capital gains.

Of course, you have to weigh the benefit of a better tax rate against the risk that the stock will go down in value while you wait.

Another thing to consider is that while long-term capital gains may be taxed at a lower rate, realizing these capital gains can put you into a higher overall tax bracket because those capital gains will count as a part of your income.

So if you are near the top of your regular income tax bracket, you may want to wait to sell your stock until a later time when you’re not skirting the edge of a higher tax bracket or when you have deductions that can keep you below the higher tax rate.

6. Tax Loss Harvesting

A common strategy to reduce capital gains is to offset your gains with losses (referred to as tax loss harvesting). So if your shares in Company A have gone up by $100, but your shares in Company B have gone down by $50, you can sell both and only be subject to capital gains taxes on the $50 net profit.

Now there are certain limitations and rules that come into play, such as the $3,000 limit on deductions for net capital losses, and rules against wash sales, but notwithstanding that, tax loss harvesting is a popular tactic that is used by investors to offset their capital gains. Source

7. Donate Stocks to Charity

If you have a favorite charity that you would like to donate to, you may want to consider donating your appreciated stock, rather than selling the stock and paying the charity from the proceeds.

That’s because if you donate the stock directly, you can still get the full deduction for the market value of the stock and won’t have to pay capital gains on that donation if you have held that stock for more than a year.

It can be a true win-win.

8. Qualified Small Business Stock

If you own shares in a private company, have held them for at least five years, and they are considered qualified small-business stock (QSB), you may be eligible to get an an income exclusion of up to $10 million or 10 times their cost basis.

To qualify for this, the company has to have gross assets that are not valued at over $50 million when it issued you the shares.

It’s a pretty narrow exception and won’t apply to most people, but I am including it for the sake of completeness. If you want to learn more, check out the article on the topic here.

9. Hold Stocks Until Death

Another strategy to avoid capital gains tax for stocks is to hold onto the stocks until death. Upon death, the stock gets stepped-up basis, which means that the new basis in the stock is the fair market value of the stock as of the date of death.

Thus, all of the appreciation that occurred while you held the stock during your lifetime is not taxed and the recipients of the stock will only need to pay tax on increases to the value of the stock after the date of death.

For High Rollers

Ok – we covered the strategies that are generally available to average folks like you and me. But as promised at the start, below are some exotic and complex strategies that are used by very rich people. These strategies are often only available to folks who have accumulated significant capital gains or have meaningful wealth.

10. Use Securities-Based Lending Programs to Meet Short Term Cash Needs

If you have short term cash needs but don’t want to liquidate your stock portfolio and trigger capital gains taxes, you can open up a line of credit under a securities-based lending program (sometimes known as a collateral lending program).

You will be able to tap into that line at relatively low interest rates and save a ton of money on taxes by not having to liquidate any appreciated stocks to meet that short term cash need.

It is similar to a margin account, but the lines are high, interest rates are relatively attractive, and the assets that are serving as collateral need to be in a dedicated account where you can’t withdraw funds or margin the assets.

Wealthy people can (and do) use the line of credit to buy real estate, invest in a business, or even pay taxes, take vacations or buy personal property.

If you want to learn more, TD Ameritrade offers a program that you can explore.

11. Trade Highly Appreciated Single Stock into an Exchange Fund

If you have a lot of appreciation locked up in a single stock and want to diversify your risk without triggering capital gains taxes, a little known strategy is trading in your shares for shares in an exchange fund.

According to Investopedia, an exchange fund, also known as a swap fund, is an arrangement where a group of investors with concentrated holdings agree to contribute their shares into an exchange fund. As more investors participate, the exchange fund’s holdings becomes more diversified.

This allows the investor to exchange their large holding of a single stock for units in the entire pool’s portfolio and defer their capital gains tax.

Note: Exchange funds should not be confused with exchange traded funds (or ETFs), which are securities that are similar to mutual funds and are traded on stock exchanges.

There are exchange funds for private company shares as well as public company shares, so you can avail yourself of this option regardless of the type of stock you own, however, the bar to participate is high.

In many cases, you need to have at least $5 million in shares to participate and will be required to lock up those shares for a minimum of 7 years. Source

12. Set Up a Charitable Remainder Trust (CRT)

If you have a charitable bent, but want to get the benefit of tax-advantaged income and capital gains treatment, one option is a charitable remainder trust. It’s an estate planning tool that allows you to get income from your assets during your retirement years and eventually make a donation to your charity of choice.

If you have a highly appreciating asset (like a stock) and place it into a charitable remainder trust, you can sell that asset and buy something that provides income. The CRT won’t pay taxes on that sale. Instead, the capital gains taxes will be deferred and paid by the beneficiaries over time. Source

This is a complex vehicle and is usually used when there are significant assets to place into the CRT. You should definitely consult with your financial, tax and legal advisors before setting one up.


So there you have it – 12 strategies to help you avoid capital gains taxes for stocks.

If you want to learn more about basic personal finance principles, check out my article on the Five Pillars of Personal Finance, which covers all of the basics and includes tips to get your financial house in order.

If you are looking for more advanced tips, check out my article on 9 Advanced Personal Finance Tips, which goes into unconventional and little known strategies that can take your finances to the next level.