How Capital Gains Tax Is Calculated on Your Investments
Capital gains tax is the tax on profit you make when you sell an investment for more than you paid for it
The calculation starts with the difference between what you paid for an asset and what you sold it for. If you bought 100 shares of stock at $50 per share ($5,000 total) and sold them at $75 per share ($7,500 total), your capital gain is $2,500. That $2,500 is what gets taxed, not the full $7,500 sale price.
The tax rate you pay depends on two things: how long you held the asset, and your income level. The IRS treats investments you hold for one year or less differently from those you hold longer than one year. Your tax bracket also matters — higher earners pay higher rates on long-term gains.
You report capital gains on your federal tax return using Schedule D (Form 1040), which asks you to list each sale, the purchase price, the sale price, and the holding period. State taxes on capital gains vary widely; some states don't tax them at all, while others tax them as ordinary income.
Key Takeaways
- Capital gain equals the sale price minus the purchase price, and only that gain is taxed, not the entire sale amount.
- Short-term capital gains (held one year or less) are taxed as ordinary income at your regular tax rate, which can be 10%, 12%, 22%, 24%, 32%, 35%, or 37% depending on your income.
- Long-term capital gains (held more than one year) are taxed at 0%, 15%, or 20% depending on your income level, which is usually lower than your ordinary income tax rate.
- You must report each sale on Schedule D, including the asset name, purchase date, sale date, purchase price, and sale price.
- State capital gains taxes range from zero to over 13%, depending on where you live and your income.
Short-term capital gains are taxed at your ordinary income tax rate
When you sell an investment you've held for one year or less, the gain is treated as ordinary income. This means it's taxed at the same rate as your salary, wages, or other regular income. If you're in the 24% tax bracket, a short-term capital gain of $2,500 costs you $600 in federal tax.
Short-term gains are added to your other income for the year, which can push you into a higher tax bracket. If you earned $80,000 in salary and have a $30,000 short-term capital gain, the IRS treats you as having $110,000 in income for that year. This can move you from the 22% bracket into the 24% bracket, meaning some of your gain is taxed at the higher rate.
The seven federal tax brackets for 2024 are 10%, 12%, 22%, 24%, 32%, 35%, and 37%. Your bracket depends on your filing status (single, married filing jointly, head of household, etc.) and your total income. The IRS adjusts these brackets each year for inflation.
Long-term capital gains use a separate, usually lower tax rate
If you hold an investment for more than one year before selling, the gain qualifies for long-term capital gains treatment. The federal tax rates for long-term gains are 0%, 15%, or 20% — significantly lower than ordinary income rates for most people.
The rate you pay depends on your income level and filing status. For 2024, single filers pay 0% on long-term gains up to $47,025, then 15% from $47,025 to $518,900, then 20% above that. Married couples filing jointly pay 0% up to $94,050, then 15% up to $583,750, then 20% above that. These income thresholds change each year.
This is why holding period matters so much. A $10,000 long-term gain taxed at 15% costs $1,500 in federal tax. The same $10,000 as a short-term gain in the 24% bracket costs $2,400 — a difference of $900 on a single sale.
How to calculate your basis and avoid paying tax twice
Basis is the amount you paid for an investment, including purchase price and any fees or commissions. When you sell, you subtract your basis from the sale price to find your gain. If you paid $5,000 to buy stock plus $50 in broker fees, your basis is $5,050.
Basis matters because it's the only part of your sale price that isn't taxed. If you sell for $7,500 with a basis of $5,050, your taxable gain is $2,450, not $7,500. The IRS requires you to track basis carefully to avoid paying tax on money you already paid out.
If you reinvest dividends or make additional purchases, your basis increases. If you bought 100 shares at $50 each ($5,000) and later bought 50 more at $60 each ($3,000), your total basis is $8,000 for all 150 shares. Your average cost per share is about $53.33. When you sell, you need to know which shares you're selling — you can use specific identification, FIFO (first in, first out), or average cost methods.
Losses can reduce or eliminate your capital gains tax
If you sell an investment for less than you paid for it, you have a capital loss. Capital losses can offset capital gains dollar-for-dollar. If you have $5,000 in long-term gains and $3,000 in long-term losses, you report a net gain of $2,000.
If your losses exceed your gains in a year, you can deduct up to $3,000 of the excess loss against your ordinary income. If you have $10,000 in losses and $2,000 in gains, you can deduct $3,000 of the $8,000 net loss against your salary or other income. The remaining $5,000 in losses carries forward to future years, where you can use it again.
This is called tax-loss harvesting — selling losing positions to offset gains elsewhere in your portfolio. Some investors do this deliberately in December to reduce their tax bill for the year.
State taxes on capital gains vary widely and can add significantly to your bill
Federal capital gains tax is only part of the picture. Most states also tax capital gains, though the rate and rules differ. Nine states — Alaska, Florida, Nevada, South Dakota, Tennessee, Texas, Washington, Wyoming, and New Hampshire — don't tax capital gains at all. New Hampshire taxes only dividend and interest income, not gains from selling stocks or real estate.
Other states tax capital gains as ordinary income, meaning your state tax rate depends on your state income tax bracket. California taxes long-term gains at the same rate as ordinary income, with rates up to 13.3%. New York's top rate on capital gains is 10.9%. Some states have flat taxes: Illinois taxes capital gains at 4.95% regardless of income level.
A few states have special capital gains taxes separate from income tax. Washington has a 7% tax on long-term gains over $250,000. Colorado taxes capital gains at 4.63%. These rates are in addition to any federal tax you owe. If you live in a high-tax state and sell a large investment, state tax can be a significant part of your total bill.
How to report capital gains on your tax return
You report capital gains using Schedule D (Form 1040), which the IRS provides free. On Schedule D, you list each sale separately: the asset description, the date you bought it, the date you sold it, the purchase price (your basis), the sale price, and the gain or loss.
Schedule D separates short-term transactions (held one year or less) from long-term transactions (held more than one year). You total each section, then combine them to find your net capital gain or loss for the year. This net number transfers to your main tax return (Form 1040) and affects your taxable income.
If you sold mutual funds or stocks, your broker sends you a Form 1099-B showing the sales. If you sold real estate, you typically don't receive a 1099-B, but you still must report the sale on Schedule D. Keep records of your purchase price, purchase date, sale price, and sale date for at least three years after you file your return — longer if the IRS audits you.
Special situations: inherited assets, real estate, and collectibles
When you inherit an investment, your basis is "stepped up" to the market value on the date of death. If your parent bought stock for $10,000 and it was worth $50,000 when they died, your basis is $50,000. If you sell it the next day for $50,000, you have no gain and pay no tax. This step-up in basis is one of the largest tax benefits in the U.S. tax code.
Real estate sales follow the same capital gains rules as stocks, but with additional complexity. If you sell a primary residence, you can exclude up to $250,000 in gains if you're single or $500,000 if you're married filing jointly, provided you owned and lived in the home for at least two of the last five years. Investment properties don't get this exclusion.
Collectibles — art, coins, stamps, and similar items — are taxed at a maximum federal rate of 28% on long-term gains, higher than the 20% rate for stocks. This rate applies even if your income would normally put you in the 15% or 0% bracket for stock gains.
Frequently Asked Questions
Do I owe capital gains tax if I haven't sold yet?
No. Capital gains tax is only owed when you actually sell an investment. Unrealized gains — increases in value while you still own the asset — are not taxed. You can hold an investment that has doubled in value and owe nothing until you sell it.
What if I sold at a loss — can I get a tax refund?
Not directly. Capital losses reduce your taxable income, which lowers your tax bill, but they don't generate a refund by themselves. You can deduct up to $3,000 in net losses against ordinary income each year. Losses beyond that carry forward to future years.
How do I know if my gain is long-term or short-term?
Count the days from the purchase date to the sale date. If it's more than one year, it's long-term. The IRS counts the purchase date as day zero and the sale date as day one, so buying on January 1 and selling on January 2 of the next year is long-term. Your broker's tax documents usually label this for you.
Can I reduce my capital gains tax by donating the stock instead of selling it?
Yes. If you donate appreciated stock directly to a may have access to charity, you avoid the capital gains tax entirely and can deduct the full market value as a charitable contribution. You must own the stock long-term for this to work, and the charity must be may have access to by the IRS.
What happens to capital gains tax if I move to a different state?
Your tax liability depends on where you lived when you sold the investment. If you sold stock while living in California and then moved to Texas, you owe California tax on that gain. Some states have rules about gains on property located within the state, even if you moved away.
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.