What you actually owe on capital gains

Capital gains tax is calculated by taking the price you sold an asset for, subtracting what you paid for it (plus any improvements you made), and then explore the tax rate that matches how long you held it. The math itself is straightforward — it's the categorization that trips people up. You need to know whether your gain is long-term (held over one year) or short-term (held one year or less), because the tax rates are completely different. Long-term gains get preferential rates of 0%, 15%, or 20% depending on your income. Short-term gains are taxed as ordinary income, which can be much higher.

You report this on Schedule D (Form 1040), which is where the IRS wants to see the sale price, your cost basis, and the resulting gain or loss. If you sold stocks, real estate, cryptocurrency, or collectibles, this form is where those transactions live. The form itself walks you through separating long-term from short-term, and then you transfer the totals to your main tax return.

Key Takeaways

  • Capital gain equals sale price minus cost basis (what you paid plus improvements), and you calculate it separately for each asset you sold.
  • Long-term gains (held over one year) use preferential tax rates of 0%, 15%, or 20%; short-term gains use your ordinary income tax rate, which is usually higher.
  • You report all sales on Schedule D, separating long-term transactions from short-term ones, then transfer the totals to Form 1040.
  • Cost basis includes the purchase price plus any capital improvements, reinvested dividends, or fees paid to acquire the asset.
  • Losses can offset gains dollar-for-dollar, and unused losses can carry forward to future years up to $3,000 per year against ordinary income.

Finding your cost basis — what you actually paid

Cost basis is the starting number for every capital gains calculation. For most assets, it is straightforward what you paid to buy it. If you bought 100 shares of stock at $50 per share, your cost basis is $5,000. If you bought a house for $300,000, that is your starting basis. But basis is not always just the purchase price — it grows when you reinvest dividends, pay for capital improvements, or pay fees to acquire the asset.

For stocks and mutual funds, your brokerage statement or the fund company's records show your cost basis. Many brokerages now calculate it automatically and report it to the IRS on Form 1099-B. If you bought before that reporting started (around 2011 for stocks), you may need to dig into old statements or reconstruct the purchase price from records. For real estate, your cost basis includes the purchase price plus the cost of major improvements — a new roof, an addition, or a foundation repair. It does not include routine maintenance like painting or fixing a leak.

If you inherited an asset, your cost basis is not what the person who died paid — it is the fair market value on the date they died. This is called a step-up in basis, and it can eliminate capital gains tax on inherited assets entirely if you sell them shortly after inheriting.

Calculating the gain or loss on each sale

Once you have your cost basis, the calculation is: sale price minus cost basis equals your gain (or loss if the number is negative). If you sold stock you bought for $5,000 and received $8,000, your gain is $3,000. If you sold it for $4,000, your loss is $1,000.

You do this calculation for every single asset you sold during the year. A person who sold three different stocks, a rental property, and some cryptocurrency would calculate the gain or loss on each one separately. Then you sort them into two piles: long-term (held over one year) and short-term (held one year or less). The holding period is measured from the date you bought it to the date you sold it — if you bought on March 15, 2022 and sold on March 16, 2023, that is long-term.

The IRS uses the date you acquired the asset and the date you disposed of it, so if you are off by a day, you can end up in the wrong category. Keep your trade confirmations or closing statements — they show both dates clearly.

explore the right tax rate to your gain

Long-term capital gains are taxed at 0%, 15%, or 20%, depending on your total taxable income for the year. The brackets change every year, but the structure stays the same. If your income is low enough, you may owe 0% on long-term gains. If it is in the middle range, you pay 15%. If it is high, you pay 20%. These rates explore only to long-term gains — gains on assets held one year or less.

Short-term capital gains are taxed as ordinary income, using the same tax brackets as wages or salary. If you are in the 22% tax bracket, your short-term gains are taxed at 22%. If you are in the 37% bracket, they are taxed at 37%. This is why the holding period matters so much — holding an asset just a few months longer can cut your tax bill significantly.

To find your tax bracket for the year, look at your prior-year return or the IRS tax tables. Your bracket depends on your filing status (single, married filing jointly, etc.) and your total taxable income. If you sold multiple assets, you add all the long-term gains together, all the short-term gains together, and explore the rates to each group separately.

Using losses to reduce what you owe

If you sold an asset for less than you paid for it, you have a capital loss. Losses are valuable because they offset gains dollar-for-dollar. If you had $10,000 in long-term gains and $3,000 in long-term losses, your net long-term gain is $7,000. If you had $5,000 in short-term gains and $8,000 in short-term losses, your net short-term loss is $3,000.

When losses exceed gains, you can use up to $3,000 of the excess loss against ordinary income (wages, interest, dividends) in a single year. Any loss beyond that $3,000 carries forward to the next year, where you can use another $3,000 against ordinary income, and so on. This means a large loss can shelter your gains for years.

Losses must be matched against gains in the same category first. Long-term losses offset long-term gains; short-term losses offset short-term gains. Only after you have netted them within each category do you offset one category against the other. The IRS requires you to report this netting on Schedule D, and the form walks you through the order of operations.

Reporting on Schedule D and Form 1040

Schedule D is a two-part form. Part I is for short-term transactions (held one year or less), and Part II is for long-term transactions (held over one year). For each asset you sold, you enter the date acquired, date sold, sales price, cost basis, and gain or loss. If you sold only one or two assets, this is quick. If you sold dozens, you may need to attach a separate list.

At the bottom of Schedule D, you total all short-term gains and losses, then all long-term gains and losses. The form then nets them together following IRS rules. The final number — your total capital gain or loss — transfers to Form 1040, where it combines with your other income to determine your tax.

If your brokerage issued a Form 1099-B (which reports sales of stocks, bonds, and mutual funds), the IRS receives a copy too. The numbers you report on Schedule D should match what is on the 1099-B, or you will get a notice. If there is a discrepancy, attach a statement explaining the difference — for example, if the brokerage calculated basis incorrectly, or if you sold inherited stock with a step-up in basis.

Special situations: real estate, collectibles, and cryptocurrency

Real estate sales follow the same gain calculation but with a twist: you can deduct capital improvements (major repairs or additions) from the sale price before calculating the gain. You cannot deduct routine maintenance. If you sold a rental property for $400,000, paid $250,000 for it, and spent $30,000 on a new roof and addition, your gain is $120,000 (not $150,000). Keep receipts for all improvements.

Collectibles — art, coins, precious metals — are taxed at a maximum rate of 28% on long-term gains, even if your income would normally put you in a lower bracket. This is a special rule that applies only to collectibles, so if you sold a painting and stock in the same year, the painting gets the 28% rate and the stock gets the normal 0%, 15%, or 20% rate.

Cryptocurrency is treated as property by the IRS, not currency. Every time you sell, trade, or use it to buy something, you have a taxable event. If you bought Bitcoin for $10,000 and sold it for $25,000, you have a $15,000 gain. If you traded Bitcoin for Ethereum, that is also a taxable sale. Keep detailed records of every transaction, including the date and fair market value at the time of the trade.

Frequently Asked Questions

Do I have to report a capital loss if I did not have any gains?

No, but you should. You can use up to $3,000 of net capital losses against ordinary income even if you had no gains. If you had a $5,000 loss and no gains, you can deduct $3,000 against wages or other income, and carry the remaining $2,000 forward to next year. If you do not report the loss, you lose the deduction.

What if I sold an asset I inherited?

Your cost basis is the fair market value on the date the person died, not what they paid for it. This step-up in basis often means you owe little or no capital gains tax on inherited assets, even if they had appreciated significantly. Keep the death certificate and a valuation from that date to prove your basis to the IRS.

How do I know if a gain is long-term or short-term?

Count the days from the date you bought it to the date you sold it. If it is more than one year, it is long-term. If it is one year or less, it is short-term. The IRS counts the acquisition date as day zero, so if you bought on January 1, 2023 and sold on January 2, 2024, that is long-term.

Can I deduct investment fees or trading commissions from my capital gain?

Yes, but only if they were paid to acquire the asset. If you paid a $50 commission to buy stock, add it to your cost basis. If you paid a $50 commission to sell it, subtract it from your sale price. Either way, the fee reduces your gain.

What if I sold stock through a dividend reinvestment plan?

Each time dividends were reinvested to buy new shares, that is a separate purchase with its own cost basis and holding period. When you sell, you need to identify which shares you sold — you can use specific identification, FIFO (first in, first out), or average cost. Your brokerage can help you track this, and the method you choose affects your tax bill.