You owe capital gains tax when you sell a stock for more than you paid for it, and the tax is due the year you sell — not when you buy or hold

Capital gains tax applies to the profit you make, not the full sale price. If you bought 100 shares at $10 each ($1,000 total) and sold them at $15 each ($1,500 total), your capital gain is $500. That $500 is what gets taxed, and you report it on your federal tax return for the year you sold the shares.

The timing matters: you owe tax in the year the sale happens, even if you don't receive the money until the next calendar year. Your brokerage will send you a Form 1099-B in January or February showing all your sales from the previous year. That form is what the IRS uses to cross-check your tax return.

You do not owe capital gains tax while you hold the stock, no matter how much it gains in value. Tax is triggered only when you sell, trade it for something else, or in rare cases when it becomes worthless. Holding longer than one year changes how much tax you owe, but does not change when you owe it.

Key Takeaways

  • Capital gains tax is owed in the year you sell the stock, based on the difference between what you paid and what you received.
  • Long-term capital gains (stocks held over one year) are taxed at lower rates than short-term gains, which are taxed as ordinary income.
  • Your brokerage reports all sales on Form 1099-B, which the IRS receives and matches against your tax return.
  • You calculate your gain by subtracting your original cost (including commissions and fees) from your sale price, then report that number on Schedule D of your federal return.

Short-Term vs. Long-Term Capital Gains — The Holding Period Matters

How long you owned the stock determines your tax rate. Short-term capital gains come from stocks you held for one year or less. These are taxed as ordinary income, meaning they use the same tax brackets as your wages or salary. If you are in the 24% tax bracket, a short-term gain is 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 total income for the year. Most people in the middle income range pay 15%. The long-term rate is almost always lower than the short-term rate, which is why holding longer can save you money.

The holding period is measured from the day after you buy to the day you sell. If you bought on January 15 and sold on January 15 of the next year, that is exactly one year, and the gain qualifies as long-term. If you sold on January 14, it is short-term.

How to Calculate Your Capital Gain or Loss

Start with your sale price — the total amount you received when you sold the shares. Subtract your cost basis, which is what you originally paid for the shares plus any commissions or fees your brokerage charged you to buy them. The result is your capital gain or loss.

Example: You bought 50 shares at $20 per share and paid a $10 commission. Your cost basis is ($20 × 50) + $10 = $1,010. You sold all 50 shares at $25 per share and received $1,250 minus a $10 commission, for a net of $1,240. Your capital gain is $1,240 − $1,010 = $230.

If you sold for less than you paid, you have a capital loss. Losses can offset gains in the same year, and if losses exceed gains, you can deduct up to $3,000 of the net loss against other income. Any loss beyond $3,000 carries forward to future years.

Your brokerage tracks cost basis automatically and reports it on Form 1099-B. You should verify this number matches your records, especially if you bought shares at different times or reinvested dividends.

What Happens If You Inherit Stocks

Inherited stocks receive a step-up in basis, which means your cost basis becomes the stock's value on the date the person died, not what they originally paid. If your parent bought a stock for $5 per share and it was worth $50 per share when they died, your cost basis is $50. If you sell it the next week for $52, you owe tax on only $2 of gain, not $47.

This step-up applies whether you inherit the stock immediately or it sits in the estate for months. The date of death value is what matters. This is one of the few situations where you can own a stock that has gained significantly and owe little or no tax when you sell it soon after.

Reporting Capital Gains on Your Tax Return

You report capital gains on Schedule D of your federal tax return (Form 1040). List each sale separately: the date acquired, date sold, cost basis, sale price, and gain or loss. Your brokerage provides most of this information on Form 1099-B, though you may need to fill in the acquisition date if the form does not include it.

Schedule D separates short-term and long-term gains. The form calculates your net short-term gain or loss and your net long-term gain or loss, then combines them. If you have a net long-term gain, it goes to a different line on your return and is taxed at the lower long-term rate.

If you sold only one or two stocks and had a small gain, some tax software will let you report it directly on Form 1040 without filing Schedule D, but this is only an option in limited situations. Most people with any stock sales need to file Schedule D.

State and Local Taxes on Capital Gains

Federal capital gains tax is only part of the picture. Most states tax capital gains as ordinary income, meaning you owe state tax at your state's income tax rate. A few states — including Alaska, Florida, Nevada, South Dakota, Tennessee, Texas, Washington, and Wyoming — have no state income tax at all.

Some states have special capital gains taxes separate from income tax. California, for example, taxes capital gains as ordinary income. Washington state has a 7% capital gains tax on long-term gains over $250,000. New York City and a few other cities also tax capital gains.

Your total tax bill depends on where you live. A $10,000 long-term gain might cost you $1,500 in federal tax (15%) but also $500 to $1,000 in state and local tax, depending on your location and state tax rate.

Frequently Asked Questions

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

No, you owe no tax on a loss. Instead, you can use the loss to reduce any capital gains you had that year. If losses exceed gains, you can deduct up to $3,000 against other income like wages. Any remaining loss carries to the next year.

What if I bought and sold the same stock multiple times in one year?

Each sale is a separate transaction with its own gain or loss. You report all of them on Schedule D. If you bought 100 shares at $10, sold 50 at $15, then bought 50 more at $12 and sold all 100 at $18, you have two separate gains to report. Your brokerage will list each transaction on Form 1099-B.

Can I avoid capital gains tax by donating stock to charity?

Yes. If you donate appreciated stock directly to a may have access to charity, you avoid capital gains tax on the gain and can deduct the full fair market value as a charitable contribution. You must donate the actual shares, not sell them first and donate the cash. This works only for donations to may have access to charities, not to individuals.

Do I owe capital gains tax on stocks in a 401(k) or IRA?

No. Stocks inside retirement accounts are not subject to capital gains tax when you sell them within the account. You owe tax only when you withdraw money from the account (and only on the amount withdrawn). This is one major advantage of holding stocks in retirement accounts rather than regular brokerage accounts.

What if my brokerage reports the wrong cost basis on Form 1099-B?

Contact your brokerage and ask them to issue a corrected Form 1099-B. Keep your own records of what you paid, including commissions. If the IRS questions your return, you will need to show your original purchase confirmations. Do not ignore a discrepancy — the IRS will see the Form 1099-B and may assess tax based on that number if your return does not match.