• Discounts and special offers
  • Subscriber-only articles and interviews
  • Breaking news and trending topics

Already a subscriber?

By signing up, you accept Moneywise's Terms of Use, Subscription Agreement, and Privacy Policy.

Not interested ?

Young woman makes some calculations. Small paper house, coins, car in the background. Closeup

How to avoid capital gains tax on your investments

Tolikoff Photography / Shutterstock


Updated: August 10, 2023

Partners on this page provide us earnings.

The IRS comes knocking whenever you make money. This is true even when you make money from your investments. You must pay capital gains tax when you sell your investments at a profit. That's part of life. However, you can reduce what you owe. You just need to take certain steps to offset your gains. Here's how to avoid capital gains tax and offset some of your capital gains taxes.

3 ways to avoid capital gains tax

There are myriad ways to avoid capital gains tax on stocks, but we're going to focus on the three most common.

1. Hold appreciating assets in a tax-sheltered retirement plan

This can include a traditional or Roth IRA, a 401(k) or 403(b) plan, or a SEP IRA or SIMPLE IRA. Since each plan features deferral of investment income, any capital gains realized within the plan will not be subject to immediate taxation. This includes both short-term and long-term capital gains.

Technically speaking, the capital gains tax will never specifically be applied to these transactions. Funds held in a tax-deferred retirement plan don't become taxable until they're withdrawn. And once they are, they're taxed at the regular tax rate. But you'll largely be able to control the tax liability by limiting the size of the withdrawals you take from any of these plans.

2. Offset capital gains with capital losses

The IRS allows you to deduct capital losses from capital gains before calculating your capital gains tax liability. Basically, if your investment portfolio generates $20,000 in capital gains, but you also have $12,000 in capital losses, your net capital gains subject to tax is just $8,000.

Offsetting capital gains with capital losses is even a formal investment strategy known as tax-loss harvesting. It's common practice with robo-advisor investment platforms.

3. Don't sell your investments

A capital gain doesn't become taxable until the investment is sold and the profit is realized. If you never sell the asset, it can continue to grow in value without creating a tax liability. This is a form of backdoor tax deferral, similar to tax-sheltered retirement plans.

Naturally, this strategy will work best with investments in companies with very strong long-term growth and income prospects. In theory, at least, you can hold the stock for 20 years and watch it grow in value tenfold and never incur capital gains tax.

But a more conventional way to do this is with index-based ETFs. Since stocks in the fund are rarely sold, the ETF can continue to build in value as the years' pass. Later, when you may need to draw income from the fund, you can begin taking it in small amounts. Those small withdrawals will also limit your capital gains income from the sale of portions of the ETF.

That will not only minimize the tax but also defer the liability until well into the future. And since selling a portion of an ETF is like selling stock, the sales will get the benefit of lower long-term capital gains tax rates.

How to offset capital gains tax

You can offset what you owe for capital gains by using your capital losses. When you sell an asset at a loss, that loss can be used to offset profits from other assets.

For example, let's say you realize a profit of $1,000 from the sale of one stock and see a loss of $800 in a different stock. You can take that $800 in losses and use it to offset part of your $1,000 in gains. Now you have a net capital gain of only $200. You pay tax on that smaller $200, rather than the larger gain.

In general, you start off by using short-term capital losses to offset short-term gains and long-term losses to offset long-term gains. However, if you still have other losses left over at the end, it's possible to use them to offset the other type of gain.

Using capital losses to offset regular income

In addition to using your losses to reduce the amount of your taxable capital gains, you can also use capital losses to reduce your regular income by up to $3,000 per year. However, you can use losses only after you have offset any capital gains you may have. You can't use losses to reduce your regular income until after you've offset all of your capital gains.

For example, let's say you sell some shares and realize a gain of $5,000. You also unload some stock that hasn't been performing well, and you realize a loss of $10,000.

Your first step is to take that $10,000 loss and use it to offset the capital gain of $5,000. Because there's enough to offset your gains completely, you don't have to pay any capital gains tax at all.

Now, you can take $3,000 of the remaining $5,000 in losses and reduce your taxable income. So if your taxable income is $42,000, now you can reduce it and pay tax on only $39,000. In some cases, using your capital losses can help you inch into a lower tax bracket. It depends on your income and what other deductions you have.

Carry forward your capital losses

Not only can you use your capital losses to offset your capital gains and income in the current tax year, but your losses carry forward indefinitely. There's still a $2,000 loss available after offsetting gains and reducing taxable income in the example above. That $2,000 can be used in the coming year to offset further capital gains or even reduce taxable income.

Now, let's say you've been disappointed with a stock that you've been hoping would turn around but never did. You finally give up and sell the shares, realizing a loss of $15,000. This year, you have $2,000 in realized capital gains, so you offset those. Then you reduce your taxable income by $3,000. You use a total of $5,000 of your losses, leaving you to carry forward $10,000.

Next year, you don't have any capital gains to offset. So you just take $3,000 to reduce your taxable income and carry forward the remaining $7,000. The following year, you have $2,000 in capital gains, so you offset that and also take your taxable income deduction. Even after all that, you'll still have another $2,000 in losses to carry forward into the fourth year.

Because losses can be carried forward indefinitely, some investors choose to “harvest” losses near the end of the year.

Watch out for the IRS wash sale rule

When hoping to take advantage of capital gains, it's important to avoid falling afoul of the “wash sale” rule. A wash sale occurs when you sell a stock and then buy the same thing or something “substantially identical” within 30 days, either before or after the sale.

In such a case, you can't use the capital losses to offset capital gains or reduce your income. This prevents investors from seeing tax benefits if they sell at a loss and then turn around and buy the same thing for even less if it goes lower.

Sell smart

The way you manage your portfolio can impact your tax bill and your ultimate bottom line. It's not always a terrible thing to sell at a loss. However, it's best to use those losses in a way that offsets your gains and reduces your taxable income.

Consult with a financial or tax professional who can help you make a plan for selling your assets (whether for gains or losses) in a way that makes the most sense for your long-term tax efficiency.

More: What are the most tax-efficient investing strategies?

How to reduce capital gains tax

Whenever you have a capital gain, you'll need to pay tax on the amount. However, the government prioritizes a buy-and-hold approach to investments. So there is a difference between long-term and short-term capital gains. This helps to promote a degree of stability in the markets and the economy.

  • If you buy an asset and then sell it within a year, it's called a short-term capital gain. This will be taxed at your regular income tax rate.
  • If you hold your assets for more than a year before selling, it's considered a long-term capital gain. You'll pay a lower tax rate on long-term gains.

You can reduce your capital gains tax by selling only investments that you've held for more than a year. That way, you have access to a lower rate. In fact, depending on your income and filing status, you might not have to pay any capital gains tax at all on long-term assets. If you have to pay tax on your long-term gains, it will be 15% or 20%.

Your broker will also likely provide you with the necessary information at tax time, showing you your gains and losses. You can also use a tax software to do your taxes.

Compare tax preparation software

Tax prep software Feature
TurboTax Premium Full range of tax-filing products
TaxAct Premier+ Easiest for investors
H&R Block Premium Unlimited real-time tax advice
TaxSlayer Premium All needed tax breaks for investments
Cash App Fast, easy and secure online tax filing

Capital gains tax FAQ

  • What are capital gains and losses?


    Your capital gain or loss is the difference between what you pay for an asset and what you sell it for. You realize gains or losses only when you actually sell. You don't pay tax (or report a loss) as long as the asset remains in your investment portfolio without being sold.

    A capital gain is your profit from selling an asset. If you buy stock shares for $2,000 and then sell them later for $3,000, you have realized a profit (or gain) of $1,000.

    A capital loss is the opposite. If the investment goes down in value and you sell those same shares for a total of $1,500, you've realized a capital loss of $500.

  • What's the difference between long-term and short-term capital gains?


    Capital gains are categorized as long-term gains or short-term gains. It's important to understand the difference because these gains are taxed at different rates.

    Long-term capital gains are those held for more than a year. You need to hold an asset for a year and a day for it to be considered a long-term investment.

    Short-term capital gains are those held for a year or less.

    When planning your investments and figuring out how to move forward, it's important to consider long-term and short-term gains and how they're taxed, so you get the most efficient tax treatment possible.

  • Understanding capital gains tax brackets


    This is where the rubber meets the road. You need to figure out how much you'll pay, based on your profits.

    With short-term capital gains, you'll pay tax at your regular income rate. So if you're in a higher tax bracket, that's the rate you'll see with your short-term capital gains. Your tax bill can get quite steep if you've seen substantial gains during the year.

    On the other hand, long-term capital gains come at a more favorable rate. You're taxed on them at a lower rate. In general, the government likes to encourage long-term investing rather than short-term speculation. As a result, investors who hold their assets for a longer period enjoy more favorable tax treatment.

  • How are collectibles taxed?


    You need to be aware that some assets fall into the category of “collectible.” These assets have a long-term capital gains tax rate of 28%. Some items that are considered collectibles include:

    • Rare coins

    • Rare books

    • Rare stamps

    • Baseball cards

    • Antiques

    • Fine wine

    • Art

    • Some jewelry

    • Classic cars

    • Glassware

    Also, note that gold and silver bullion profits and certain gold and silver coins are taxed at the collectible rate.

    For those in higher tax brackets, the long-term collectible rate is still favorable. However, for those in a tax bracket lower than 28%, it can make sense to sell collectibles within a year and pay tax at the regular rate.

    Because collectibles don't really add much to economic growth, the government doesn't see a need to treat these items with the same favor as long-term investments in stocks or real estate. And if you want to learn more ways to save on taxes on your investments, consider taking a tax course from Cofield's Concepts, an educational site from financial advisor Carter Cofield. In his tax course, you'll learn everything you need to know about how to take advantage of deductions and how taxes on investments work.

Miranda Marquit Freelance Contributor

Miranda Marquit is a journalism-trained freelance writer and professional blogger specializing in personal finance.


The content provided on Moneywise is information to help users become financially literate. It is neither tax nor legal advice, is not intended to be relied upon as a forecast, research or investment advice, and is not a recommendation, offer or solicitation to buy or sell any securities or to adopt any investment strategy. Tax, investment and all other decisions should be made, as appropriate, only with guidance from a qualified professional. We make no representation or warranty of any kind, either express or implied, with respect to the data provided, the timeliness thereof, the results to be obtained by the use thereof or any other matter.