Capital gains tax is the tax you owe on the profit when you sell a stock for more than you paid for it
When you buy a stock at $50 and sell it at $75, that $25 difference is your capital gain. The IRS taxes that profit. How much you owe depends on how long you held the stock and your total income for the year. The tax rate is not the same for everyone — it changes based on your tax bracket and whether you held the stock for a short or long time.
You do not owe tax on the stock itself, only on the profit. If you sell at a loss, you do not owe capital gains tax at all. In fact, you can use losses to reduce gains from other sales or, in some cases, to reduce your regular income.
Key Takeaways
- Capital gains tax applies only to the profit you make when you sell a stock, not to the full sale price.
- Long-term capital gains (stocks held over one year) are taxed at lower rates than short-term gains, which are taxed as regular income.
- Your capital gains tax rate depends on your total income for the year and your filing status, not just the size of the gain.
- You report capital gains on Schedule D of your tax return, and the IRS uses your cost basis (what you paid) to calculate the gain.
Short-term vs. long-term capital gains rates
The IRS divides capital gains into two categories based on how long you owned the stock. Short-term capital gains come from stocks you held for one year or less. These are taxed at your ordinary income tax rate — the same rate you pay on wages or salary. If you are in the 24% tax bracket, short-term gains are taxed at 24%.
Long-term capital gains come from stocks you held for more than one year. These are taxed at lower rates: 0%, 15%, or 20%, depending on your income and filing status. Most people in the middle income range pay 15% on long-term gains. The 0% rate applies to lower-income filers, and the 20% rate applies to higher-income filers.
This is why holding a stock longer than one year can save you money in taxes. A $10,000 gain taxed as short-term at 24% costs $2,400. The same gain taxed as long-term at 15% costs $1,500 — a $900 difference.
How the IRS calculates your capital gain
The calculation is straightforward: sale price minus purchase price equals capital gain. But the IRS needs to know your exact purchase price, called your cost basis. This is what you originally paid for the stock, including any fees or commissions.
If you bought 100 shares at $50 each and paid a $10 commission, your cost basis is $5,010 (or $50.10 per share). When you sell all 100 shares at $75 each, your sale proceeds are $7,500. Your capital gain is $7,500 minus $5,010, which equals $2,490.
Your brokerage firm (the company where you hold your stocks) tracks this information and reports it to the IRS on Form 1099-B. You will receive a copy for your records. Keep your purchase confirmations and statements in case the IRS questions your numbers.
What happens when you sell stocks at a loss
If you sell a stock for less than you paid, you have a capital loss. You do not owe capital gains tax on a loss. Instead, you can use the loss to offset capital gains from other stock sales in the same year.
If your losses exceed your gains, you can deduct up to $3,000 of the net loss against your regular income in a single year. Any loss beyond $3,000 carries forward to future years, so you can use it later. This is why some investors sell losing positions before year-end — to reduce their tax bill on gains elsewhere.
Reporting capital gains on your tax return
You report all stock sales on Schedule D, which is part of Form 1040. You list each sale separately, showing the date you bought, the date you sold, the sale price, and your cost basis. The form automatically calculates your short-term and long-term totals.
Your brokerage sends you Form 1099-B in January or February showing all your sales from the previous year. Use this form to fill out Schedule D. If you sold only a few stocks, the process is straightforward. If you traded frequently, you may need a spreadsheet or tax software to organize the data.
If you use tax software like TurboTax or H&R Block, you can import your 1099-B directly, and the software fills in most of the numbers for you. If you work with a tax preparer, bring your 1099-B and any purchase confirmations you have.
How your income level affects your capital gains rate
Long-term capital gains rates are tied to your overall income, not just the size of your gain. The IRS sets income thresholds for each tax bracket and filing status. For 2024, the 15% long-term rate applies to single filers with income between roughly $47,000 and $518,000. Below that range, you may may have access to for the 0% rate. Above it, you pay 20%.
This means a $50,000 capital gain could be taxed at 0%, 15%, or 20% depending on your other income that year. If you are near a threshold, timing matters. Some people delay selling stocks until the following year to stay in a lower bracket, or they accelerate sales to use up room in a lower bracket before their income rises.
Your tax preparer or financial advisor can model different scenarios to show you the tax impact of selling now versus later. This is especially useful if you are close to a bracket boundary or if you have a large gain.
Special situations: inherited stocks and wash sales
If you inherit stock, the IRS gives you a break. Your cost basis is reset to the stock's value on the date of death, not what the original owner paid. This is called a step-up in basis. If the original owner bought at $20 and the stock was worth $100 when they died, your basis is $100. If you sell when ready at $100, you owe no capital gains tax.
A wash sale is a different rule that can cost you. If you sell a stock at a loss and buy the same stock (or a substantially identical one) within 30 days before or after the sale, the IRS disallows the loss. The loss is added to your cost basis of the new purchase instead. This rule prevents people from harvesting losses for tax purposes while keeping the same investment.
Frequently Asked Questions
Do I owe capital gains tax if I do not sell the stock?
No. Capital gains tax applies only when you sell. As long as you hold the stock, there is no tax, even if the price rises. This is why some investors hold stocks for decades without paying tax until they need the money.
What if I sold stocks at a gain and a loss in the same year?
You net them together. If you had $10,000 in gains and $3,000 in losses, you report a net gain of $7,000. If losses exceed gains, you can deduct up to $3,000 against your regular income, and carry the rest forward.
How do I know if my gain is short-term or long-term?
Count the days from purchase to sale. If it is 365 days or fewer, it is short-term. If it is 366 days or more, it is long-term. Your brokerage statement usually marks this for you on the 1099-B.
Can I reduce my capital gains tax by donating stock to charity?
Yes. If you donate appreciated stock directly to a charity, you avoid capital gains tax on the gain and can deduct the full fair market value as a charitable contribution. This works only if the charity is may have access to and you itemize deductions on your return.
What if I bought the same stock at different prices over time?
You choose which shares to sell using a method called cost basis accounting. The most common method is "first in, first out" (FIFO), which assumes you sell the oldest shares first. You can also use "specific identification" to pick which exact shares to sell, which gives you more control over your tax outcome. Tell your brokerage which method you want before you sell.