What capital gains tax is and when you owe it

Capital gains tax is what you owe the IRS when you sell an asset for more than you paid for it. The difference between what you paid (your basis) and what you sold it for (your sale price) is your gain. You report this on your tax return, and the IRS taxes it as income.

You owe capital gains tax on stocks, real estate, cryptocurrency, collectibles, and most other property you own. You do not owe it on assets you still hold — only when you actually sell. If you sell at a loss, you can use that loss to reduce other gains or, in some cases, reduce your ordinary income.

The tax rate depends on how long you held the asset. If you held it for one year or less, it is taxed as short-term capital gains at your ordinary income tax rate (10% to 37%, depending on your income). If you held it for more than one year, it is taxed as long-term capital gains at a lower rate: 0%, 15%, or 20%, depending on your income.

Key Takeaways

  • Capital gains tax applies only when you sell an asset, not while you own it, and is calculated as the sale price minus what you originally paid for it.
  • Short-term gains (held one year or less) are taxed at your ordinary income rate; long-term gains (held over one year) are taxed at 0%, 15%, or 20%.
  • You must track your original purchase price, purchase date, sale price, and sale date for every asset you sell during the year.
  • Losses can offset gains dollar-for-dollar, and unused losses can reduce your ordinary income by up to $3,000 per year.
  • You report capital gains and losses on Schedule D (Form 1040), which feeds into your main tax return.

Gather your purchase and sale records

Before you calculate anything, collect the documents that prove what you paid and what you sold for. For stocks and mutual funds, your brokerage statement shows the purchase date, number of shares, price per share, and total cost. For real estate, your closing statement shows the purchase price and date. For cryptocurrency, your exchange account history shows the date and price of every transaction.

You need four pieces of information for each asset you sold: the date you bought it, the price you paid per unit, the date you sold it, and the price you sold it for. If you received the asset as a gift or inheritance, the rules are different — the basis is the fair market value on the date you received it, not what the previous owner paid. Keep these records for at least three years after you file your return; the IRS can ask for them.

If you sold real estate, also gather your closing statement from the sale, which shows the sale price and any commissions or fees. These fees reduce your net proceeds and lower your gain. If you made improvements to the property (a new roof, addition, or major repair), keep receipts for those too — they add to your basis and lower your taxable gain.

Calculate your basis (what you paid)

Your basis is usually what you paid for the asset, but it can include other costs. For stocks or mutual funds, basis is the purchase price plus any commissions or fees you paid to buy them. For real estate, basis includes the purchase price, closing costs (title insurance, attorney fees, recording fees), and the cost of any permanent improvements (new roof, deck, furnace). It does not include maintenance or repairs.

If you bought shares at different times and prices, you must choose a method to identify which shares you sold. The three common methods are:

  1. First-in, first-out (FIFO): You sold the shares you bought first. This is the default if you do not specify another method.
  2. Specific identification: You tell your broker exactly which shares you sold. This often results in the lowest tax because you can sell the highest-cost shares first.
  3. Average cost: You use the average price of all shares you own. This is common for mutual funds.

If you use specific identification, you must tell your broker in writing at the time of sale which shares you are selling. If you do not, the IRS assumes FIFO. Choosing the right method can save you hundreds or thousands in taxes, so check with your broker about what they support before you sell.

Calculate your gain or loss

Subtract your basis from your sale price. The result is your gain or loss.

Gain = Sale Price − Basis

Example: You bought 100 shares of Stock A for $50 per share on March 15, 2022 (basis = $5,000). You sold all 100 shares for $75 per share on July 10, 2023 (sale price = $7,500). Your gain is $7,500 − $5,000 = $2,500.

Because you held the shares for more than one year (March 2022 to July 2023), this is a long-term gain. If you had sold on March 10, 2023 instead (less than one year), it would be a short-term gain.

If the sale price is less than your basis, you have a loss. Losses reduce your gains dollar-for-dollar. If you have $5,000 in gains and $2,000 in losses, your net gain is $3,000. If losses exceed gains, you can deduct up to $3,000 of the excess loss against your ordinary income in that year. Any remaining loss carries forward to future years.

Determine whether your gain is short-term or long-term

The holding period starts the day after you buy and ends on the day you sell. If you bought on March 15, 2022, and sold on March 15, 2023, you held it for exactly one year, which counts as short-term. You must hold it until March 16, 2023, or later for it to be long-term.

Short-term gains are taxed at your ordinary income tax rate. If you are in the 24% federal income tax bracket, your short-term gains are taxed at 24%. Long-term gains are taxed at 0%, 15%, or 20%, depending on your total taxable income for the year. For 2024, the 15% rate applies to most people; the 0% rate applies to lower-income filers, and the 20% rate applies to high-income filers.

The tax rate thresholds change every year. For 2024, long-term gains are taxed at 0% if your taxable income is below $47,025 (single) or $94,050 (married filing jointly). They are taxed at 15% above those thresholds up to $518,900 (single) or $583,750 (married), and 20% above that. These numbers are adjusted annually for inflation.

Report your gains and losses on Schedule D

You report all capital gains and losses on Schedule D (Form 1040), which is part of your federal tax return. Part I of Schedule D is for short-term gains and losses; Part II is for long-term gains and losses. List each transaction separately: the description of the property, the date acquired, the date sold, the sales price, the cost or other basis, and the gain or loss.

If you have many transactions (more than four or five), you can attach a separate statement listing them all and just enter the totals on Schedule D. Your tax software usually does this automatically.

At the bottom of Schedule D, you calculate your net short-term gain or loss and your net long-term gain or loss. If you have both, you combine them to get your total net capital gain or loss. This number flows to your Form 1040, where it is added to or subtracted from your other income.

If your net capital loss exceeds $3,000, you can only deduct $3,000 in the current year. The rest carries forward to future years on a form called Form 8949 (Sales of Capital Assets). You will need to track this carryover and report it when you file next year.

Understand state and local taxes on capital gains

Most states tax capital gains as ordinary income, so you owe state tax on top of federal tax. A few states do not tax capital gains at all: Alaska, Florida, Nevada, South Dakota, Tennessee, Texas, Washington, and Wyoming. If you live in one of these states, you owe only federal capital gains tax.

Some states have special capital gains taxes. California, New Jersey, and New York tax long-term gains at higher rates than ordinary income. Washington and Illinois have capital gains taxes that explore only to certain types of gains. Check your state's tax authority website or ask a tax professional in your state to understand your state's rules.

If you sold property in a state where you do not live, you may owe tax to that state as well. This is most common with real estate. If you sold a rental property in Florida but live in New York, you may owe Florida tax on the gain. States have agreements to prevent double taxation, but you should report the sale to both states.

Frequently Asked Questions

Do I owe capital gains tax if I sold at a loss?

No. If you sold for less than you paid, you have a loss, not a gain. You can use losses to reduce other gains or, if losses exceed gains, to reduce your ordinary income by up to $3,000 per year. Any unused loss carries forward to future years.

What if I inherited stock or real estate?

Your basis is the fair market value on the date the person died, not what they paid. If you sell it shortly after inheriting it, you usually have little or no gain. This is called a "step-up in basis" and is a major tax benefit of inheritance.

How do I report capital gains if I use tax software?

Most tax software (TurboTax, H&R Block, TaxAct) has a section for capital gains. You enter each sale, and the software calculates the gain or loss and fills in Schedule D automatically. If your brokerage provides a 1099-B form, you can often import it directly into the software.

Can I deduct investment losses to reduce my income?

Yes, but only up to $3,000 per year. If you have $5,000 in losses and no gains, you can deduct $3,000 against your ordinary income this year. The remaining $2,000 carries forward to next year, where you can deduct another $3,000 (if you have losses that year), and so on.

What is the difference between cost basis and adjusted basis?

Cost basis is what you paid. Adjusted basis is your cost basis plus or minus certain adjustments. For stocks, it is usually the same. For real estate, adjusted basis includes the cost of improvements you made. For inherited property, adjusted basis is the stepped-up value on the date of death.