How Capital Gains Tax Works When You Sell Investments or Property
Capital gains tax is the tax you pay on profit when you sell something you own — a stock, a house, a piece of land, or a business stake
The tax applies only to the gain, not the full sale price. If you bought a stock for $1,000 and sold it for $1,500, your capital gain is $500, and that is what gets taxed. The IRS treats gains differently depending on how long you held the asset before selling it, and that timing difference can cut your tax bill significantly.
You do not pay capital gains tax on something you still own, even if it has gone up in value. The tax event happens only when you sell and lock in the profit. This is why people sometimes hold investments for years without triggering any tax — the gain is "unrealized" until the sale.
Key Takeaways
- Capital gain is the difference between what you paid for an asset and what you sold it for, and only that difference is taxed.
- Long-term capital gains (assets held over one year) are taxed at lower rates than short-term gains, which are taxed as ordinary income.
- Your tax rate on long-term gains depends on your total income for the year and ranges from 0% to 20% for most taxpayers.
- You report capital gains on Schedule D (Form 1040) and pay tax when you file your return, not when you sell the asset.
- Losses from sales can offset gains dollar-for-dollar, and unused losses can carry forward to future years.
Long-term versus short-term capital gains
The IRS divides capital gains into two categories based on how long you owned the asset. If you held it for more than one year before selling, it is a long-term capital gain. If you held it for one year or less, it is a short-term capital gain.
Short-term gains are taxed as ordinary income at your regular tax bracket — the same rate you pay on wages or salary. Long-term gains receive preferential treatment and are taxed at lower rates: 0%, 15%, or 20%, depending on your income level. For most people, the long-term rate is 15%. The 0% rate applies to lower-income taxpayers, and the 20% rate applies to high-income taxpayers.
This difference matters enormously. Suppose you are in the 24% tax bracket and sell a stock you held for eight months, realizing a $10,000 gain. You owe $2,400 in federal tax. If you had held that same stock for 13 months and sold it at the same gain, you might owe only $1,500 (at the 15% long-term rate), depending on your total income. Waiting a few months can save you hundreds of dollars.
How the IRS calculates your capital gains tax rate
Your long-term capital gains rate depends on your taxable income for the year, not just the gain itself. The IRS stacks your gains on top of your other income — wages, interest, dividends — and applies the rate that matches your total.
For 2024, the 0% long-term rate applies if your taxable income is below $47,025 (single filers) or $94,050 (married filing jointly). The 15% rate applies to income between those thresholds and higher limits. The 20% rate applies to income above those higher limits. These income thresholds change each year.
This stacking effect means you might pay 0% on part of your gain and 15% on the rest. If you are single with $40,000 in wages and you sell an investment for a $10,000 gain, your first $7,025 of that gain falls in the 0% bracket, and the remaining $2,975 is taxed at 15%. You would owe $446 in federal tax on the $10,000 gain, not $1,500.
State and local taxes on capital gains
Federal capital gains tax is only part of the picture. Most states also tax capital gains, usually at their ordinary income tax rate. A few states — including Alaska, Florida, Nevada, South Dakota, Tennessee, Texas, Washington, and Wyoming — do not tax capital gains at all. Others tax them at a flat rate or as part of regular income tax.
Some cities and counties impose local taxes on capital gains as well. New York City, for example, taxes capital gains as part of its income tax system. If you live in a state or city with capital gains tax, that amount is added on top of your federal bill.
The state and local tax deduction (SALT) on your federal return is capped at $10,000 per year, so high-income earners in high-tax states often cannot deduct all their state capital gains taxes from their federal return.
Using losses to reduce your capital gains tax
If you sell an investment at a loss, you can use that loss to offset capital gains from other sales. If you sold Stock A for a $5,000 gain and Stock B for a $2,000 loss in the same year, your net capital gain is $3,000, and you pay tax only on that amount.
If your losses exceed your gains in a year, you can deduct up to $3,000 of the net loss against your ordinary income (wages, salary, interest). Any loss beyond that $3,000 carries forward to the next year, where you can use it again. This process continues indefinitely until the loss is fully used.
This strategy, called tax-loss harvesting, is common among investors who want to reduce their tax bill. You sell a losing position to lock in the loss, then often buy a similar (but not identical) investment to maintain your portfolio exposure. The IRS has a rule called the "wash sale" rule that prevents you from buying the same or substantially identical security within 30 days before or after the sale, so the timing matters.
How to report capital gains on your tax return
You report capital gains on Schedule D (Form 1040), which is part of your federal income tax return. Schedule D asks you to list each sale separately: the date you bought it, the date you sold it, your cost basis (what you paid), the sale price, and the gain or loss.
The form automatically separates your short-term and long-term gains and losses. At the bottom, it calculates your net short-term gain or loss and your net long-term gain or loss. If you have a net long-term gain, that amount goes to your Form 1040 at the line for capital gains, where it is taxed at the preferential rate.
If you sold only one or two investments and the transactions are straightforward, you might be able to report them directly on Form 1040 without filing Schedule D, depending on the year and your situation. Your tax software will guide you. If you sold many investments or have complex transactions, Schedule D is required.
You do not pay tax when you sell the asset. You pay tax when you file your return the following year. If you owe a large amount, you may need to make estimated tax payments during the year to avoid penalties.
Special situations: real estate, inherited assets, and collectibles
A home sale has its own rules. If you are single and sell a primary residence you owned and lived in for at least two of the last five years, you can exclude up to $250,000 of gain from tax. Married couples filing jointly can exclude up to $500,000. This exclusion applies only once every two years and only to your primary home, not investment properties or vacation homes.
If you inherit an asset, you receive a stepped-up basis. This means your cost basis is reset to the asset's fair market value on the date of the person's death, not what they originally paid. If your parent bought a stock for $10,000 and it was worth $50,000 when they died, your basis is $50,000. If you sell it when ready for $50,000, you have no gain and owe no tax. This rule can save heirs significant taxes.
Collectibles — art, coins, stamps, and similar items — are taxed at a maximum rate of 28% on long-term gains, which is higher than the standard 0%, 15%, or 20% rates. Precious metals held as collectibles fall into this category. If you sell collectibles at a gain, check whether the 28% rate applies to your situation.
Frequently Asked Questions
Do I owe capital gains tax if I sell an investment at a loss?
No. A loss means you sold for less than you paid, so there is no gain to tax. You can use the loss to offset other gains or up to $3,000 of ordinary income in the same year. Any unused loss carries forward to future years.
What if I bought a stock through my employer's 401(k) or IRA and sold it?
Gains inside a 401(k) or traditional IRA are not taxed when you sell the investment. You pay tax only when you withdraw money from the account. Roth IRA withdrawals of gains are tax-free if you meet the account age and withdrawal requirements. These accounts shelter you from capital gains tax entirely.
How do I know my cost basis if I lost the original purchase records?
Your brokerage has records going back many years and can provide a cost basis report. If you bought through a mutual fund company or stock plan, contact them directly. For very old purchases, the IRS allows reasonable estimates if records are truly unavailable, but having documentation is always better.
Can I deduct capital losses from my taxes if I have no gains?
Yes, up to $3,000 per year against ordinary income. If your losses are larger, the excess carries forward to the next year and the years after that until it is used up. You can use carried-forward losses in any future year, even if you have no gains that year.
Do I pay capital gains tax on dividends from stocks I own?
Dividends are separate from capital gains. may have access to dividends are taxed at the same preferential rates as long-term capital gains (0%, 15%, or 20%). Non-may have access to dividends are taxed as ordinary income. Capital gains tax applies only when you sell the stock itself, not when you receive dividend payments.
This guide is for general information only and is not medical, financial, legal, or other professional advice. For decisions specific to your situation, consult a qualified professional. See our Editorial Policy.