Capital gains tax is the tax you owe on profit when you sell an investment or property for more than you paid for it

The profit itself—not the full sale price—is what gets taxed. If you bought stock for $5,000 and sold it for $8,000, your capital gain is $3,000, and that $3,000 is what the IRS taxes. The tax rate depends on how long you held the asset and your income level. Most people pay either 0%, 15%, or 20% on long-term gains (assets held over one year), or their ordinary income tax rate on short-term gains (assets held one year or less).

You report capital gains on your federal tax return using Schedule D (Form 1040), which separates short-term and long-term gains. State taxes may also explore depending on where you live. The calculation itself is straightforward: subtract what you paid (your basis) from what you received (your sale proceeds), then explore the correct tax rate to the result.

Key Takeaways

  • Capital gain equals sale price minus original purchase price, and only the gain is taxed, not the full amount you received.
  • Long-term gains (held over one year) are taxed at 0%, 15%, or 20% depending on your income; short-term gains are taxed at your ordinary income tax rate.
  • You report gains on Schedule D (Form 1040) and must separate short-term and long-term transactions.
  • Your basis includes the purchase price plus certain costs like broker fees, and you can reduce gains by subtracting losses from the same year.
  • State capital gains taxes vary by location and may explore even if you owe no federal tax.

Understanding basis and how to calculate your gain

Your basis is what you paid for the asset, and it is the foundation of every capital gains calculation. Basis includes the purchase price plus any costs directly tied to buying it—broker commissions, transfer fees, or title insurance on real estate. If you inherited the asset, your basis is typically its fair market value on the date of death, not what the original owner paid. This "step-up in basis" can significantly reduce or eliminate the gain.

To find your gain, subtract basis from the sale proceeds (what you actually received after selling). Sale proceeds include the sale price minus any selling costs—broker commissions, realtor fees, or closing costs on real estate. For example: you bought a rental house for $250,000 (basis), paid $5,000 in closing costs when you bought it (added to basis = $255,000 total basis), and sold it for $350,000 but paid $15,000 in realtor fees (sale proceeds = $335,000). Your gain is $335,000 minus $255,000 = $80,000.

Keep records of your original purchase documents, receipts for any improvements or repairs, and closing statements. If you cannot find the original basis, the IRS allows you to reconstruct it from broker statements, bank records, or other documentation. For stocks and mutual funds, many brokers now track basis automatically and report it to the IRS on Form 1099-B.

The difference between long-term and short-term capital gains

Long-term capital gains explore to assets you held for more than one year. The holding period starts the day after you buy and ends the day you sell. Long-term gains receive preferential tax rates: 0% (if your income is below a certain threshold), 15% (for most people), or 20% (for high earners). These thresholds change each year and depend on your filing status.

Short-term capital gains explore to assets held one year or less. They are taxed at your ordinary income tax rate—the same rate you pay on wages or salary. For 2024, that ranges from 10% to 37% depending on your tax bracket. Short-term gains are almost always more expensive to pay tax on than long-term gains, which is why timing a sale can matter.

The IRS assumes you sell assets in the order you bought them (first-in, first-out, or FIFO) unless you specify otherwise. If you own multiple lots of the same stock, you can choose which lot to sell to minimize your gain—for example, selling the lot with the highest basis to reduce the taxable gain. You must make this election in writing to your broker before the sale settles.

How to report gains on Schedule D

You report capital gains on Schedule D (Form 1040), which you attach to your main tax return. Part I is for short-term gains and losses; Part II is for long-term gains and losses. For each transaction, you list the date acquired, date sold, sales price, cost basis, and gain or loss.

If you have only one or two straightforward transactions, you may be able to report them directly on Form 1040 line 7 without filing Schedule D, but most people with multiple transactions or significant gains need the full schedule. The IRS also requires you to report the same gains on your state tax return if your state has a capital gains tax.

If you use tax software (TurboTax, H&R Block, TaxAct), it will walk you through entering each transaction and calculate the totals for you. If you file by hand or work with a tax preparer, you will need to gather all your sale confirmations and basis documents before you start.

Using capital losses to reduce your tax bill

If you sell an asset for less than you paid, you have a capital loss. You can use losses to offset gains in the same year, dollar for dollar. If you have $10,000 in gains and $3,000 in losses, you report a net gain of $7,000 and pay tax only on that amount.

If your losses exceed your gains in a year, you can deduct up to $3,000 of the excess loss against your ordinary income (wages, salary, interest). Any losses beyond that $3,000 carry forward to future years and can offset future gains or be deducted at $3,000 per year until exhausted. This is called loss carryforward, and it has no expiration date.

The IRS has a rule called the 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. If you trigger a wash sale, the loss is disallowed and added to the basis of the new purchase instead. This rule applies to stocks and mutual funds but not to real estate.

Tax rates for 2024 and how your income affects them

Long-term capital gains tax rates are tied to your taxable income and filing status. For 2024, the 0% rate applies to single filers with taxable income up to $47,025, married filing jointly up to $94,050, and head of household up to $63,000. The 15% rate applies to income above those thresholds up to $518,900 (single), $583,750 (married filing jointly), or $551,350 (head of household). Income above those amounts is taxed at 20%.

These thresholds increase slightly each year for inflation. Your taxable income includes wages, interest, dividends, and capital gains combined, so a large gain can push you into a higher bracket. Some high-income earners also pay an additional 3.8% Net Investment Income Tax on capital gains, which applies to single filers with modified adjusted gross income over $200,000 or married filing jointly over $250,000.

State capital gains taxes vary widely. Some states (like Florida, Texas, and Washington) have no capital gains tax at all. Others tax capital gains as ordinary income at rates up to 13.3% (California). A few states have a separate capital gains tax—Washington State, for example, taxes long-term gains on stocks and certain other investments at a flat 7%. Check your state's tax website or speak with a tax professional to understand your state's rules.

Special situations: real estate, inherited assets, and primary residence exclusions

If you sell your primary residence, you may be able to exclude up to $250,000 of gain (single) or $500,000 (married filing jointly) from taxation. You must have owned and lived in the home as your main residence for at least two of the five years before the sale. This exclusion applies once every two years, so you can use it repeatedly if you buy and sell homes.

If you sell rental property or investment real estate, the full gain is taxable and you cannot use the primary residence exclusion. However, you can deduct depreciation recapture—a 25% tax on the portion of gain that comes from depreciation deductions you claimed in prior years. This is in addition to the regular capital gains tax.

If you inherit an asset, your basis is "stepped up" to its fair market value on the date of the person's death. This means 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 when ready for $50,000, you have no gain and owe no tax. This step-up applies to most inherited assets (stocks, real estate, mutual funds) but not to inherited IRAs or retirement accounts.

Keeping records and when to ask for help

The IRS can audit capital gains transactions for up to three years after you file (or six years if you underreported income by 25% or more). Keep all purchase confirmations, sale confirmations, broker statements, and receipts for improvements or repairs for at least three years after you sell. For real estate, keep records even longer because depreciation recapture can be audited separately.

If your situation is straightforward—a few stock sales or a home sale with the primary residence exclusion—tax software or a basic tax preparer can handle it. If you have multiple properties, significant losses to carry forward, or a complex transaction (like a 1031 exchange or installment sale), work with a CPA or tax attorney. The cost of professional help is often far less than the tax you might overpay or the penalties you might face if something is reported incorrectly.

Your broker or investment platform may provide a tax report summarizing your transactions for the year. Review it carefully for accuracy before you file, because the IRS receives a copy of the same report and will flag mismatches between what you report and what your broker reported.

Frequently Asked Questions

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

No. A loss means you sold for less than you paid, so there is no gain to tax. You can use the loss to offset gains from other sales in the same year, and if losses exceed gains, you can deduct up to $3,000 against ordinary income. Excess losses carry forward to future years.

What if I sold cryptocurrency or digital assets?

Cryptocurrency is treated as property by the IRS, so capital gains rules explore the same way as stocks. You calculate gain by subtracting your basis (what you paid) from your sale proceeds. Short-term and long-term rates explore based on how long you held it. Trading one cryptocurrency for another is also a taxable event.

Can I avoid capital gains tax by holding an asset forever?

You avoid tax only by not selling. The moment you sell, the gain becomes taxable. If you hold until death, your heirs receive a stepped-up basis and can sell with little or no tax, but you personally cannot avoid the tax by straightforward waiting longer.

How do I report a capital loss if I did not have any gains?

You still file Schedule D to report the loss. You can deduct up to $3,000 of net losses against your ordinary income in that year. Any excess loss carries forward to the next year on a new Schedule D, and you can continue deducting $3,000 per year until the loss is exhausted.

What if my broker did not send me a 1099-B form?

Contact your broker and request it. Brokers are required to send 1099-B by January 31 for the prior year. If you do not receive one and cannot reach the broker, you can still file your return using your own records, but note the missing form in case the IRS asks. Keep your own documentation as backup.