What capital gains tax is and when you owe it

Capital gains tax is what you pay on profit when you sell an asset for more than you paid for it. If you bought stock for $5,000 and sold it for $8,000, your capital gain is $3,000. The tax rate depends on how long you held the asset and your income level — assets held longer than one year usually get lower rates than those sold within a year.

You only owe capital gains tax when you actually sell. Holding an investment that has grown in value does not trigger a tax bill. The tax becomes due in the year you sell, and you report it on your federal tax return.

Key Takeaways

  • Long-term capital gains (assets held over one year) are taxed at lower federal rates than short-term gains, so timing a sale can significantly reduce your tax bill.
  • Harvesting losses from investments that declined in value lets you offset gains dollar-for-dollar, and unused losses can carry forward to future years.
  • Holding appreciated assets until death resets their cost basis to current market value, meaning heirs pay no tax on the growth that occurred during your lifetime.
  • Donating appreciated securities directly to charity avoids capital gains tax entirely while giving you a charitable deduction for the full current value.
  • Certain investments like municipal bonds and may have access to small business stock have preferential tax treatment or exclusions under specific conditions.

Holding assets longer to may have access to for lower tax rates

The single largest tax difference is between short-term and long-term capital gains. Short-term gains (assets held one year or less) are taxed as ordinary income at your regular tax bracket, which can be as high as 37% federally. Long-term gains (held over one year) are taxed at 0%, 15%, or 20% depending on your total income, regardless of how much the asset appreciated.

If you are considering selling an investment that has gained value, check how long you have held it. If you are close to the one-year mark, waiting to cross that threshold can cut your federal tax bill substantially. This strategy works only if you can afford to wait and the investment itself is not declining in value.

Using losses to offset gains in the same year

Tax-loss harvesting means selling investments that have lost value to create a loss you can use against gains. If you sold one stock for a $5,000 gain and another for a $3,000 loss in the same year, you report a net gain of $2,000 and pay tax only on that amount.

Losses that exceed your gains in a single year can reduce other income by up to $3,000 per year. Any unused loss carries forward to future years indefinitely, so a large loss in one year can offset gains across many years to come. This is one reason people review their portfolio in late fall — selling losing positions before year-end lets you use the loss on that year's return.

One restriction: if you sell a security at a loss and buy the same or substantially identical security within 30 days before or after the sale, the wash-sale rule disallows the loss. You can buy a similar but not identical investment immediately and avoid this rule.

Holding appreciated assets until death

When you die, your heirs inherit assets at their market value on the date of your death — not at what you paid for them. This is called a stepped-up basis. If you bought stock for $10,000 and it was worth $50,000 when you died, your heirs inherit it at $50,000 and owe no capital gains tax on the $40,000 gain that occurred during your lifetime.

This is a major tax advantage for long-term investors. It means the appreciation that happens while you own an asset is never taxed if you hold it until death. Your heirs can then sell immediately at the stepped-up value with no tax consequence. This strategy requires no action on your part — it is automatic under current law — but it does mean selling appreciated assets during your lifetime triggers a tax you could have avoided by holding them.

Donating appreciated securities directly to charity

If you own stock, mutual funds, or other securities that have appreciated significantly, donating them directly to a may have access to charity avoids capital gains tax entirely. You get a tax deduction for the full current market value of the donation, and the charity receives the asset without any tax burden.

This works because you never sell the asset, so no capital gains tax is triggered. You benefit from the charitable deduction at your full tax bracket (up to 60% of your adjusted gross income for cash donations, 30% for appreciated securities), and the charity gets more value than if you had sold, paid tax, and donated the proceeds. You must donate to a may have access to organization — the IRS website lists may be able to access charities — and you need a written appraisal for donations over $5,000.

Investing in tax-advantaged accounts

Capital gains inside retirement accounts like 401(k)s and traditional IRAs are never taxed, no matter how often you buy and sell within the account. You pay tax only when you withdraw money in retirement, and then the entire withdrawal is taxed as ordinary income, not as capital gains.

Roth IRAs and Roth 401(k)s are even more favorable: gains inside these accounts are never taxed at all, even in retirement. If you have room to contribute to these accounts, moving investments there shields all future gains from capital gains tax. The annual contribution limits are set by the IRS and change yearly, so check the current year's limits before you contribute.

Municipal bonds and other tax-exempt investments

Interest income from municipal bonds issued by state and local governments is exempt from federal income tax and often from state tax as well. This is not a capital gains strategy, but it reduces the overall tax on your investment returns. If you buy a municipal bond at par value and hold it to maturity, you owe no federal tax on the interest.

If you sell a municipal bond before maturity at a profit, that gain is subject to capital gains tax — the tax exemption applies only to the interest, not to appreciation. Some investors use municipal bonds as part of a broader strategy to reduce taxable income, especially in high-income years or high-tax states.

Frequently Asked Questions

Can I avoid capital gains tax by reinvesting the proceeds?

No. The tax is due on the gain itself, not on what you do with the money afterward. If you sell an asset for a $10,000 gain and reinvest all $10,000 in a new investment, you still owe capital gains tax on the original $10,000 gain. Reinvesting does not defer or eliminate the tax.

What happens if I sell at a loss and want to buy back the same stock?

You can buy back the same stock, but not within 30 days before or after the sale, or the wash-sale rule will disallow your loss. You can buy a similar but different security immediately, then switch back after 30 days have passed. Keep records of the dates to document compliance.

Do I owe capital gains tax on inherited assets?

No. Inherited assets receive a stepped-up basis, meaning you inherit them at their market value on the date of death. If you sell them immediately after inheriting, you owe no capital gains tax. Tax is due only on gains that occur after you inherit them.

Can I use capital losses from one year to offset gains from a previous year?

No. Losses can only offset gains in the same year or carry forward to future years. You cannot file an amended return for a prior year to use a loss that occurred in the current year. Plan your sales strategically within each calendar year to maximize the benefit of losses.

Are there income limits for long-term capital gains rates?

Yes. The 0% long-term rate applies only to lower-income taxpayers; the 15% rate applies to middle-income ranges; and the 20% rate applies to higher earners. Income thresholds change yearly and depend on filing status. Check the IRS website or speak with a tax professional to determine which rate applies to you.