Capital Gains Tax 101

Here’s how capital gains taxes work and how you can minimize them

It’s easy to get caught up in choosing investments and forget about the tax consequences—most particularly, capital gains tax. After all, picking the right stock or mutual fund can be difficult enough without worrying about after-tax returns. But it’s important to keep consequences in mind, especially for day traders and others taking advantage of the greater ease of trading online.

Factoring in the tax impact is also important when you invest in other types of assets, such as your home.

However, figuring taxes into your overall strategy—and timing when you buy and sell—is crucial to getting the most out of your investments. Here, we look at the capital gains tax and what you can do to minimize it.

Key Takeaways

  • A capital gain occurs when you sell an asset for more than you paid for it.
  • If you hold an investment for more than a year before selling, your profit is typically considered a long-term gain and is taxed at a lower rate.
  • You can minimize or avoid capital gains taxes by investing for the long term, using tax-advantaged retirement plans, and offsetting capital gains with capital losses.

Capital Gains: The Basics

capital gain occurs when you sell an asset for more than you paid for it. Expressed as an equation, that means:

Capital Gain = Selling Price Purchase Price \begin{aligned} &\text{Capital Gain}=\text{Selling Price}-\text{Purchase Price}\\ \end{aligned} Capital Gain=Selling PricePurchase Price

Just as the government wants a cut of your income, it also expects a cut when you realize a profit on your investments. That cut is the capital gains tax.

For tax purposes, it’s useful to understand the difference between realized gains and unrealized gains. A gain is not realized until the appreciated investment is sold.

For example, say you buy some stock in a company, and a year later, it’s worth 15% more than you paid for it. Although your investment has increased in value, you will not realize any gains, or owe any tax, unless you sell it.

Which Assets Qualify for Capital Gains Treatment?

Capital gains taxes apply to what are known as capital assets. Examples of capital assets include:

  • Stocks
  • Bonds
  • Jewelry
  • Your home
  • Your vehicle
  • Collectibles

However, not every capital asset that you might own will qualify for capital gains treatment, including:

  • Business inventory  
  • Depreciable business property

Also excluded from capital gains treatment are certain items (noncapital assets) that you created or have had produced for you, such as:

  • A copyright
  • A literary, musical, or artistic composition
  • A letter, a memorandum, or similar property (e.g., drafts of speeches, recordings, transcripts, manuscripts, drawings, or photographs)
  • A patent, invention, model, design (patented or not), or secret formula

The Tax Cuts and Jobs Act (TCJA), passed in December 2017, excludes patents, inventions, models, designs (patented or not), and any secret formulas sold after Dec. 31, 2017, from being treated as capital assets for capital gain/capital loss tax purposes.

Short-Term vs. Long-Term Capital Gains

The tax that you’ll pay on a capital gain depends on how long you hold the asset before selling it.

To qualify for the more favorable long-term capital gains rates, assets must be held for more than one year. Gains on assets that you’ve held for one year or less are short-term capital gains, which are taxed at your higher, ordinary income tax rate. Please note: There are limited exceptions to the one-year holding-period rule.

The tax system in the United States is set up to benefit the long-term investor. Short-term investments are almost always taxed at a higher rate than long-term investments.

An Example of How the Capital Gains Tax Works

Say you bought 100 shares of XYZ Corp. stock at $20 per share and sold them more than a year later for $50 per share. Let’s also assume that you fall into the income category (see “What You’ll Owe,” below) where your long-term gains are taxed at 15%. The table below summarizes how your gains from XYZ stock are affected.

How Capital Gains Affect Earnings
Bought 100 shares @ $20 $2,000
Sold 100 shares @ $50 $5,000
Capital gain $3,000
Capital gain taxed @ 15% $450
Profit after tax $2,550

In this example, $450 of your profit will go to the government. But it could be worse. Had you held the stock for one year or less (making your capital gain a short-term one), your profit would have been taxed at your ordinary income tax rate, which can be as high as 37% for tax year 2021. And that’s not counting any additional state taxes.

Capital Gains Rates for 2021

While the tax rates for individuals’ ordinary income are 10%, 12%, 22%, 24%, 32%, 35%, and 37%, long-term capital gains rates are taxed at different, generally lower rates. The basic capital gains rates are 0%, 15%, and 20%, depending on your taxable income. The breakpoints for these rates are explained later.

Although marginal tax brackets have changed over the years, historically, as this chart from the Tax Policy Center shows, the maximum tax on ordinary income has almost always been significantly higher than the maximum rate on capital gains.

A graph of maximum capital gains rates over time since 1954
Tax Policy Center

You may encounter other types of capital gains taxes:

  • Gains on collectibles, such as artworks and stamp collections, are taxed at a 28% rate.
  • The taxable portion of gain on the sale of qualified small business stock (Section 1202 stock) is also taxed at a 28% rate.
  • The portion of a gain from selling Section 1250 real property that is attributable to depreciation previously taken, referred to as unrecaptured Section 1250 gain, is taxed at your ordinary income tax rate, up to a maximum 25% rate.
  • Capital gains on the sale of a principal residence are taxed differently from other real estate, due to a special exclusion. Basically, the first $250,000 of an individual’s gain on the sale of their home is excluded from their income for that year, as long as the seller has owned and lived in the home for two years or more out of the last five years. For married couples filing jointly, the exclusion is $500,000.

In addition to regular capital gains tax, some taxpayers are subject to the net investment income (NII) tax. It imposes an additional 3.8% tax on your investment income, including your capital gains, if your modified adjusted gross income (MAGI) is greater than:

  • $250,000 if married filing jointly or a qualifying widow(er) with a child
  • $200,000 if single or a head of household
  • $125,000 if married filing separately

What You’ll Owe

Before 2018, the basic long-term capital gains tax rates were determined by your tax bracket. If, for example, your taxable income put you in one of the two lowest brackets, then your capital gains had a zero tax rate and none of your gains were taxed.

The Tax Cuts and Jobs Act (TCJA) of 2017 changed the breakpoints for the basic capital gains rates to align with taxable income (not tax brackets). The following chart shows the breakpoints for 2021 based on your filing status and taxable income: 

The Three Levels of Long-Term Capital Gains Tax, 2021
Filing Status 0% 15% 20%
Single Up to $40,400 $40,401 to $445,850 Over $445,850
Head of household Up to $54,100 $54,101 to $473,750 Over $473,750
Married filing jointly or surviving spouse Up to $80,800 $80,801 to $501,600 Over $501,600
Married filing separately Up to $40,400 $40,401 to $250,800 Over $250,800


As of October 2021, negotiations are still under way in Congress regarding the budget reconciliation bill. In September 2021, the House Ways and Means Committee released its proposal of tax-raising provisions. It included an increase in the top capital gains rate from its current 20% to 25%. If the provision passes as currently written, it will be retroactively effective as of Sept. 13, 2021. Sales that finalized prior to that date will be eligible for the current tax brackets up to 20%, while sales that occur afterward will be subject to the new tax brackets up to 25%.

President Biden previously proposed raising taxes on long-term capital gains for individuals earning $1 million or more to 39.6%. 

Most individuals figure their tax (or have pros do it for them) using software that automatically makes the computations. But, if you want to get an idea of what you may pay on a potential or actualized sale, you can use a capital gains calculator to get a rough idea. Several free calculators are available online.

Five Ways to Minimize or Avoid Capital Gains Tax

You can do a number of things to minimize or even avoid capital gains taxes:

1. Invest for the long term 

If you manage to find great companies and hold their stock for the long term, you will pay the lowest rate of capital gains tax. Of course, this is easier said than done. A company’s fortunes can change over the years, and there are many reasons why you might want or need to sell earlier than you originally anticipated.

2. Take advantage of tax-deferred retirement plans 

When you invest your money through a retirement plan, such as a 401(k)403(b), or individual retirement account (IRA), it will grow without being subject to immediate taxes. You can also buy and sell investments within your retirement account without triggering capital gains tax.

In the case of traditional retirement accounts, your gains will be taxed as ordinary income when you withdraw money, but by then, you may be in a lower tax bracket than when you were working. With Roth IRA accounts, however, the money that you withdraw will be tax free—as long as you follow the relevant rules.

For investments outside of these accounts, it might behoove investors who are near retirement to wait until they actually stop working to sell. If their retirement income is low enough, their capital gains tax bill might be reduced or they may be able to avoid paying any capital gains tax. But if they’re already in one of the “no-pay” brackets, there’s a key factor to keep in mind: If the capital gain is large enough, it could increase their total taxable income to a level where they would incur a tax bill on their gains.

You can use capital losses to offset your capital gains as well as a portion of your regular income. Any amount left over after that can be carried over to future years.

3. Use capital losses to offset gains 

If you experience an investment loss, you can take advantage of it by decreasing the tax on your gains on other investments. Say you own two stocks, one of which is worth 10% more than you paid for it, while the other is worth 5% less. If you sold both stocks, the loss on the one would reduce the capital gains tax that you would owe on the other. Obviously, in an ideal situation, all of your investments would appreciate, but losses do happen, and this is one way to get some benefit from them.

If you have a capital loss greater than your capital gain, you can use up to $3,000 of it to offset ordinary income for the year. After that, you can carry over the loss to future tax years until it is exhausted.

4. Watch your holding periods 

If you are selling a security that you bought about a year ago, be sure to find out the trade date of the purchase. Waiting a few days or weeks to qualify for long-term capital gains treatment might be a wise move as long as the price of the investment is holding relatively steady.

5. Pick your cost basis 

When you’ve acquired shares in the same company or mutual fund at different times and prices, you’ll need to determine your cost basis for the shares that you sell. Although investors typically use the first in, first out (FIFO) method to calculate cost basis, there are four other methods available: last in, first out (LIFO)dollar-value LIFOaverage cost (only for mutual fund shares), and specific share identification.

If you’re selling a substantial holding, it could be worth consulting a tax advisor to determine which method makes the most sense.

FAQs

Will I have to pay capital gains tax on the sale of my home?

If you have less than a $250,000 gain on the sale of your home (or $500,000 if you’re married filing jointly), then you will not have to pay capital gains tax on the sale of your home. You must meet certain criteria to qualify for this exemption. You must have lived in the home for a total of two of the previous five years, and the exemption is only allowable once every two years. If your gain exceeds the exemption amount, you will have to pay capital gains tax on the excess.

How do I calculate my basis in a capital asset?

For most assets, your basis is your capital investment in the asset. For example, it is your purchase price plus additional costs that you incurred, such as commissions, recording fees, or transfer fees. Your adjusted basis can then be calculated by adding to your basis any costs that you’ve incurred for additional improvements and subtracting depreciation that you’ve deducted in the past and any insurance reimbursements that have been paid out to you.

What will the capital gains tax be in 2022?

Negotiations over the budget reconciliation bill are still under way as of October 2021.

If the proposed 25% rate passes, when combined with the 3.8% net investment income tax and a new 3% tax on top income earners, the resulting 31.8% top marginal long-term capital gains rate will be the highest federal capital gains rate since the 1970s and the third highest among nations in the Organisation for Economic Co-operation and Development (OECD).

The Bottom Line

Although the tax tail should not wag the entire financial dog, it’s important to take taxes into account as part of your investing strategy. Minimizing the capital gains taxes that you have to pay—for example, by holding investments for more than a year before you sell them—is one easy way to boost your after-tax returns.

Article Sources

Investopedia requires writers to use primary sources to support their work. These include white papers, government data, original reporting, and interviews with industry experts. We also reference original research from other reputable publishers where appropriate. You can learn more about the standards we follow in producing accurate, unbiased content in our editorial policy.
  1. Internal Revenue Service. “Topic No. 409 Capital Gains and Losses.” Accessed Oct. 29, 2021.

  2. Internal Revenue Service. “Publication 544 (2020): Sales and Other Dispositions of Assets,” Page 20. Accessed Oct. 29, 2021.

  3. The Daily CPA. “Patents, Inventions and Secret Formulas Are Not Capital Assets in 2018.” Accessed Oct. 29, 2021.

  4. Internal Revenue Service. “Revenue Procedure 2020-45,” Pages 5–6. Accessed Oct. 29, 2021.

  5. Tax Policy Center. “Briefing Book: How Are Capital Gains Taxed?” Accessed Oct. 29, 2021.

  6. Internal Revenue Service. “Topic No. 701 Sale of Your Home.” Accessed Oct. 29, 2021.

  7. Internal Revenue Service. “Find Out If Net Investment Income Tax Applies to You.” Accessed Oct. 29, 2021.

  8. Internal Revenue Service. “Revenue Procedure 2020-45,” Page 8. Accessed Oct. 29, 2021.

  9. House Committee on Ways and Means. “Subtitle I — Responsibly Funding Our Priorities,” Sec. 138202 (Page 8 of PDF). Accessed Oct. 29, 2021.

  10. Tax Foundation. “Biden Capital Gains Tax Rate Would Be Highest in OECD.” Accessed Oct. 29, 2021.

  11. Internal Revenue Service. “Retirement Topics — Contributions.” Accessed Oct. 29, 2021. 

  12. Internal Revenue Service. “Publication 590-B: Distributions from Individual Retirement Arrangements (IRAs),” Page 14. Accessed Oct. 29, 2021. 

  13. Internal Revenue Service. “Publication 590-B: Distributions from Individual Retirement Arrangements (IRAs),” Pages 29–30. Accessed Oct. 29, 2021. 

  14. Internal Revenue Service. “Publication 550: Investment Income and Expenses,” Pages 43–44. Accessed Oct. 29, 2021. 

  15. Internal Revenue Service. “Topic No. 703 Basis of Assets.” Accessed Oct. 29, 2021.

  16. Tax Foundation. “Proposed Top Combined Marginal Capital Gains Tax Rate Would Be Third-Highest in OECD.” Accessed Oct. 29, 2021.