The Basic Formula for Capital Gains Tax
Capital gains tax is calculated by taking the price you sold an asset for, subtracting what you paid for it, and then applying your tax rate to that difference. That difference is your capital gain. The tax you owe depends on how long you held the asset and your income level.
The formula is straightforward: Sale Price minus Purchase Price equals Capital Gain. Then multiply that gain by your tax rate. Your tax rate depends on whether the gain is short-term (you held it less than one year) or long-term (you held it one year or longer). Long-term gains are taxed at lower rates than short-term gains in most cases.
You report capital gains on your federal tax return using IRS Form 8949 and Schedule D. State taxes on capital gains vary — some states do not tax capital gains at all, while others tax them as ordinary income.
Key Takeaways
- Capital gain equals the sale price minus your original purchase price, and you pay tax only on that gain, not the full sale amount.
- Short-term capital gains (assets held less than one year) are taxed at your ordinary income tax rate, which is higher than long-term rates.
- Long-term capital gains (assets held one year or longer) are taxed at 0%, 15%, or 20% depending on your total income, which is lower than short-term rates.
- You report capital gains on IRS Form 8949 and Schedule D when you file your federal tax return, and state taxes on capital gains vary by location.
- Losses from selling assets can offset gains, reducing the total capital gain you owe tax on.
Short-Term vs. Long-Term Capital Gains Rates
The holding period determines which tax rate applies. If you sell an asset within one year of buying it, the gain is short-term and taxed as ordinary income. Your ordinary income tax rate depends on your total income and filing status — it can range from 10% to 37% for federal tax in 2024, though rates change annually.
If you hold an asset for more than one year before selling, the gain is long-term and receives preferential tax treatment. Long-term capital gains are taxed at 0%, 15%, or 20% depending on your income level and filing status. For 2024, the 0% rate applies to single filers with income up to $47,025, the 15% rate applies to those earning between roughly $47,025 and $518,900, and the 20% rate applies to higher earners. These income thresholds change each year.
The difference matters significantly. A $10,000 short-term gain taxed at 24% costs $2,400 in federal tax. The same $10,000 long-term gain taxed at 15% costs $1,500. Holding an asset just past the one-year mark can save thousands in taxes.
Step-by-Step Calculation Example
Suppose you bought 100 shares of a stock for $50 per share on March 15, 2023, spending $5,000 total. You sold all 100 shares for $75 per share on April 10, 2024, receiving $7,500. Here is how to calculate your tax:
| Step | Calculation | Amount |
| Sale proceeds | 100 shares × $75 | $7,500 |
| Original cost (basis) | 100 shares × $50 | $5,000 |
| Capital gain | $7,500 − $5,000 | $2,500 |
| Holding period | March 15, 2023 to April 10, 2024 | Long-term (over 1 year) |
| Tax rate (example) | 15% long-term rate | 15% |
| Federal tax owed | $2,500 × 15% | $375 |
Your $2,500 gain is taxed at the long-term rate because you held the stock longer than one year. If you had sold on March 14, 2024 instead, it would be short-term and taxed at your ordinary income rate, which could be 22%, 24%, or higher depending on your total income.
Adjusting Your Cost Basis
Your cost basis is what you paid for an asset, but it is not always simply the purchase price. You must add certain costs to your basis and subtract certain proceeds from it.
Add to your basis: broker commissions and fees you paid when you bought the asset, investment advisory fees directly tied to the purchase, and reinvested dividends (if you own mutual funds or stocks that pay dividends). Subtract from your basis: any return of capital distributions you received, and depreciation deductions you claimed (for rental property or business assets).
For real estate, your basis includes the purchase price plus the cost of improvements like a new roof, addition, or major renovation. It does not include maintenance costs like painting or repairs. If you inherited property, your basis is usually 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 significantly reduce your capital gain.
Using Capital Losses to Reduce Your Tax
If you sell an asset at a loss, you can use that loss to offset capital gains. If you have $5,000 in gains and $2,000 in losses, your net capital gain is $3,000, and you pay tax only on that $3,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. Any remaining loss carries forward to future years. For example, if you have $10,000 in losses and $2,000 in gains, you can deduct $3,000 against your ordinary income this year, and the remaining $5,000 carries to next year.
This strategy, called tax-loss harvesting, is common among investors. You sell a losing position to lock in the loss, then buy a similar (but not identical) investment to maintain your portfolio position. The IRS has a wash-sale rule that prevents you from claiming a loss if you buy the same or substantially identical security within 30 days before or after the sale, so timing matters.
Reporting Capital Gains on Your Tax Return
You report capital gains using IRS Form 8949 (Sales of Capital Assets) and Schedule D (Capital Gains and Losses). Form 8949 lists each transaction — the asset, date acquired, date sold, proceeds, cost basis, and gain or loss. Schedule D summarizes your short-term and long-term gains and losses and calculates your net capital gain.
You attach both forms to your Form 1040 (your main federal tax return). If you have only a few transactions, some tax software will complete these forms automatically if you enter the sale information. If you have many transactions or complex situations, a tax professional can help ensure accuracy.
State tax treatment varies widely. Some states, like Florida and Texas, do not tax capital gains. Others tax capital gains as ordinary income. A few states have separate capital gains tax rates. Check your state's tax agency website or speak with a tax professional to understand your state's rules.
Special Situations and Exceptions
Certain assets receive different treatment. Collectibles — art, antiques, coins, and similar items — are taxed at a maximum 28% rate on long-term gains, not the standard 0%, 15%, or 20%. Section 1202 small business stock can exclude up to 50% of gains if you meet specific holding and business size requirements. may have access to opportunity zone investments have special deferral and exclusion rules if held for certain periods.
If you sell your primary residence, you may exclude up to $250,000 of gain (or $500,000 if married filing jointly) if you owned and lived in the home for at least two of the last five years. This exclusion applies once every two years and can significantly reduce or eliminate your tax on a home sale.
Inherited assets receive a step-up in basis to their fair market value on the date of death, which means you typically owe no capital gains tax on appreciation that occurred before you inherited the asset. Only gains after you inherit are taxable.
Frequently Asked Questions
Do I owe capital gains tax if I have not sold the asset yet?
No. Capital gains tax is owed only when you sell an asset. Unrealized gains — increases in value while you still own the asset — are not taxed. You can hold an appreciating stock or property indefinitely without owing tax until you sell it.
What if I sold an asset at a loss — can I deduct it?
Yes, but only against capital gains or up to $3,000 of ordinary income per year. Excess losses carry forward to future years. You cannot deduct capital losses against wages or other ordinary income beyond that $3,000 annual limit.
How do I know my cost basis if I lost the original purchase documents?
Your broker or financial institution should have records. Contact them and request a cost basis report. For older transactions, the IRS allows reasonable estimates based on historical price data if original documents are unavailable, though documentation is always preferable.
Does the capital gains tax rate change every year?
The tax rates themselves (0%, 15%, 20% for long-term) do not change, but the income thresholds that determine which rate applies adjust annually for inflation. Check the IRS website or your tax software each year for current thresholds based on your filing status.
If I inherit an asset, do I owe capital gains tax on the increase in value before I inherited it?
No. Inherited assets receive a step-up in basis to their fair market value on the date of death. You owe tax only on gains that occur after you inherit the asset, not on appreciation that happened while the previous owner held it.