You pay capital gains tax in the year you sell an investment or property for a profit
Capital gains tax is owed when you sell something you own — a stock, a rental property, a business, cryptocurrency, or even a piece of art — for more than you paid for it. The difference between what you paid (your cost basis) and what you sold it for is your gain, and that gain is taxable income. You report it on your tax return for the year the sale closed, not the year you bought it or the year you plan to sell it.
The timing matters because the IRS taxes gains based on how long you held the asset. If you owned it for one year or less, it counts as a short-term capital gain and is taxed at your regular income tax rate — the same rate as your salary or wages. If you owned it for more than one year, it counts as a long-term capital gain and is taxed at a lower rate (0%, 15%, or 20%, depending on your income). Most people benefit from holding investments longer because the tax bill is smaller.
Key Takeaways
- You owe capital gains tax only in the year you actually sell the asset, not when the value goes up or when you plan to sell it later.
- Short-term gains (assets held one year or less) are taxed at your regular income tax rate, while long-term gains (held over one year) are taxed at lower rates of 0%, 15%, or 20%.
- Your cost basis is what you originally paid, including commissions and fees; gains are calculated as sale price minus cost basis.
- You report capital gains on Schedule D of your tax return, and the IRS matches sales reported by brokers to your return automatically.
How the IRS knows about your sale
Your broker, bank, or investment platform reports every sale to the IRS on a Form 1099-B (for stocks, bonds, and mutual funds) or Form 1099-S (for real estate). They send you a copy and send the IRS a copy. You then report the same sale on Schedule D of your tax return. The IRS computer matches the two documents, so underreporting or forgetting to report a gain is caught quickly.
For real estate, the title company or closing attorney usually files the Form 1099-S with the IRS and sends you a copy. If you sold a home and used the primary residence exclusion (which lets you exclude up to $250,000 of gain if you're single or $500,000 if married), you still report the sale on Schedule D — you just note that the gain is excluded. The IRS expects to see the form and your explanation.
The difference between short-term and long-term holding periods
The IRS counts your holding period from the day after you buy an asset to the day you sell it. If you buy a stock on January 15 and sell it on January 15 of the next year, you have held it exactly one year, and it qualifies as long-term. If you sell it on January 14, it is short-term. The distinction matters because short-term gains are taxed at your marginal income tax rate (10%, 12%, 22%, 24%, 32%, 35%, or 37%, depending on your income bracket), while long-term gains are capped at 0%, 15%, or 20%.
For example, if you are in the 24% income tax bracket and sell a stock for a $10,000 short-term gain, you owe $2,400 in federal tax on that gain. If the same stock qualifies as long-term and you are in the 15% long-term rate, you owe $1,500. The tax savings can be substantial, which is why many investors hold assets for at least 13 months.
Calculating your gain or loss
Your gain is the sale price minus your cost basis. Cost basis is not just what you paid for the asset — it includes commissions, fees, and improvements. If you bought a stock for $1,000 and paid a $10 commission, your cost basis is $1,010. If you sold it for $1,500, your gain is $490. If you sold it for $900, you have a loss of $110.
For real estate, cost basis includes the purchase price, closing costs, and capital improvements (like a new roof or addition). It does not include repairs or maintenance. If you inherited property, your cost basis is the fair market value on the date of death, not what the previous owner paid — this is called a "step-up in basis" and can eliminate or reduce the tax burden on inherited assets.
If you own mutual funds or index funds, the broker calculates the gain or loss for each sale and reports it on your 1099-B. You do not have to do the math yourself, though you should review the form to make sure the cost basis is correct — brokers sometimes get it wrong, especially if you transferred shares from another account.
When losses offset gains
If you sell an asset for less than you paid, you have a capital loss. Capital losses can be used to offset capital gains, dollar for dollar. If you sold one stock for a $5,000 gain and another for a $2,000 loss in the same year, you report a net gain of $3,000 and pay tax only on that amount.
If your losses exceed your gains in a year, you can use up to $3,000 of the excess loss to reduce your ordinary income (wages, salary, interest). Any loss beyond $3,000 carries forward to future years and can be used to offset future gains or reduce future income. This is why some investors deliberately sell losing positions late in the year — to harvest the loss and reduce their tax bill.
State and local taxes on capital gains
Most states tax capital gains as ordinary income, so you owe state tax in addition to federal tax. A few states — including Alaska, Florida, Nevada, South Dakota, Tennessee, Texas, Washington, and Wyoming — do not tax capital gains at all. Others, like California, tax long-term gains at the same rate as short-term gains (no preferential rate). A handful of states, including New York and New Jersey, have recently enacted or proposed taxes specifically on capital gains above a certain threshold, separate from income tax.
If you live in one state and sell property in another, you may owe tax to both states. The state where the property is located usually has the primary claim. You report this on your state tax return, and most states allow a credit for taxes paid to other states to avoid double taxation.
Special situations: inherited assets and gifts
When you inherit an asset, you do not owe capital gains tax on the increase in value that happened while the previous owner held it. Instead, your cost basis is stepped up to the fair market value on the date of death. If your parent bought a house for $200,000 and it was worth $500,000 when they died, your cost basis is $500,000. If you sell it a year later for $520,000, you owe tax only on the $20,000 gain, not the $320,000 increase that happened before you inherited it.
Gifts work differently. If someone gives you an asset, your cost basis is generally the same as theirs — the original purchase price. If your parent bought a stock for $1,000, gave it to you when it was worth $5,000, and you sold it for $6,000, you owe tax on $5,000 of gain (the difference between your inherited basis of $1,000 and your sale price of $6,000). The $4,000 increase that happened before the gift is still taxable to you.
Frequently Asked Questions
Do I owe capital gains tax if I have not sold yet?
No. The IRS taxes gains only when you sell. If you own a stock that has doubled in value but you have not sold it, you owe no tax. The gain is "unrealized" until you sell. You can hold an asset for decades and never pay capital gains tax on it unless you sell.
What if I sold an asset but have not received the money yet?
The sale date is when the transaction closes, not when you receive the funds. For stocks, that is the settlement date (usually two business days after you sell). For real estate, it is the closing date on the deed. You report the gain in the tax year the sale closes, even if the money arrives later.
Can I avoid capital gains tax by donating the asset to charity?
Yes. If you donate an appreciated asset directly to a may have access to charity, you avoid the capital gains tax and can deduct the fair market value of the asset as a charitable contribution. You cannot sell it, pay the tax, and then donate the proceeds — you must donate the asset itself.
Do I owe capital gains tax on my primary home?
Not on the first $250,000 of gain if you are single, or $500,000 if you are married filing jointly, provided you owned and lived in the home as your primary residence for at least two of the last five years. Gains above that threshold are taxable. This exclusion applies only once every two years.
What if my broker did not send me a 1099-B?
Contact the broker and request a corrected form. You are still required to report the sale on your tax return even if you do not receive the form. The IRS has a copy, and if your return does not match, you will receive a notice. It is easier to file correctly the first time than to amend later.