The basic formula: sale price minus what you paid, multiplied by your tax rate
Capital gains tax is calculated on the profit you make when you sell an asset for more than you paid for it. The calculation itself is straightforward: subtract your original cost (called your basis) from the sale price, and that difference is your gain. The tax you owe depends on how long you held the asset and your income level.
The IRS taxes long-term gains (assets held over one year) at lower rates than short-term gains (held one year or less). Short-term gains are taxed as ordinary income at your regular tax bracket. Long-term gains use three separate rates: 0%, 15%, or 20%, depending on your total income for the year.
You do not owe tax on the full sale price — only on the profit. This is why basis matters. If you bought stock for $5,000 and sold it for $8,000, your gain is $3,000, and tax applies only to that $3,000.
Key Takeaways
- Your gain equals the sale price minus your original cost (basis), and tax applies only to this gain amount, not the full sale price.
- Assets held longer than one year may have access to for long-term rates (0%, 15%, or 20%); assets held one year or less are taxed at your ordinary income rate, which can be as high as 37%.
- Your tax bracket for the year determines which long-term rate applies, and the rates depend on filing status and total taxable income.
- Selling expenses, investment fees, and certain losses can reduce your gain, lowering the amount subject to tax.
- You report capital gains on Schedule D (Form 1040) and calculate the actual tax on Form 8949 or directly on Schedule D, depending on the number of transactions.
Determining your basis: what you actually paid
Basis is the starting point for every capital gains calculation. For most purchases, basis is straightforward what you paid for the asset plus any costs directly tied to buying it. If you bought 100 shares of stock at $50 per share and paid a $25 commission, your basis is $5,025 (not $5,000).
Basis can be more complex if you inherited the asset, received it as a gift, or own mutual funds with reinvested dividends. Inherited assets receive a step-up in basis, meaning the basis becomes the asset's fair market value on the date of death, not what the original owner paid. This can eliminate or drastically reduce the gain. If your parent bought stock for $10,000 and it was worth $40,000 when they died, your basis is $40,000, and you owe no tax if you sell when ready at that price.
Gifts do not receive a step-up. If someone gives you stock they bought for $5,000 that is now worth $15,000, your basis is $5,000, and you owe tax on the $10,000 gain when you sell. Keep records of the original purchase price and any documentation the giver provides.
For mutual funds and dividend-reinvestment plans, basis includes the cost of shares bought with reinvested dividends. Your brokerage statement or fund company should track this, but you can also calculate it yourself by adding up every purchase, including reinvested amounts.
Short-term versus long-term: how holding period changes your tax rate
The length of time you own an asset determines which tax rate applies. Short-term capital gains are profits on assets held for one year or less. These are taxed as ordinary income at your regular tax bracket, which ranges from 10% to 37% depending on your income and filing status.
If you are in the 24% tax bracket and have a short-term gain of $5,000, you owe $1,200 in federal tax on that gain. This is the same rate you pay on wages or interest income.
Long-term capital gains explore to assets held longer than one year. These use preferential rates: 0%, 15%, or 20%. The rate you pay depends on your total taxable income for the year and your filing status, not on how much the asset appreciated.
The holding period starts the day after you buy and ends the day you sell. If you bought on January 15 and sold on January 15 the following year, you have held it exactly one year, and it qualifies as long-term. If you sold on January 14, it is short-term.
Long-term rate brackets for 2024: which 0%, 15%, or 20% applies to you
Long-term capital gains rates depend on your filing status and your total taxable income. The IRS sets income thresholds each year. For 2024, here is how the brackets work:
| Filing Status | 0% Rate | 15% Rate | 20% Rate |
|---|---|---|---|
| Single | Up to $47,025 | $47,025 to $518,900 | Over $518,900 |
| Married Filing Jointly | Up to $94,050 | $94,050 to $583,750 | Over $583,750 |
| Head of Household | Up to $62,975 | $62,975 to $551,350 | Over $551,350 |
These thresholds are based on your taxable income, which includes wages, interest, dividends, and other income, plus your capital gains. If you are single with $40,000 in wages and a $10,000 long-term gain, your total taxable income is $50,000. The first $47,025 of that is in the 0% bracket, and the remaining $2,975 is in the 15% bracket. You owe $0 on the first portion and $446.25 on the second.
The thresholds change each year for inflation. Check the IRS website or your tax software for the current year's numbers before calculating.
Reducing your gain: deductible expenses and losses
You can reduce your capital gain by subtracting certain costs and losses. Selling expenses — such as broker commissions, listing fees for real estate, or legal fees directly tied to the sale — lower your gain dollar-for-dollar.
If you sold a rental property for $300,000, paid a 6% real estate commission ($18,000), and had $2,000 in closing costs, your net sale proceeds are $280,000. Subtract your basis from $280,000, not from $300,000.
Capital losses from other sales can offset capital gains. If you sold one stock at a $5,000 gain and another at a $2,000 loss in the same year, your net gain is $3,000, and you owe tax only on that amount. If your losses exceed your gains, you can deduct up to $3,000 of the excess loss against ordinary income (wages, interest, etc.). Any remaining loss carries forward to future years.
Investment fees and advisory costs are generally not deductible against capital gains. Ordinary business expenses — such as repairs to a rental property — reduce the gain on that property but are not deducted separately on your capital gains calculation.
Reporting capital gains on your tax return
You report capital gains on Schedule D (Form 1040), which is part of your federal tax return. Schedule D has two sections: Part I for short-term gains and Part II for long-term gains. You list each sale separately, showing the date acquired, date sold, sales price, cost basis, and gain or loss.
If you have more than a few transactions, you also file Form 8949 (Sales of Capital Assets), which feeds into Schedule D. Your brokerage or mutual fund company sends you a Form 1099-B (Proceeds from Broker and Barter Exchange Transactions) showing sales during the year. Use this to cross-check your records.
The actual tax calculation happens on Schedule D itself. You add up all short-term gains and losses, then all long-term gains and losses. The software or form then applies the appropriate tax rates. If you use tax software (TurboTax, H&R Block, TaxAct, or others), you enter each transaction, and the software calculates the tax automatically.
If you have a net capital loss for the year (losses exceed gains), you still file Schedule D to report it. The $3,000 deduction against ordinary income is claimed on your main Form 1040, and any excess loss carries to the next year on Schedule D.
State and local taxes on capital gains
Most states tax capital gains as ordinary income at your state tax rate. A few states — including Alaska, Florida, Nevada, South Dakota, Tennessee, Texas, Washington, and Wyoming — have no state income tax at all. Others tax capital gains at a lower rate or only on certain types of assets.
California, for example, taxes long-term capital gains at the same rate as ordinary income (up to 13.3%). New York taxes them at ordinary rates too (up to 10.9%). A handful of states, such as Massachusetts, tax capital gains at a flat rate (5% in Massachusetts).
You report state capital gains on your state tax return, usually on a schedule similar to Schedule D. The calculation is the same — gain equals sale price minus basis — but the rate depends on your state's rules. If you moved during the year, you may owe tax to both the old and new state, though most states offer a credit to avoid double taxation.
Frequently Asked Questions
Do I owe capital gains tax if I sell at a loss?
No. If you sell an asset for less than you paid, you have a capital loss, not a gain. You can use this loss to offset other capital gains or up to $3,000 of ordinary income in the same year. Any unused loss carries forward to future years.
What if I inherit stock or real estate — do I owe capital gains tax when ready?
No. Inherited assets receive a step-up in basis to their fair market value on the date of death. You owe no tax when you inherit. If you sell the asset later, tax applies only to any gain above that stepped-up basis.
How do I know my holding period if I bought through a dividend reinvestment plan?
Each purchase, including reinvested dividends, starts its own one-year holding period. If you bought shares in January and reinvested dividends in March, the January shares become long-term in January of the next year, and the March shares in March. Your brokerage tracks this; ask for a detailed cost basis report.
Can I use capital losses from my business to offset capital gains?
Yes, if the loss is a true capital loss (sale of a capital asset at a loss). Ordinary business losses are deducted differently and cannot be used to offset capital gains. Consult a tax professional if you are unsure whether a loss qualifies as a capital loss.
What if my capital gains push me into a higher tax bracket?
Capital gains are added to your other income to determine your total taxable income, which can push you into a higher bracket for long-term gains. For example, if you earn $50,000 in wages and have a $100,000 long-term gain, your total taxable income is $150,000. The gain fills up the 0% and 15% brackets first, then any excess is taxed at 20%. This is called "stacking" and is why the order of income matters.