Capital Gains Tax 101

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—particularly, the capital gains tax. After all, picking the right stock or mutual fund can be challenging enough without worrying about after-tax returns. Likewise, selling a home can be a daunting task, even before you consider the tax bill.

Still, 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 a price higher than its basis.
  • If you hold an investment for more than a year before selling, your profit is considered a long-term gain and is taxed at a lower rate.
  • Investments held for less than a year are taxed at the higher, short-term capital gain rate.
  • To limit capital gains taxes, you can invest for the long-term, use tax-advantaged retirement accounts, and offset capital gains with capital losses.

What Is a Capital Gains Tax?

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

For tax purposes, it’s helpful to understand the difference between unrealized gains and realized gains. An unrealized gain is a potential profit that exists on paper—an increase in the value of an asset or investment you own but haven't yet sold for cash. 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 by 15%, that gain is unrealized since you still own the stock.

On the other hand, a gain becomes realized when you sell the asset or investment at a profit—that is, for more than its basis. For instance, you realize a gain of $5,000 if you sell that stock for $25,000 after paying $20,000 for it. A tax on capital gains only happens when an asset is sold or "realized."

Investors can also have unrealized and realized losses. An unrealized loss is a decrease in the value of an asset or investment you own but haven't yet sold—a potential loss that exists on paper. A realized loss happens when you sell an asset or investment for less than you paid for it (i.e., at a loss).

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
  • Gems and jewelry
  • Your home
  • Household furnishings
  • Your vehicle
  • Gold, silver, and other metals
  • Coin and stamp collections
  • Timber grown on your home property or investment property

However, not every capital asset you own will qualify for capital gains treatment. Examples of noncapital assets include:

  • Business inventory  
  • Accounts receivable acquired in the ordinary course of business
  • Depreciable business property
  • Real property (real estate) used in your trade or business as rental property

Also excluded from capital gains treatment are certain self-created intangibles, such as:

  • Copyrights
  • Literary, musical, or artistic compositions
  • Letters, memoranda, or similar property (e.g., drafts of speeches, recordings, transcripts, manuscripts, drawings, and 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 you’ll pay on a capital gain depends on how long you hold the asset before selling it.

Assets you hold for more than one year qualify for the more favorable long-term capital gains rates. In contrast, gains on investments you’ve held for one year or less are short-term capital gains, which are taxed at your higher, ordinary income tax rate (there are limited exceptions to the one-year holding-period rule).

The tax system in the U.S. benefits long-term investors. Short-term investments are almost always taxed at a higher rate than long-term investments.

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 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 years 2021 and 2022. And that’s not counting any additional state taxes.

Capital Gains Tax Rates for 2021 and 2022

Short-term capital gains are taxed at ordinary income tax rates up to 37% (the seven marginal tax brackets are 10%, 12%, 22%, 24%, 32%, 35%, and 37%). On the other hand, long-term capital gains are taxed at different, generally lower rates. The capital gains rates are 0%, 15%, and 20%, depending on your taxable income. Here's a breakdown for tax years 2021 and 2022:

Long-Term Capital Gains Tax Rates for 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
Long-Term Capital Gains Tax Rates for 2022
Filing Status 0% 15% 20%
Single Up to $41,675 $41,676 to $459,750 Over $459,750
Head of household Up to $55,800 $55,801 to $488,500 Over $488,500
Married filing jointly or surviving spouse Up to $83,350 $83,351 to $517,200 Over $517,200
Married filing separately Up to $41,675 $41,6751 to $258,600 Over $258,600

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

Not all capital gains are taxed according to the standard 0%/15%/20% schedule. Here are some exceptions where capital gains may be taxed at higher rates than 20%:

  • Gains on collectibles, such as artworks and stamp collections, are taxed at a maximum 28% rate.
  • The taxable portion of gain on the sale of qualified small business stock (Section 1202 stock) is also taxed at a maximum 28% rate.
  • The portion of any unrecaptured Section 1250 gain from selling Section 1250 real property is taxed at a maximum 25% rate.

Home Sale Exclusion

Due to a special exclusion, capital gains on the sale of a principal residence are taxed differently than other types of real estate. Basically, if you sell your main home and have a capital gain, you can exclude up to $250,000 of that gain from your income, provided you 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.

Net Investment Income Tax

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

How to Calculate Long-Term Capital Gains Tax

Most individuals figure their tax (or have pros do it for them) using software that automatically makes the computations. You can also use a capital gains calculator to get a rough idea. Several free calculators are available online. Still, if you want to crunch the numbers yourself, here's the basic method for calculating capital gains tax:

  1. Determine your basis. The basis is generally the purchase price plus any commissions or fees you paid. The basis can be adjusted up or down for stock splits and dividends.
  2. Determine your realized amount. This is the sale price minus any commissions or fees you paid.
  3. Subtract the basis (what you paid) from the realized amount (what you sold it for) to determine the difference. This is the capital gain (or loss).
  4. Determine your tax. If you have a capital gain, multiply the amount by the appropriate tax rate to determine your capital gains tax for the asset (remember that tax rates differ depending on your taxable income and how long you held the asset before you sold it). If you have a capital loss, you may be able to use the loss to offset capital gains.

How to Minimize or Avoid Capital Gains Tax

There are a number of ways to minimize or even avoid capital gains taxes. Here's a look at five of the more common strategies:

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 capital gains tax rate. 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 you withdraw will be tax-free—as long as you follow the relevant rules.

For investments outside of these accounts, it might behoove investors near retirement to wait until they 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.

Capital losses can 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 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 your capital losses exceed your capital gains, 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 investment's price 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 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 LIFOspecific share identification, and average cost (only for mutual fund shares).

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

Will I Owe Capital Gains Tax if I Sell 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), you will not have to pay capital gains tax on the sale of your home. You must have lived in the home for at least two of the previous five years to qualify for the exemption (which is 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.

Will Capital Gains Tax Rates Change for 2022?

Capital gains tax rates are the same in 2022 as they were in 2021: 0%, 15%, or 20%, depending on your income. The higher your income, the higher your rate. While the tax rates remain unchanged for 2022, the income required to qualify for each bracket goes up to adjust for inflation. The maximum zero-rate taxable income amount is $83,350 for married filing jointly and surviving spouses, $55,800 for heads of household, and $41,675 for married filing separately taxpayers.

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 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. “Publication 544 (2020): Sales and Other Dispositions of Assets,” Page 20.

  2. The Daily CPA. “Patents, Inventions and Secret Formulas Are Not Capital Assets in 2018.”

  3. Internal Revenue Service. “Topic No. 409 Capital Gains and Losses.”

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

  5. Tax Policy Center. “Briefing Book: How Are Capital Gains Taxed?

  6. Internal Revenue Service. “Topic No. 701 Sale of Your Home.”

  7. Internal Revenue Service. “Find Out If Net Investment Income Tax Applies to You.”

  8. Internal Revenue Service. “Retirement Topics — Contributions.”

  9. Internal Revenue Service. “Publication 590-B: Distributions from Individual Retirement Arrangements (IRAs),” Page 14.

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

  11. Internal Revenue Service. “Publication 550: Investment Income and Expenses,” Pages 43–44.

  12. Internal Revenue Service. “Topic No. 703 Basis of Assets.

  13. Internal Revenue Service. "Rev. Proc. 2021-45."

Take the Next Step to Invest
×
The offers that appear in this table are from partnerships from which Investopedia receives compensation. This compensation may impact how and where listings appear. Investopedia does not include all offers available in the marketplace.
Service
Name
Description