How Capital Gains Tax Works When You Sell an Investment
Capital gains tax is the tax you owe on the profit when you sell an investment for more than you paid for it
When you buy a stock, bond, real estate, or other asset and later sell it at a higher price, the difference between what you paid and what you received is called a capital gain. The IRS taxes this profit. The amount of tax depends on how long you held the asset, your income level, and your filing status. You do not owe tax on the gain until you actually sell — only the sale triggers the tax bill.
Capital gains are separate from income tax on wages or salary. You may owe capital gains tax even if you have no job income, and you may owe it in addition to income tax if you do. The tax applies to investments you sell yourself, as well as to gains inside mutual funds or exchange-traded funds (ETFs) that the fund manager realizes and passes to you.
Key Takeaways
- Capital gains tax applies only when you sell an investment at a profit, not when the investment increases in value while you own it.
- 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 depends on your total income for the year and your filing status, not just the size of the gain.
- You report capital gains on Schedule D of your tax return, and the IRS matches sales records from your broker.
The difference between long-term and 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 one year or less, the gain is short-term. Short-term gains are taxed at your ordinary income tax rate — the same rate as your wages or salary. If you held it for more than one year, the gain is long-term. Long-term gains receive preferential tax rates that are usually lower than your income tax rate.
The holding period starts the day after you buy and ends the day you sell. If you buy a stock on March 15 and sell it on March 15 of the following year, you have held it for exactly one year, and the gain is short-term. If you sell on March 16, it becomes long-term.
Long-term capital gains rates are 0%, 15%, or 20%, depending on your income and filing status. These rates are fixed by law and do not change with your ordinary income tax bracket. Short-term gains, by contrast, can be taxed at rates ranging from 10% to 37%, matching the income tax brackets.
How the IRS calculates your capital gains tax rate
Your capital gains tax rate is determined by your taxable income for the year, not by the size of the gain alone. Taxable income includes wages, interest, dividends, and other income, minus deductions. The IRS applies capital gains rates based on income thresholds that vary by filing status.
For 2024, the long-term capital gains brackets are: 0% for single filers with taxable income up to $47,025; 15% for income from $47,026 to $518,900; and 20% for income over $518,900. These thresholds are adjusted each year for inflation. Married couples filing jointly have higher thresholds, and heads of household fall in between. If your total taxable income falls in the 0% bracket, you owe no federal tax on long-term gains up to that limit.
Your capital gains are stacked on top of your other income. If you earn $40,000 in wages and have a $20,000 long-term gain, your taxable income is $60,000. The first $7,025 of the gain may fall in the 0% bracket (if you are single), and the remaining $12,975 may be taxed at 15%.
What counts as a capital asset and what does not
Capital gains tax applies to most investments: stocks, bonds, mutual funds, ETFs, real estate, cryptocurrency, and collectibles like art or jewelry. It also applies to business assets you sell, such as equipment or property. The key is that you must have held the asset with the intent to profit or invest, not for personal use.
Your primary residence is a major exception. If you are single and sell a home you 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. You can use this exclusion once every two years. Other personal-use property, like your car or furniture, does not trigger capital gains tax when you sell it at a loss, and gains on personal items are generally not taxable either.
Inherited assets receive special treatment called step-up in basis. When you inherit an investment, your cost basis is reset to its market value on the date of death, not what the original owner paid. If you sell it shortly after inheriting it, you owe little or no capital gains tax, even if the asset had gained significantly in value during the original owner's lifetime.
How to report capital gains on your tax return
You report capital gains using Schedule D (Form 1040), which is part of your federal tax return. Schedule D has two sections: one for short-term gains and one for long-term gains. You list each sale separately, including the date you bought, the date you sold, your cost basis (what you paid), the sale price, and the gain or loss.
Your broker sends you a Form 1099-B in January showing all the sales you made during the previous year. The IRS receives a copy of this form, so they know what you sold and for how much. If your reported gains do not match the 1099-B, the IRS will flag it. You do not need to attach the 1099-B to your return, but you should keep your own records of purchases and sales in case of an audit.
If you have capital losses, you can use them to offset capital gains. If losses exceed gains, you can deduct up to $3,000 of the net loss against your ordinary income in a single year. Any loss above $3,000 carries forward to future years. This is called loss harvesting and is a common strategy to reduce your tax bill.
State and local capital gains taxes
Most states tax capital gains as ordinary income, meaning they explore your state income tax rate to the gain. A few states have no income tax at all and therefore no capital gains tax: Alaska, Florida, Nevada, South Dakota, Tennessee, Texas, Washington, and Wyoming. New Hampshire and Tennessee tax only dividend and interest income, not capital gains.
Some states have recently introduced separate capital gains taxes. Washington State, for example, imposes a 7% tax on long-term capital gains over $250,000. California taxes capital gains at the same rate as ordinary income, which can be as high as 13.3%. Your state and local tax bill depends on where you live and where you earned the income, not where the investment is located.
Capital gains from investments inside retirement accounts
If you hold investments inside a traditional IRA, Roth IRA, 401(k), or other may have access to retirement account, you do not owe capital gains tax when you sell them inside the account. The account itself is tax-sheltered. You can buy and sell stocks, bonds, and funds within the account without triggering any tax event.
In a traditional IRA or 401(k), you owe income tax when you withdraw money in retirement, regardless of whether the gains came from capital appreciation or dividends. In a Roth IRA, may have access to withdrawals are tax-free, including all gains. This tax deferral or tax-free treatment is one of the main reasons people use retirement accounts for long-term investing.
Frequently Asked Questions
Do I owe capital gains tax if the investment went down in value?
No. Capital gains tax applies only to profits. If you sell an investment for less than you paid, you have a capital loss, which does not trigger tax. You can use losses to offset gains or, if losses exceed gains, deduct up to $3,000 against your ordinary income in one year.
What if I sell an investment at a gain but reinvest the money right away?
You still owe capital gains tax on the profit from the sale. Reinvesting does not defer or eliminate the tax. The tax is due based on the gain in the year you sold, regardless of what you do with the proceeds.
How do I know my cost basis if I bought the investment years ago?
Your broker's records should show your original purchase price. If you no longer have statements, contact your broker and request a cost basis report. If you cannot find the records, you may need to estimate based on historical price data, though the IRS may challenge this if audited.
Can I reduce my capital gains tax by spreading the sale over two years?
No. The tax is based on the year you actually sell, not when you receive payment. If you sell in December, the gain is taxable in that year, even if the buyer pays you in installments over the next two years. However, installment sales have special rules — consult a tax professional if this applies to you.
What happens to capital gains tax if I move to a different state?
You owe tax to the state where you lived when you sold the investment. If you sell while living in California and move to Texas the next month, you owe California tax on that gain. If you sell after moving to Texas, you owe no state capital gains tax (since Texas has none), but you may still owe federal tax.
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.