How to Avoid Capital Gains Tax on Stocks (7 Tricks You Need to Know)

Capital gains taxes are incurred whenever stocks are sold for more than an investor paid for the shares. But is there a way you can lower how much you'll owe?
Last updated Oct 22, 2021 | By Roger Wohlner | Edited By Becca Borawski Jenkins
How to Avoid Capital Gains Taxes on Stocks

FinanceBuzz is reader-supported. We may receive compensation from the products and services mentioned in this story, but the opinions are the author's own. Compensation may impact where offers appear. We have not included all available products or offers. Learn more about how we make money and our editorial policies.

Capital gains are incurred when shares of a stock are sold for more than you paid for them. The exact taxes on these gains will depend upon how long the shares were held.

Understanding how capital gains taxes work can help you manage the tax bill incurred from stock sales, which is a smart money move when you’re trying to build wealth. When investing money you should always understand how it could be taxed.

Here’s how capital gains tax works with taxes, and how you might avoid a big capital gains tax bill.

DiversyFund - Our pick for getting started in real estate

  • $500 minimum investment
  • Co-own a professionally managed portfolio of real estate assets
  • No platform or management fees
  • New investors can get a $50 Amazon gift card by using code FB50
In this article

What are capital gains taxes?

Capital gains as they pertain to stocks occur when an investor sells shares of an individual stock, a stock mutual fund, or a stock ETF for more than they originally paid for the investment. For example, if you buy 100 shares of a stock at $25 per share and later sell them for $40 per share you will have realized a capital gain of $15 per share or $1,500 total on the 100 shares.

ETFs and mutual funds can also incur capital gains realized from the sales of the stocks held within the mutual fund or ETF.

The Internal Revenue Service defines capital gains as either short-term or long-term:

  • Short-term capital gains: Capital gains on stocks that are held for less than one year are taxed at your ordinary income tax rate. There is no different treatment for tax purposes.
  • Long-term capital gains: If the shares are held for at least one year, the capital gain is considered to be long-term. This means the gain is taxed at the long-term capital gains tax rate, which is lower than the ordinary income tax rates for many investors.

Note: Capital gains on stocks are taxed differently than capital gains on a home sale.

How capital gains on stocks are taxed

The tax rates on long-term capital gains vary a bit based on your filing status and your adjusted gross income (AGI). Here are the capital gains tax rates for both the 2020 and 2021 tax years for the various tax filing statuses.

The first column indicates the percentage of tax that will be applied to your capital gains. Columns two through five indicate your filing status and income level.

Tax year 2020

Capital Gains Tax Rate AGI – Single Filers AGI – Married Filing Jointly AGI – Head of Household AGI – Married Filing Separately
0% $0 - $40,000 $0 - $80,000 $0 - $53,600 $0 - $40,000
15% $40,001 - $441,450 $80,001 - $496,600 $53,601 - $469,050 $40,001 - $248,300
20% $441,451 or more $496,000 or more $496,000 or more $248,301 or more

Tax year 2021

Capital Gains Tax Rate AGI – Single Filers AGI – Married Filing Jointly AGI – Head of Household AGI – Married Filing Separately
0% $0 - $40,400 $0 - $80,800 $0 - $54,100 $0 - $40,400
15% $40,401 - $445,850 $80,801 - $501,600 $54,101 - $473,750 $40,401 - $250,800
20% $445,851 or more $501,601 or more $473,751 or more $250,801 or more

In addition to these rates, there is an additional capital gains tax for higher-income investors called the net investment income tax rate. This rule adds 3.8% to the capital gains tax for investors over certain income thresholds.

For 2021, you will owe net investment income tax if your annual income (measured as modified adjusted gross income or MAGI) is above the following thresholds:

  • Single or head of household: $200,000
  • Married filing jointly: $250,000
  • Married filing separately: $125,000

How to avoid capital gains taxes on stocks

Managing the tax impact when investing in stocks is always a good idea. However, tax considerations should simply be a part of the process and not the driver of your investing decisions. That said, there are many ways to minimize or avoid the capital gains taxes on stocks.

1. Work your tax bracket

While long-term capital gains are taxed at a lower rate, realizing these capital gains can push you into a higher overall tax bracket as the capital gains will count as a part of your AGI. If you are close to the upper end of your regular income tax bracket, it might behoove you to defer selling stocks until a later time or to consider bunching some deductions into the current year. This would keep those earnings from being taxed at a higher rate.

2. Use tax-loss harvesting

Tax-loss harvesting is an effective tool whereby an investor intentionally sells stocks, mutual funds, ETFs, or other securities held in a taxable investment account at a loss. Tax losses can be used in several ways including to offset the impact of capital gains from the sale of other stocks.

Capital losses are used to offset capital gains as follows:

  • Long-term losses offset long-term gains
  • Short-term losses offset short-term gains

Any excess losses of either type are used to offset additional capital gains first. Then, to the extent that your losses exceed your gains for the year, up to $3,000 may be used to offset other taxable income. Additional losses can be carried over to use in subsequent tax years.

A key point is to ensure that you avoid a wash sale when using tax-loss harvesting. The wash sale rule says an investor cannot purchase shares of an identical or substantially identical security 30 days before or within 30 days after selling a stock or other security for a loss. Essentially this creates a 61-day window around the date of the sale.

For example, if you plan to sell shares of IBM stock at a loss, you must refrain from buying shares of IBM during that 61-day span. Similarly, if you sell shares of the Vanguard S&P 500 ETF at a loss and then buy another ETF that tracks the same index, that might be considered “substantially identical.”

Violating the wash sale rule would eliminate your ability to use the tax loss against capital gains or other income for that year. This rule also extends to purchases in accounts other than your taxable account, such as an IRA. If you have questions about what constitutes a wash sale, it's best to consult your financial advisor.

Many of the top robo-advisors like Wealthfront automate tax-loss harvesting, making it simple even for novice investors.

3. Donate stocks to charity

Donating shares of stock to a charity offers two potential tax benefits:

  1. You will not be liable for taxes on any capital gains due to the increased value of the shares.
  2. The market value of the shares on the day they are donated to the charity can be used as a tax deduction if you are eligible to itemize deductions on your tax return. Your total itemized deduction needs to exceed the amount of the standard deduction for the current tax year and your filing status to be eligible.

4. Buy and hold qualified small business stocks

Qualified small business stock refers to shares issued by a qualified small business as defined by the IRS. This tax break is meant to provide an incentive for investing in these smaller companies. If the stock qualifies under IRS section 1202, up to $10 million in capital gains may be excluded from your income. Depending on when the shares were acquired, between 50% and 100% of your capital gains may not be subject to taxes. It's best to consult with a tax professional knowledgeable in this area to be sure.

5. Reinvest in an Opportunity Fund

An opportunity zone is an economically distressed area that offers preferential tax treatment to investors under the Opportunity Act. This was a part of the Tax Cuts and Jobs Act passed in late 2017. Investors who take their capital gains and reinvest them into real estate or businesses located in an opportunity zone can defer or reduce the taxes on these reinvested capital gains. The IRS allows the deferral of these gains through December 31, 2026, unless the investment in the opportunity zone is sold before that date.

6. Hold onto it until you die

This might sound morbid, but if you hold your stocks until your death, you will never have to pay any capital gains taxes during your lifetime. In some cases, your heirs may also be exempt from capital gains taxes due to the ability to claim a step-up in the cost basis of inherited stock.

The cost basis is the cost of the investment, including any commissions or transaction fees incurred. A step-up in basis means adjusting the cost basis to the current value of the investment as of the owner’s date of death. For investments that have appreciated in value, this can eliminate some or all of the capital gains taxes that would have been incurred based on the investment’s original cost basis. For highly appreciated stocks, this can eliminate capital gains should your heirs decide to sell the stocks, potentially saving them a lot in taxes.

7. Use tax-advantaged retirement accounts

If stocks are held in a tax-advantaged retirement account like an IRA, any capital gains from the sale of stocks in the account will not be subject to capital gains taxes in the year the capital gains are realized.

In the case of a traditional IRA account, the gains will simply go into the overall account balance that won’t be subject to taxes until withdrawal in retirement. In the case of a Roth IRA, the capital gains will be part of the account balance that can be withdrawn tax-free as long as certain conditions are met. This tax-free growth is one reason many people opt for a Roth IRA.

You can open a retirement account using one of our picks for the best investment apps, such as Stash1 or Public.

Stash Benefits

  • Get $10 to make your first investment
  • Invest in stocks, bonds, and ETFs
  • Fractional shares available
  • Start investing with just $1

FAQs

How long do you need to hold a stock to avoid capital gains tax?

If you sell shares of stock for a price greater than the amount you paid for the shares, you will be subject to capital gains no matter how long you have owned the shares. If you’ve held the shares for less than one year, the gains will be considered short-term. If you’ve held the shares for at least a year, they will be considered long-term. The advantage of paying long-term capital gains taxes is that the rates are lower than short-term capital gains taxes for most taxpayers.

Do I pay taxes on stocks I don't sell?

If you don’t sell shares of stock that you own, there are no capital gains taxes due, even if the shares increase in value. If you hold the stocks until you die, they would pass to your heirs, who may or may not owe taxes on the inheritance. If the stock pays a dividend, these payments would be taxable to you while holding the shares, but this is not a capital gains tax.

What happens if you don't report stocks on taxes?

You typically don’t have to report that you own shares of a stock on your taxes. You do have to report any income earned from those shares whether from capital gains due to the sale of the shares or from dividends earned while holding the shares.

Failure to report this income and pay the appropriate taxes could be a crime. Brokerage firms will directly report the proceeds from the sale of stock to the IRS. The company issuing the dividend will also report this income to the IRS. If these amounts are not reflected on your tax return, this could be a red flag for the IRS.


Bottom line

Stocks could be a solid wealth-building tool for some investors. But it’s important to understand how stocks can be taxed and to take those tax implications into account in your financial planning.

Incurring capital gains means that you have sold shares of a stock for more than you paid for it, but proper tax planning can help manage your tax liability. If you have questions about your specific tax situation, you might consider speaking with a tax advisor.

Secure a will for your family in 15 minutes or less

What would happen to your family if tomorrow you were suddenly gone? You might think estate planning is for the wealthy or elderly, it’s a good idea for anyone with a family or assets to start thinking about it. 

Creating a complete Estate Plan with Trust & Will means your spouse, family, pets, assets, future, and legacy will be handled the way you want if something happens to you. It takes just a few minutes, but could keep your loved ones safe and provided for long after you’re gone.

Secure your future


DiversyFund Benefits

  • Co-own a professionally managed portfolio of real estate assets
  • Create your free account in just 5 minutes
  • No platform or management fees
  • Use code FB50 and get a $50 Amazon gift card when you make your first investment

Author Details

Roger Wohlner In addition to his bylined articles on sites like TheStreet, ThinkAdvisor, and Investopedia, Roger ghostwrites extensively for financial advisors, investment managers, and financial services companies.