Skip to content
SuperMoney logo
SuperMoney logo

How to Avoid Capital Gains Tax on Stocks

Last updated 03/15/2024 by

Bryce Sanders

Edited by

Fact checked by

Two of the primary ways the U.S. government taxes individuals are by taxing income and taxing investment gains. The government encourages investing for the long term by setting a lower tax rate on realized profits from investments held longer than one year. There are commonly used strategies to defer or reduce capital gains taxes, but generally speaking, you cannot legally eliminate them entirely.
It’s good to be a government. Imagine a world where other people take all the risks by putting their money on the line, and if the risk pays off, you collect part of their profits. It’s nice work if you can get it. That’s the concept behind capital gains tax.
There are ways to minimize capital gains tax, but they can’t be completely avoided. The government is quite determined to get its share. They are willing to wait, but sooner or later, they want to get their piece of your pie.

Why do we need taxes?

We live in a society that places high value on free enterprise. As a country, we want people to risk their capital and make money. The government provides many services to aid the public, including a social safety net, but these cost money. And the government is primarily funded through taxation.
There are many types of taxes, but for now, let’s focus on two types of individual taxes: income taxes and capital gains taxes. Income tax relates to the money you earn, such as from your day job. Capital gains tax applies to money you make by putting other money to work.

Terminology: Taxation has its own language

To understand how to avoid taxes on capital gains, you first need to understand tax terminology.
  • Ordinary income. This is also known as gross income. It refers to everything you make, including salary, wages, and bonuses. It also includes dividends and interest income. This is the starting point for determining your tax bracket.
  • Adjusted gross income. The object is to get your income number down. This is your ordinary income amount minus expenses like student loan interest, retirement account contributions, and alimony payments. Your accountant or tax advisor can tell you more about this.
  • Taxable income. Here’s where we get to the serious business. Deductions you are allowed to make should bring your income to the lowest legal level.
  • Ordinary income tax rates. This is the percentage the government takes. It’s based on a graduated scale. The more you earn, the larger the percentage the government wants.
  • Capital gains. Investment involves risk. When you invest, you are risking your capital. When you make a profit, that’s called a capital gain.
  • Capital losses. Similar to the above point, when you lose money, you are incurring a capital loss.
  • Offset capital gains. Subtract losses from gains to reduce the taxable amount.
  • Short-term investments. These are transactions that start and end in one year or less.
  • Long-term investments. These are transactions that last longer than one year. The starting point is “a year and a day.”
  • Realized gains or losses. You have bought and sold a security, leading to a gain or loss. This creates a taxable event.
  • Unrealized gains or losses. You bought and can see the profits or losses on paper, but you haven’t sold yet.
  • Capital gains tax. This is the portion of your profits that goes to the government.

How do taxes on capital gains work?

The government uses the tax system to influence financial behavior. Generally, they encourage you to put money to work for a long time, so that companies can invest in projects that take time to mature instead of focusing on making a quick buck.
Capital gains taxes are divided into two categories: long-term and short-term. The dividing line is one year. If you purchase a stock, piece of real estate, or other investment and sell it at a profit less than a year later, the short-term capital gains tax rate is the same as your personal income tax rate for ordinary income. For example, if you are a married couple in the top federal income tax bracket of 37%, you are paying 37% in capital gains taxes on those profits.
But remember how the government encourages you to invest for the long term? Well, if you hold your stock for longer than a year, then sell it at a profit, you would be taxed at the more favorable rate of 15% (though it can be as high as 20% if you have a very high taxable income, like $459,750 for a single filer).
In other words, if you hold your stock for the long term, you can cut your capital gains taxes almost in half!

Realized and unrealized gains

Capital gains taxes become relevant only when you sell your investment. Basically, if you held it forever, you would never pay any capital gains taxes on it. You might wonder if those taxes will disappear if you die before selling your investment. Don’t worry, the government has a contingency for that (more on that later).
If you sell a stock for more money than you paid for it, that’s a realized capital gain. If you buy a stock that rises but don’t sell it, that’s an unrealized capital gain. These are often called “paper profits” because those profits can disappear. You can’t spend cash that you haven’t put in your pocket yet!

What about losses?

If gains are possible, then so are losses. That’s just common sense. Many investors have multiple investments going at the same time, like a short-order cook in a diner preparing a dozen orders on the grill at once.
The government allows you to aggregate your gains and losses, setting them off against each other. Your long-term gains are matched up against your long-term losses.
You’ve traded stocks all year. You have some long-term gains and some long-term losses. You also have some short-term gains and short-term losses. After doing the math, you end up with some short-term gains and some long-term losses. The government allows you to add up those numbers, leaving you with a single total gain or loss. That’s an advantage because your net long-term losses can help offset your short-term gains.
You knew the government would make this complicated, didn’t you?

What if I have lots of losses?

Suppose you are either terrible at investing or the stock market had a horrible year. In the end, you have more losses than gains. The government allows you to offset up to $3,000 in losses against your taxable income. If you have more than $3,000 in realized losses, you can apply some to next year’s taxes. This is called a “tax loss carryforward.”
Here’s a key takeaway: If you make a lot of money on realized capital gains, the government will immediately collect taxes on all your profits. But if you lose a lot of money, you can only offset $3,000 in a given year, while the rest gets pushed forward.

Strategies for avoiding capital gains taxes

Feeling overwhelmed yet? Now comes the fun part: there are some strategies you can use to avoid a portion of your capital gains taxes. Let’s take a look at a few of them now.

Strategy #1: Take advantage of your low income tax bracket

This is going to sound crazy, but hear me out. If you are married and have taxable income under $83,350, you are in the 0% federal income tax bracket. That means if you have short-term capital gains taxed at your federal income tax bracket, you don’t pay taxes! And the same applies to long-term capital gains!
Now you understand why you need a good accountant. They can help you get all the deductions you’re legitimately entitled to and reduce your adjusted gross income.

Strategy #2: Invest for the long term

Hold your stock until your unrealized gains transition from short-term gains to long-term gains. This is risky because the longer you invest, the less certain the outcome. But if you are in a higher personal income tax bracket, you can reduce your liability from 37% to 20%.

Strategy #3: Die before selling your investments

This is the most extreme strategy: die with your securities. No, you can’t take them with you, but they do undergo an amazing transformation. Your unrealized gains, which are now part of your investment portfolio, become part of your overall estate.
The federal government expects estate taxes (which can be as high as 40%!). Here’s the good news: the first $12.06 million is exempt from estate taxes! That means your heirs will benefit from a stepped-up cost basis calculated from the date of your death. Plus, spouse-to-spouse transfers tend to be unlimited! But beware, rules can change.

Strategy #4: Tax-loss harvesting

Suppose you owned a stock that was bought out for cash by another company. All of a sudden, you’ve got a big tax liability staring you in the face. One solution is tax-loss harvesting. You and your financial advisor look for stocks and other investments that didn’t work out. You sell those and use the realized losses to help offset that big realized gain.
Now suppose you really wanted to keep owning that stock with a loss. No problem, just buy it back. But you need to wait longer than 30 days. Why? Otherwise, the government would think you weren’t really taking a risk that the stock wouldn’t rapidly appreciate. They would consider the sale and purchase a wash sale, negating the loss you realized.

Strategy #5: Donate your stocks to charity

Be generous! Remember how the government uses taxes to influence financial behavior? They want wealthy people to give lots of money to charity, which is why they offer a huge tax write-off as an incentive.
If you want to give $100,000 to a charity, you could simply hand over a check and be done with it. You could sell some appreciated stock to cover that check, but then you would owe taxes on the gain. Alternatively, you could transfer $100,000 worth of appreciated stock to the charity. Then they could sell the stock without owing taxes (because they are a registered nonprofit), and you would get the charitable deduction for the full value of the stock.

Strategy #6: Use a tax-deferred retirement account

This could be considered a shooting-yourself-in-the-foot strategy because it only delays your current tax liability. Buy your stock with funds you contributed to an IRA or other tax-deferred retirement account. You can buy and sell as often as you like; taxes are deferred because these are tax-advantaged retirement accounts.
There are two problems with this strategy. First, any money you withdraw is taxed as ordinary income; it’s not treated as a long-term capital gains tax. Second, if you make bad investments that lose you money, you can’t claim those losses against your taxes.

Strategy #7: Shelter your capital gains in real estate

We haven’t talked about real estate yet. Isn’t a house the largest asset most people will own in their lifetime? The government is enthusiastic about the concept of homeownership; that’s why they give a special exclusion to shelter capital gains when you sell your principal residence. After living in a house for at least two years, single filers can shelter $250,000 in gains, while married filers can double that to $500,000.
Another option to avoid capital gains taxes on real estate is a 1031 exchange, which lets you defer taxes on profits from business property sales used to purchase other properties. However, there are restrictions regarding personal use, so it’s not an option if the only real estate you’re selling is your house.

Pro Tip

The government isn’t going to let you entirely get away with sidestepping capital gains taxes. There are ways you can reduce, defer, or eliminate a portion of them, but this is not the kind of advice you’d get from your barber and implement on your own. Consult a good tax relief professional, attorney, financial advisor, or real estate attorney before trying any of these strategies. Remember, “tax minimization is legal. Tax avoidance is not.”

SuperMoney may receive compensation from some or all of the companies featured, and the order of results are influenced by advertising bids, with exception for mortgage and home lending related products. Learn more

Loading results ...


How much do I pay in capital gains tax?

It depends on your tax bracket. Generally speaking, short-term gains align with your personal income tax bracket at the federal level, which can be as high as 37%. Long-term gains are taxed at 15%–20%. If your taxable income puts you into the 0% bracket, your capital gains are also taxed at that level. And don’t forget, although most advice focuses on federal taxes, states also tend to tax capital gains.

What happens if I don’t declare capital gains tax?

The government will know. Financial service firms report transaction information; if they send it to you, they also send a copy to the government. In most cases, you’ll simply pay a penalty on what you owe based on how long it’s overdue. More seriously, you could be charged with tax evasion, which can lead to jail time. Overall, it’s best to just pay all your taxes on time.

How do you calculate capital gains?

Start by separating your short- and long-term transactions. Offset gains with losses until you have a single outstanding amount in each category, then add those numbers together to get your overall gain or loss for the year.

Do I have to pay capital gains tax immediately?

It depends on how you define “immediately.” Your taxes are expected to be paid in full on April 15. You owe capital gains tax when you pay the rest of your tax bill.

Can I avoid capital gains tax if I buy another house?

Terminology matters. You cannot sell your principal residence and buy another house with the profits without incurring a capital gains tax liability. However, the 1031 exchange allows you to defer capital gains tax on investment real estate, provided you use the profits to buy other investment properties.

Key Takeaways

  • When you invest, the government shares in your profits by collecting taxes on capital gains.
  • The taxes on short-term gains (profits made in one year or less) are higher than those on long-term gains. This is to encourage people to invest for the long term.
  • There are strategies you can use to minimize or defer capital gains taxes.
  • Consult a tax attorney or real estate attorney to ensure you are minimizing your capital gains taxes legally. You don’t want to accidentally end up on the wrong side of the IRS for tax evasion!

SuperMoney may receive compensation from some or all of the companies featured, and the order of results are influenced by advertising bids, with exception for mortgage and home lending related products. Learn more

Loading results ...

Bryce Sanders

Bryce Sanders is president of Perceptive Business Solutions Inc.  He provides HNW client acquisition training for the financial services industry.  His book, “Captivating the Wealthy Investor” is available on Amazon. Bryce spent twenty years with a major financial services firm as a successful financial advisor. He has been published in 40+ metro market editions of American City Business Journals, Accountingweb, NAIFA’s Advisor Today, The Register, LifeHealthPro, Round the Table, the Financial Times site Financial Advisor IQ and

Share this post:

You might also like