How Are Capital Gains Taxed?

A capital gain is the profit you make when you sell an investment for more than you paid. In a regular taxable account, that gain is generally taxed in the year you sell, and how long you held the investment matters: gains on investments held more than one year are generally long-term and taxed at lower rates than short-term gains, which are taxed as ordinary income. If you sell for less than you paid, you have a capital loss, which can affect your taxes too.
That's the core idea. The details, including the actual rates, depend on your income, filing status and the rules in effect that year. This guide, part of our Taxes & Investing section, walks through the vocabulary and the logic so you can read your tax forms with more confidence and ask a tax professional better questions.
The key terms
A few words come up again and again. Here they are in plain language.
- Capital asset: most things you own as an investment, such as stocks, bonds, funds and many other holdings.
- Cost basis: roughly, what you paid for an investment, including certain costs of buying it. Your gain or loss is measured against this number.
- Proceeds: what you received when you sold.
- Realized gain or loss: a gain or loss that happened because you actually sold.
- Unrealized gain or loss: a change in value you haven't sold yet. It's often called a "paper" gain or loss.
- Holding period: how long you owned the investment before selling.
How a gain is figured, step by step
The basic math is simple, even if the tax rules around it aren't.
- Start with your proceeds from the sale.
- Subtract your cost basis.
- If the result is positive, you have a gain. If it's negative, you have a loss.
- Check your holding period to see whether the gain or loss is short-term or long-term.
A hypothetical example
Example (made-up numbers): Jordan buys shares of a fund for a hypothetical $2,000. Some time later they sell all of those shares for $2,600. Their gain is $600. If Jordan held the shares more than one year, the gain is generally long-term. If they held them one year or less, it's generally short-term. This example shows only how the gain is measured. It says nothing about how much tax Jordan would owe, which depends on their full tax picture.
Real investments can also lose value. If Jordan had sold for $1,700 instead, they would have a $300 loss, and that loss could matter for their taxes in other ways.
Why holding period matters so much
The one-year line is one of the most important ideas in investment taxes. Here's the general picture.
| Short-term | Long-term | |
|---|---|---|
| Holding period | One year or less | More than one year |
| General tax treatment | Taxed as ordinary income | Generally taxed at lower rates |
| Who tends to have more of it | People who buy and sell often | People who buy and hold |
This is one reason frequent trading can be costly beyond fees. Each quick sale at a profit can create short-term gains. Our comparison of investing vs trading explains the other costs and risks of trading often.
The exact rules for counting the holding period, and the rates for each type of gain, are set by law and can change. IRS.gov explains how they work in a given year.
What about capital losses?
Losses aren't fun, but they can play a role at tax time. In general, capital losses can be used to offset capital gains, and the IRS has rules about how much of any remaining loss can be used against other income in a year and how leftovers carry forward. Those limits are set by the IRS, so check IRS.gov for the current rules rather than relying on a number you saw online.
Some investors deliberately sell investments at a loss to use this offset, a practice called tax-loss harvesting. It comes with its own rules and trade-offs. Our guide to tax-loss harvesting explains the idea and the wash sale rule that can block a loss deduction.
Where capital gains taxes usually don't apply
Buying and selling inside tax-advantaged accounts works differently. Trades inside a 401(k), IRA or similar account generally don't create a capital gains tax bill each year. Instead, those accounts have their own rules about whether withdrawals are taxed later, or not at all. Our overview of tax-advantaged accounts explains how retirement accounts, HSAs and 529 plans each handle this, which is worth understanding before you decide where to hold a given investment.
Cost basis: the number people lose track of
Your gain is only as accurate as your cost basis. Brokerages report cost basis for many investments, but not always for everything, especially for older holdings, shares transferred between firms, inherited investments or gifts. Reinvested dividends also add to your basis, which is easy to forget.
If your basis is missing or wrong, you could end up reporting a larger gain than you actually had. Our guide to investment record keeping covers which statements to save so you can prove your cost basis years later.
Common mistakes to avoid
- Selling just before the one-year mark without realizing it changes the gain from long-term to short-term.
- Forgetting reinvested dividends when figuring cost basis.
- Assuming a "paper" gain is taxed and selling in a panic, or assuming a sale isn't taxed because you reinvested the money right away. Reinvesting doesn't undo a sale.
- Letting taxes drive every decision. Taxes matter, but they're one factor alongside your goals, timeline and risk.
Be skeptical of courses or newsletters that promise you can "avoid capital gains tax forever" with one trick. Our guide to investing course red flags explains how to spot overpromises like this.
Questions to bring to a tax professional
A CPA or enrolled agent can look at your actual numbers. Questions worth asking:
- Are my gains this year short-term, long-term or both?
- Is the cost basis my brokerage reported complete and correct?
- Do I have losses that could offset gains, or losses carried over from past years?
- How might selling now versus later affect my taxes, given my income this year?
- Are there state taxes I should be aware of?
Something to do today
Log in to any taxable brokerage account you have and find the page that shows "cost basis" or "unrealized gain/loss". For each holding, look at the purchase date. Note which positions are close to the one-year mark. You don't need to act on anything. You're just learning to read the information your account already gives you.
This guide is general education, not tax or investment advice. Tax rules change and depend on your situation, so check IRS.gov and consider talking with a qualified tax professional before making decisions.
Want a structured investing course?
Some people like the structure of a paid program. This button opens a third-party investing course, newsletter or program from one of our advertising partners. Its claims are its own, not ours, and we haven't verified any results it describes. Investing involves risk, including loss of money. Never invest money you can't afford to lose, and weigh any offer against our investment red flags checklist.
See the partner program →We may be paid when you click. The program shown can change. Read its terms before you buy anything. How this works
Frequently asked questions
Do I pay capital gains tax if I don't sell?
Generally, no. In a regular taxable account, a capital gain is usually taxed when you sell the investment, not while it simply rises in value on paper. Dividends and interest are a separate matter and can be taxable each year.
What is the difference between short-term and long-term capital gains?
Gains on investments held more than one year are generally long-term and taxed at lower rates than short-term gains. Short-term gains, on investments held one year or less, are generally taxed as ordinary income, like wages.
Do capital gains taxes apply inside a 401(k) or IRA?
Buying and selling inside a retirement account generally doesn't create capital gains tax each year. Instead, those accounts have their own rules for when withdrawals are taxed. Check IRS.gov or a tax professional for how your accounts work.



