When you sell an investment — a stock, a bond, a mutual fund, or real estate — for more than you paid, the profit is called a capital gain, and it’s generally taxable. Understanding how capital gains tax works helps you make better decisions about when to sell, how to manage your portfolio, and how to plan larger transactions like selling a home or business.

Short-Term vs. Long-Term Capital Gains
The most important distinction in capital gains tax is how long you held the asset before selling:
- Short-term capital gains — assets held for one year or less. Taxed as ordinary income at your regular marginal tax rate — the same rate as your wages. Depending on your bracket, this can be 10% to 37%.
- Long-term capital gains — assets held for more than one year. Taxed at preferential rates: 0%, 15%, or 20% depending on your taxable income. Most middle-income taxpayers pay 15%.
The difference is significant. If you’re in the 22% ordinary income bracket and sell a stock after 13 months instead of 11, your gain is taxed at 15% instead of 22% — a 7 percentage point difference on every dollar of profit.
2024 long-term capital gains rate thresholds (for single filers):
- 0% — taxable income up to $47,025
- 15% — taxable income $47,026 to $518,900
- 20% — taxable income above $518,900
Married filing jointly thresholds are approximately double the single filer amounts. These thresholds adjust annually for inflation.
What Triggers a Capital Gain
A capital gain is triggered when you sell or exchange an asset for more than your cost basis — generally what you paid for it plus any commissions or improvements. Common taxable events:
- Selling shares of stock, ETFs, or mutual funds
- Selling a bond before maturity at a price above what you paid
- Selling real estate (subject to the home sale exclusion — see below)
- Selling a business or business assets
- Receiving mutual fund capital gains distributions (even if you didn’t sell anything yourself)
- Selling cryptocurrency — the IRS treats crypto as property, not currency
- Selling collectibles, jewelry, art, or precious metals
Capital gains are not triggered by: holding an asset (paper gains are not taxable), transferring assets between spouses, inheriting assets (inherited assets generally receive a stepped-up basis), or donating appreciated assets to charity (you also avoid the gain and get a deduction for full fair market value).
Capital Losses and How They Help
If you sell an asset for less than your cost basis, you have a capital loss. Capital losses can offset capital gains dollar for dollar. If your losses exceed your gains, you can deduct up to $3,000 of the excess against ordinary income each year. Any remaining loss carries forward to future years indefinitely.
Example: You sell Stock A at a $10,000 gain and Stock B at a $6,000 loss in the same year. Your net capital gain is $4,000, which is what gets taxed. If you had $12,000 in losses and only $6,000 in gains, you’d have a $6,000 net loss — you’d deduct $3,000 this year and carry $3,000 forward.
This is the basis of tax-loss harvesting — deliberately selling losing positions to offset gains. The wash-sale rule prevents you from buying back the same or substantially identical security within 30 days before or after the sale and still claiming the loss.
The Home Sale Exclusion
One of the most valuable tax breaks in the tax code: if you sell your primary residence, you can exclude up to $250,000 of capital gain ($500,000 for married filing jointly) from taxable income — completely tax-free.
To qualify:
- You must have owned the home for at least 2 of the last 5 years.
- You must have lived in it as your primary residence for at least 2 of the last 5 years.
- You can only use this exclusion once every 2 years.
The gain is calculated as the sale price minus your adjusted basis (purchase price plus capital improvements like a new roof, addition, or kitchen remodel — not repairs). Keep records of all improvements for this reason.
If your gain exceeds the exclusion — for example, you bought a home for $200,000 and sold it for $700,000 as a single filer — only the amount above $250,000 ($250,000 in this case) is taxable, at long-term capital gains rates.
Capital Gains in Retirement Accounts
Capital gains inside a 401(k), IRA, or Roth IRA are not taxed as capital gains — they’re tax-deferred or tax-free:
- Traditional 401(k) and IRA: Growth is tax-deferred. When you withdraw, the entire distribution is taxed as ordinary income — regardless of whether it came from capital gains. There are no long-term capital gains rates inside these accounts.
- Roth 401(k) and Roth IRA: Growth is tax-free. Qualified withdrawals are completely tax-free, including any capital gains.
This is why tax-efficient investing matters: assets that generate frequent short-term gains or dividend income are better held inside tax-advantaged accounts, while assets held long-term are more efficient in taxable brokerage accounts.
The Net Investment Income Tax (NIIT)
High-income taxpayers face an additional 3.8% Net Investment Income Tax on capital gains and other investment income. The NIIT applies to the lesser of your net investment income or the amount by which your modified AGI exceeds:
- $200,000 for single filers
- $250,000 for married filing jointly
This effectively raises the top long-term capital gains rate from 20% to 23.8% for high earners.
Strategies to Reduce Capital Gains Tax
- Hold assets longer than one year to qualify for long-term rates.
- Harvest losses to offset gains in the same year.
- Time large sales for years when your income is lower (retirement, career gap, partial-year income).
- Use tax-advantaged accounts for assets most likely to generate taxable gains.
- Donate appreciated assets to charity instead of cash — you avoid the capital gains tax and get a full fair-market-value deduction.
- Consider installment sales for business or real estate — spreading the gain over multiple years can keep you in lower brackets.
- Keep records of your cost basis — if you can’t prove what you paid, the IRS may assume $0, making your entire sale price a gain.
Further Reading
- Tax-Loss Harvesting Explained
- How Taxes Change in Retirement
- What Is a Brokerage Account?
- Selling Your Home in Retirement: Capital Gains and Tax Rules
- Tax-Efficient Withdrawal Order in Retirement
- Taxes Overview
This article is for general educational purposes only and does not constitute tax or financial advice. Tax laws change and individual situations vary – consult a qualified tax professional or the IRS for guidance on your specific situation.