What Are Capital Gains? How Profit on Investments Is Taxed

The Short Answer

A capital gain is the profit you earn when you sell something for more than you paid for it. If you buy an investment — like a stock, a mutual fund, or a piece of property — and later sell it at a higher price, the difference is your capital gain. If you sell for less than you paid, that’s a capital loss.

Capital gains matter most at tax time, because the profit is generally taxable income. How much tax you owe depends mainly on how long you held the asset before selling.

How a Capital Gain Works

The gain is the difference between your cost basis (what you paid, including fees) and the price you sell for. There are two important distinctions:

  • Realized gain — you’ve actually sold the asset and locked in the profit. This is what gets taxed.
  • Unrealized gain — your asset has risen in value but you still own it. It’s a “paper” gain and isn’t taxed until you sell.

Example: You buy 100 shares of a stock at $20 each, for $2,000. A few years later you sell them at $30 each, for $3,000. Your capital gain is $1,000. Until you sell, that $1,000 is an unrealized gain; once you sell, it becomes a realized gain that you report on your taxes.

Capital gains short-term versus long-term comparison infographic

Short-Term vs. Long-Term Capital Gains

How long you hold an asset before selling determines how the gain is taxed — and the difference is significant:

  • Short-term capital gains apply to assets held one year or less. They’re taxed as ordinary income, at the same rate as your wages — which can be relatively high.
  • Long-term capital gains apply to assets held more than one year. They’re taxed at lower, preferential rates (commonly 0%, 15%, or 20%, depending on your income).

This is why long-term investors often benefit from simply holding investments longer than a year before selling — the tax bill on the same profit can be meaningfully lower.

Offsetting Gains With Losses

You can use capital losses to reduce your taxable capital gains, a strategy sometimes called tax-loss harvesting. If your losses exceed your gains in a year, you can typically deduct a limited amount against your ordinary income and carry the rest forward to future years.

For example, a $5,000 gain on one investment and a $2,000 loss on another leaves you with a net $3,000 taxable gain.

Capital Gains on a Home

Capital gains aren’t only about stocks. Selling a home, real estate, or other valuable property can also create a capital gain. For a primary residence, the tax code offers a generous exclusion — a portion of the gain on a home you’ve lived in long enough may be tax-free. The rules are specific, so it’s worth checking current IRS guidance or asking a tax professional when selling a home.

Gains in Retirement Accounts

One useful point for everyday investors: buying and selling inside a tax-advantaged retirement account, like a 401(k) or IRA, generally does not trigger capital gains tax at the time of the trade. The tax treatment is handled by the account’s own rules. Capital gains tax mainly comes into play in regular, taxable brokerage accounts.

The Bottom Line

A capital gain is the profit from selling an asset for more than you paid, and it’s generally taxed only once you sell. Holding an investment longer than a year usually means a lower tax rate on the gain, and capital losses can offset gains to reduce what you owe. Understanding the short-term versus long-term distinction is one of the most valuable pieces of investing tax knowledge.

Frequently Asked Questions

Do I owe taxes on a capital gain if I don’t sell?

Generally no. An unrealized gain — an investment that has risen in value but that you still hold — isn’t taxed. Capital gains tax usually applies only when you sell and realize the profit.

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

Short-term gains are on assets held one year or less and are taxed as ordinary income. Long-term gains are on assets held more than a year and are taxed at lower preferential rates. The same profit can be taxed quite differently based on holding time.

Can capital losses reduce my taxes?

Yes. Capital losses offset capital gains dollar for dollar. If your losses exceed your gains, you can typically deduct a limited amount against ordinary income and carry the remaining losses forward to future tax years.

How are capital gains taxed when I sell my house?

Selling a home can create a capital gain, but a primary residence qualifies for a sizable exclusion if you meet ownership and use requirements. The rules are specific and change over time, so check current IRS guidance or consult a tax professional.

Are capital gains taxed inside a 401(k) or IRA?

Trades inside a tax-advantaged retirement account generally don’t trigger capital gains tax at the time. The account’s own tax rules apply instead. Capital gains tax primarily affects investments in regular taxable brokerage accounts.

What is cost basis and why does it matter for capital gains?

Cost basis is what you originally paid for an asset, including fees. Your capital gain is the sale price minus your cost basis, so an accurate basis is essential for calculating how much gain — and tax — you actually have.

This article is for educational purposes only and is not investment or tax advice. Investing involves risk, including the possible loss of principal. Consult a qualified financial or tax professional for guidance specific to your situation.