Know Better Plan Better
Advertiser Disclosure

How to Reduce or Avoid Capital Gains Taxes

Capital gains tax

Editors Note: Our editors’ evaluations and opinions are not influenced by our advertising relationships. We may earn a commission when you click on our affiliate partners’ links. Many of the links to brands we link to may be affiliate links.

Roger Wohlner
Updated June 6, 2022
7 Min Read

Capital gains are incurred when investments like stocks, bonds, mutual funds, ETFs, real estate and others are sold for more than the cost of the investment asset. Capital gains can be realized on the sale of other assets such as real estate as well.

Capital gains on most investments are taxed at either long or short-term rates. In order to qualify for preferential long-term capital gains rates, the investment must have been held for at least a year.

Short-term capital gains are taxed at the taxpayer’s ordinary income tax rate which is often higher than the preferential long-term capital gains tax rates.

Long capital gains are taxed at 0%; 15%; or 20% depending upon your income and tax filing status. For higher income taxpayers, there is an extra 3.8% tax on top of the 20% rate bringing the top long-term capital gains rate to 23.8%. This extra 3.8% is called the net investment income tax (NIIT).

The long-term capital gains rates for 2020 based on filing status and adjusted gross income are:

Capital gains tax rateSingle filers - AGIMarried filing jointly - AGIHead of household - AGIMarried filing separately - AGI
$0 - $40,000
$0 - $80,000
$0 - $53,600
$0 - $40,000
$40,001 - $441,450
$80,001 - $496,600
$53,601 - $469,050
$40,001 - $248,300
Over $441,450
Over $496,600
Over $469,050
Over $248,300

The long-term capital gains rates for 2021 based on filing status and adjusted gross income are:

Capital gains tax rateSingle filers - AGIMarried filing jointly - AGIHead of household - AGIMarried filing separately - AGI
$0 - $40,400
$0 - $80,800
$0 - $54,100
$0 - $40,400
$40,401 - $445,850
$80,801 - $501,600
$54,101 - $473,750
$40,401 - $250,800
Over $445,850
Over $501,600
Over $473,750
Over $250,800

Capital gains taxes on some types of real estate are 25%. The rate on small business stock and collectibles is 28%.

While investing decisions shouldn’t be made exclusively for tax reasons, here are some ways to reduce or avoid capital gains taxes in your investments.

13 ways to reduce or avoid capital gains taxes

Traditional IRA and 401(k) accounts

Capital gains realized inside of a traditional IRA, or 401(k) account will simply stay in the account with no current year tax ramifications. Realized capital gains simply add to the value of these accounts that are not taxed until money is withdrawn presumably in retirement.

Roth IRA and 401(k) accounts

Money in a Roth Ira or 401(k) account grows tax-free until withdrawn in retirement. Generally withdrawals made after age 59 ½ where the account holder has met the five-year rule for the account are tax-free. Any capital gains realized inside the account will grow tax-free as well and add to the account balance. There are no current year taxes on these gains.

Health savings accounts (HSAs)

HSAs are medical savings accounts associated with high deductible health insurance plans. You contribute to the HSA on a pre-tax basis and money withdrawn from the plan to pay for qualified medical expenses comes out tax-free.

Unlike some other medical savings plans, money in an HSA can be carried over from year-to-year if not used. This makes it an ideal retirement savings account. Many HSAs offer investment accounts where you can invest in mutual funds, ETFs, stocks and other types of investments. Just like an IRA or 401(k) account, any capital gains realized will not be taxed in the current year.

Besides a withdrawal for reasons not associated with a qualified medical expense, the only time withdrawals would be taxed is if you were to decide to use the HSA like a traditional IRA after age 65. At that point withdrawals would be taxed in the same way as IRA account withdrawals.

Invest for the long-term

When investing in a taxable account, if possible be sure to hold investments with a gain for at least one year. Doing this will allow you to pay capital gains taxes at the preferential long-term capital gains rates instead of the often higher short-term rates.

Invest until death

If you hold securities and other assets like real estate until your death, you can avoid capital gains taxes during your lifetime. Under current rules, when appreciated assets are passed onto heirs at your death, these heirs receive a step-up in basis. This means that the cost basis for the heirs is the market value of the assets on the date of death.

This means that any capital gains taxes paid by the heirs if the inherited securities or other assets are sold will be based upon the stepped up cost basis based on the value at the date of your death, not your original cost basis.

Tax-loss harvesting

Over the course of the year it can make sense to sell some holdings that are showing a loss. These losses can be used to offset any realized capital gains during the year. Gains and losses are ordered as follows:

  • Long-term capital losses are used to offset long-term capital gains.
  • Short-term losses are used to offset short-term gains.

The net gains and losses are then offset against each other. Any remaining gains or losses are treated accordingly for tax purposes. Any net losses in excess of net capital gains can be used to offset up to $3,000 in other income during that tax year. Any remaining net capital losses can be carried over to a subsequent tax year.

Tax-loss harvesting can work well with periodic portfolio rebalancing when some holdings will normally be sold to bring the portfolio’s overall asset allocation back in line with your target.

When using tax-loss harvesting it is important to be cognizant of the wash-sale rules. These rules state that within a 61 day time frame including 30 days prior and 30 days after a security is sold at a loss, that same or a similar security cannot be purchased. Doing so would negate the ability to claim the loss in the sale.

This covers all accounts held by an investor. For example, if security A is sold for a loss in a taxable brokerage account, that same security could not be purchased inside of their IRA account. The same or similar security portion is important as well. For example if you sold an S&P 500 index fund from Fidelity at a loss, purchasing another S&P 500 fund from Vanguard would likely violate these rules.

Giving appreciated shares to charity

If you are charitably inclined, giving shares of appreciated stocks, ETFs, mutual funds or other types of investments to charity can help avoid paying capital gains taxes and can potentially provide a charitable deduction as well.

The shares can be given directly to the charitable organization if they are able to receive these types of gifts directly. Another alternative is to give the shares to a donor advised fund. These funds are offered by a number of popular investment custodians like Fidelity, Vanguard and others. The gift is treated as a charitable donation in the year you give the stock. The money is then invested, and you can make gifts to qualified organizations over time. Each fund has its own rules so be sure to check on these before making a donation.

Besides eliminating any capital gains taxes that would have been due if the investment had been sold, the market value of the investment on the date of the donation can be claimed as a charitable deduction for tax purposes if you are able to itemize deductions on your taxes.

Gift stocks to family members

Gifting stocks or other types of investments to family members is a way to avoid paying capital gains taxes on these investments. If the gift is made to a family member who is in a lower tax bracket than you are, they can sell the shares and pay less in taxes than you would if you sold the shares.

Generally, the recipient’s cost basis will be the cost basis of the donor if the fair market value of the stock when gifted is higher than the donor’s original cost basis. This can get complicated in some cases and it is advisable that you consult with a qualified financial advisor or tax professional regarding both the impact on your situation and that of the family member who would receive the gift to ensure this is truly a beneficial transaction.

Manage cost basis

The default at many brokers and custodians is to use an average cost based on the average purchase price of all shares of stocks, mutual funds and ETFs acquired, it might make sense to use the specific share identification method to identify the cost basis of specific shares, especially if you might be making multiple purchases of the same security.

When you decide to sell some of the shares, you can take the highest cost shares and sell those first to either minimize any capital gains or even realize a capital loss for tax purposes.

Index funds vs. actively managed funds

Actively managed mutual funds tend to throw off more capital gains distributions than index mutual funds or ETFs. Moreover, investors have no control over the timing of these distributions or the type in terms of long or short-term capital gains distributions.

Certainly taxes should not be the only consideration in investing, but when it makes sense index funds and ETFs can be more tax-efficient in terms of capital gains distributions.

Manage your tax bracket

As you can see from the charts above, long-term capital gains rates are based upon your total AGI in a given year. Short-term capital gains are taxed at your ordinary income tax rate for the year.

If it makes sense from an investment perspective, try to defer realizing capital gains to years in which your income might be lower. This is especially relevant to those whose income is variable. If possible, try to only realize gains in these lower income years, and try to manage the amount of the gain so as to not move your AGI to the next tax bracket.

1031 exchange

A 1031 exchange is a like-kind exchange that can be used to avoid both capital gains taxes and taxes connected to the recapture of any depreciation on a rental or investment real estate. Under a 1031 exchange, you would need to roll the proceeds of the sale of the property into a similar type of investment property within 180 days of the sale. The 1031 exchange is named after the section of the tax code governing this type of exchange.

Primary residence exclusion

Individuals can exclude up to $250,000 in capital gains on the sale of their primary residence. This exclusion is $500,000 for a married couple. With rising home prices in many areas of the country, this exclusion may not cover your entire gain, but it can help mitigate any capital gains tax liability on the sale of your primary residence.


Capital gains taxes are part of any investment gains you might earn on investments held in taxable accounts. Managing your capital gains tax liability can help add to your overall wealth, however avoiding capital gains taxes should not be done at the expense of making good overall investment decisions.

Related Articles