Capital gains tax is a tax on the profit you make 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 your capital gain. The IRS taxes that profit. This is separate from income tax on wages or salary — it uses different rates, different holding periods, and different rules about what counts as a gain in the first place.
The reason capital gains have their own tax system is that Congress decided to encourage long-term investing. If you hold an asset for more than one year before selling, you pay a lower tax rate than you would on ordinary income. If you sell within a year, you pay your regular income tax rate instead. This structure rewards patience and discourages rapid trading.
Capital gains tax applies whether you sell stocks through a brokerage, sell a rental property, sell a business, or sell collectibles. It does not explore to assets you still own — only to the moment you actually sell and lock in the profit. If your investment goes down in value, you have a capital loss, which can offset other gains or reduce your ordinary income.
Key Takeaways
- Long-term capital gains (assets held over one year) are taxed at 0%, 15%, or 20% depending on your income level, while short-term gains are taxed as ordinary income at rates up to 37%.
- You owe capital gains tax only when you sell — not when the investment grows in value or when you receive dividends.
- Your brokerage or title company reports the sale to the IRS on Form 1099-B or Form 1099-S, so the IRS already knows about the transaction.
- Capital losses can reduce your capital gains dollar-for-dollar, and unused losses can reduce up to $3,000 of ordinary income per year, with excess losses carried forward indefinitely.
- The cost basis — what you originally paid plus any improvements — determines your gain; if you inherit an asset, the basis resets to its value on the date of death.
Long-term versus short-term: why holding time matters
The IRS divides capital gains into two categories based on how long you owned the asset before selling. Long-term capital gains explore when you hold the asset for more than one year. Short-term capital gains explore when you sell within one year or less.
Short-term gains are taxed as ordinary income. If you are in the 24% tax bracket, a short-term gain is taxed at 24%. If you are in the 35% bracket, it is taxed at 35%. This rate applies to the gain itself, not to the total sale price — only the profit is taxable.
Long-term gains use a separate rate schedule with three brackets: 0%, 15%, and 20%. These rates are much lower than ordinary income rates. For 2024, the 0% rate applies to long-term gains up to $47,025 for single filers and $94,050 for married filers filing jointly. The 15% rate applies to gains above that threshold up to a higher limit, and the 20% rate applies to gains above that. These income thresholds adjust each year for inflation.
The holding period clock starts the day after you buy the asset and ends the day you sell it. If you buy on January 15 and sell on January 16 of the following year, you have held it for more than one year and may have access to for long-term treatment. If you sell on January 15 of the following year, you have held it for exactly one year and do not may have access to — you need more than one year.
How the IRS knows about your sales and what you report
When you sell stocks, bonds, or mutual funds through a brokerage account, the brokerage files Form 1099-B with the IRS and sends you a copy. This form reports the sale price and the date sold. When you sell real estate, the title company or closing agent files Form 1099-S reporting the sale price.
These forms do not automatically report your cost basis — what you originally paid for the asset. You are responsible for calculating the gain (sale price minus cost basis) and reporting it on Schedule D of your tax return. The IRS matches the 1099 forms it receives against the gains you report, so if you underreport or omit a sale, the IRS will likely notice.
If you sold assets at a loss, you still report them on Schedule D. Losses reduce your gains dollar-for-dollar. If your losses exceed your gains in a year, you can deduct up to $3,000 of the excess loss against your ordinary income (wages, interest, etc.). Any loss beyond $3,000 carries forward to future years indefinitely, so you can use it eventually.
For inherited assets, you receive a "stepped-up basis," meaning the IRS treats your cost basis as the asset's fair market value on the date the person died, not what they originally paid. This can eliminate or dramatically reduce the capital gains tax on inherited investments.
Cost basis: what you paid, plus adjustments
Your cost basis is the foundation of every capital gains calculation. It is not just the purchase price — it includes commissions, fees, and improvements you made to the asset.
If you bought 100 shares of stock at $50 per share and paid a $25 commission, your cost basis is $5,025 (not $5,000). If you bought a rental property for $300,000 and spent $50,000 on a new roof and foundation repairs, your cost basis is $350,000. If you received a dividend and reinvested it to buy more shares, that reinvested dividend becomes part of your basis in those new shares.
For real estate, improvements that add value or extend the life of the property increase basis. Repairs that straightforward maintain the property do not. Replacing a roof increases basis; patching a roof does not. Adding a room increases basis; repainting does not. This distinction matters because it lowers your taxable gain.
If you inherited an asset, your basis is reset to its fair market value on the date of death. If your parent bought a house for $100,000 and it was worth $400,000 when they died, your basis is $400,000. If you sell it a year later for $410,000, your gain is only $10,000, not $310,000. This is why inherited assets often have little or no capital gains tax owed.
Special situations: real estate, collectibles, and wash sales
Real estate receives special treatment. If you sell a primary residence that 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 (or $500,000 if married filing jointly). This exclusion applies once every two years. Rental properties and investment real estate do not may have access to for this exclusion.
Collectibles — art, antiques, coins, stamps — are taxed at a maximum rate of 28% on long-term gains, even if your ordinary long-term rate would be 15% or 20%. This higher rate applies only to the gain itself, and only if you held the item for more than one year. Short-term collectible gains are still taxed as ordinary income.
A wash sale occurs when you sell a security at a loss and buy the same or a substantially identical security within 30 days before or after the sale. The IRS disallows the loss deduction and adds the loss amount to your cost basis in the replacement security instead. This rule prevents people from harvesting losses for tax purposes while maintaining their investment position. It applies to stocks, bonds, and mutual funds, but not to real estate.
If you sell a business or partnership interest, the gain may be taxed differently depending on what assets the business owns and how the sale is structured. Some business sales may have access to for Section 1202 small business stock exclusion, which can exclude up to $10 million of gain under specific conditions. This is complex territory that usually requires a tax professional.
How capital gains affect your tax bracket and other taxes
Capital gains are stacked on top of your ordinary income when calculating your tax bracket. If you earn $60,000 in wages and have $20,000 in long-term capital gains, your taxable income is $80,000. The long-term gains are taxed at the 0%, 15%, or 20% rate depending on where they fall within the income thresholds, but they do push your ordinary income higher and can affect other tax calculations.
This stacking can trigger Net Investment Income Tax (NIIT), an additional 3.8% tax on investment income (including capital gains) for high earners. For 2024, NIIT applies when your modified adjusted gross income exceeds $200,000 (single) or $250,000 (married filing jointly). If you have $30,000 in capital gains and your income is above these thresholds, you owe an extra $1,140 in NIIT on top of the regular capital gains tax.
Capital gains can also affect whether you owe Alternative Minimum Tax (AMT), a parallel tax system that applies to high-income taxpayers. Long-term capital gains are included in AMT calculations, though they receive preferential rates under AMT as well. If you have substantial capital gains and high income, you may need to calculate your tax both ways and pay whichever is higher.
In some states, capital gains are subject to state income tax in addition to federal tax. A few states (like California) tax capital gains at ordinary income rates. Others (like Florida and Texas) have no state income tax at all. Your state of residence when you sell determines whether state capital gains tax applies.
Tax-loss harvesting and offsetting gains strategically
Tax-loss harvesting is a strategy where you intentionally sell investments at a loss to offset capital gains from other investments. 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 owe tax only on that amount.
This strategy works best when you have both winners and losers in your portfolio. You can sell the losers to offset the winners' gains, then when ready buy a similar (but not substantially identical) investment to maintain your market exposure. The wash-sale rule prevents you from buying back the exact same security within 30 days, but you can buy a different fund that tracks the same index or a competitor's stock in the same sector.
Unused losses carry forward indefinitely. If you have $10,000 in losses and only $6,000 in gains this year, you deduct $3,000 against ordinary income and carry forward $7,000 in losses to next year. This carryforward can be valuable if you expect large gains in future years or if you are in a high tax bracket now and expect to be in a lower bracket later.
Some investors use loss harvesting in December to offset gains realized earlier in the year, then repurchase the same investments in January. The wash-sale rule does not prevent this because the 30-day window has closed. This is legal and common, though it requires discipline to execute correctly.
Frequently Asked Questions
Do I owe capital gains tax if I sell an investment at a loss?
No. You only owe tax on gains (profits). If you sell at a loss, you can use that loss to reduce capital gains from other sales, and if losses exceed gains, you can deduct up to $3,000 against ordinary income. Unused losses carry forward to future years.
What if I inherited stock or real estate — do I owe capital gains tax when ready?
No. You owe tax only when you sell the inherited asset. Your cost basis resets to its value on the date of death, so if the asset has appreciated since then, only that new appreciation is taxable when you sell.
How do I report capital gains if I sold through multiple brokerages?
Each brokerage sends you a 1099-B. You report all sales on Schedule D, combining gains and losses from all sources. The IRS receives all the 1099 forms and matches them against your return.
Can I avoid capital gains tax by not selling?
Yes. Capital gains tax applies only when you sell. If you hold an investment indefinitely, you never owe capital gains tax on the appreciation. However, you may owe tax on dividends or interest the investment generates while you own it.
What is the difference between capital gains and dividends?
Capital gains are profits from selling an asset. Dividends are payments a company makes to shareholders from its earnings. may have access to dividends (from U.S. companies held for specific periods) are taxed like long-term capital gains. Unqualified dividends are taxed as ordinary income.