The two ways the IRS taxes your stocks
The IRS taxes stocks in two separate ways, depending on what you do with them. The first is capital gains tax, which you pay when you sell a stock for more than you paid for it. The second is dividend tax, which you pay on the cash payments some companies send to shareholders each year. You may owe one, both, or neither, depending on your holdings and income.
Capital gains tax applies only when you actually sell. If you buy 100 shares of a company at $50 per share and the price rises to $75, you have an unrealised gain of $2,500 — but you owe no tax until you sell those shares. Dividend tax, by contrast, is due each year on any dividends you receive, whether you sell the stock or not.
Key Takeaways
- Capital gains tax applies only when you sell a stock for more than you paid, and the rate depends on how long you held it.
- Long-term capital gains (held over one year) are taxed at 0%, 15%, or 20% depending on your income; short-term gains are taxed as ordinary income.
- Dividend tax rates depend on whether the dividend is may have access to or non-may have access to, and your overall income level.
- You report stock sales on Schedule D and dividends on Schedule B of your tax return, or your brokerage will send you a Form 1099-B or 1099-DIV.
- Losses on stocks can offset gains and reduce your taxable income by up to $3,000 per year, with excess losses carried forward to future years.
Long-term versus short-term capital gains
The IRS taxes capital gains at different rates depending on how long you held the stock. If you sell a stock you owned for more than one year, it is a long-term capital gain. If you sell a stock you owned for one year or less, it is a short-term capital gain.
Short-term capital gains are taxed as ordinary income — the same rate as your wages or salary. That rate ranges from 10% to 37% depending on your tax bracket. Long-term capital gains are taxed at lower rates: 0%, 15%, or 20%, depending on your income level. For 2024, the 0% rate applies to single filers earning under $47,025 and married filers earning under $94,050. The 15% rate applies to most middle-income earners, and the 20% rate applies to high earners.
This difference is why many investors hold stocks for longer than a year — the tax savings can be substantial. A short-term gain of $10,000 in the 24% tax bracket costs $2,400 in federal tax. The same $10,000 as a long-term gain costs $1,500 at the 15% rate.
How dividend taxes work
Dividends come in two types: may have access to and non-may have access to. may have access to dividends are taxed at the same rates as long-term capital gains (0%, 15%, or 20%). Non-may have access to dividends are taxed as ordinary income, like short-term capital gains.
Most dividends from U.S. companies are may have access to if you held the stock for at least 60 days around the dividend payment date. Dividends from real estate investment trusts (REITs), master limited partnerships (MLPs), and some preferred stocks are usually non-may have access to. Your brokerage will tell you which dividends are may have access to on your year-end tax statement.
If you own a stock that pays a $100 annual dividend and you are in the 24% tax bracket, a may have access to dividend costs you $15 in federal tax, while a non-may have access to dividend costs you $24. Over many years, this difference adds up.
Reporting stock sales and dividends to the IRS
Your brokerage sends you a Form 1099-B for each stock sale and a Form 1099-DIV for dividends. These forms list the date you bought and sold, the price, and the gain or loss. You report this information on Schedule D (for capital gains and losses) and Schedule B (for dividends) of your tax return.
The IRS receives a copy of your 1099 forms, so your brokerage's records must match yours. If you sell a stock at a loss, report it on Schedule D anyway — losses reduce your taxable gains and can lower your overall tax bill. If your losses exceed your gains in a year, you can deduct up to $3,000 of the excess loss against other income. Any remaining loss carries forward to future years.
If you trade frequently or hold stocks in multiple accounts, keep your own records of purchase dates and prices. Some brokerages calculate cost basis automatically, but errors happen. A spreadsheet or the brokerage's cost-basis report protects you if the IRS questions your return.
State and local taxes on stocks
Most states do not tax capital gains or dividends separately — they are taxed as income under your state's ordinary income tax rate. A few states have special rules. California, for example, taxes long-term capital gains at the same rate as short-term gains. New York taxes both at ordinary income rates. Some states, including Florida, Texas, and Washington, have no income tax at all.
If you live in a state with income tax and sell a stock at a gain, you will owe both federal and state tax on that gain. Your state tax bill depends on your state's income tax brackets and your total income for the year. Check your state's tax authority website or speak with a tax professional if you live in a high-tax state and have large gains.
Tax-loss harvesting and offsetting gains
If you have both winning and losing stocks, you can sell the losers to offset the gains from the winners. This is called tax-loss harvesting. If you sell a stock at a $5,000 loss and another at a $5,000 gain in the same year, the loss cancels the gain and you owe no capital gains tax on either.
The IRS has one rule to watch: the wash-sale rule. 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 loss is disallowed. You can buy a similar stock — for example, a different technology company — without triggering the rule, but buying the exact same stock defeats the tax benefit.
Tax-loss harvesting works best late in the year when you know your total gains. If you have $20,000 in gains and $8,000 in losses, selling the losers brings your taxable gain down to $12,000. The remaining $3,000 of losses can reduce other income, and the last $5,000 carries forward to next year.
Stocks in retirement accounts
Stocks held inside a traditional IRA, Roth IRA, or 401(k) are not taxed on gains or dividends while they sit in the account. You do not file Schedule D for these trades. In a traditional IRA or 401(k), you pay tax when you withdraw the money in retirement. In a Roth IRA, you pay no tax on withdrawals if you follow the rules.
This is one reason retirement accounts are powerful for stock investors — you can buy and sell freely without triggering capital gains tax each year. The tax bill is deferred (traditional accounts) or eliminated (Roth accounts). If you have the choice between holding stocks in a taxable brokerage account or a retirement account, the retirement account is almost always better from a tax standpoint.
Frequently Asked Questions
Do I owe taxes if I do not sell my stocks?
No federal capital gains tax applies until you sell. However, if your stocks pay dividends, you owe tax on those dividends each year, even if you do not sell. Unrealised gains — stocks that have gone up in value but you still own — are not taxed.
What if I sell a stock at a loss?
Report the loss on Schedule D. Losses reduce your taxable gains dollar-for-dollar. If losses exceed gains, you can deduct up to $3,000 against other income in that year. Any excess loss carries forward to future years with no time limit.
How do I know if a dividend is may have access to or non-may have access to?
Your brokerage reports this on Form 1099-DIV, which breaks dividends into may have access to and non-may have access to columns. Most dividends from U.S. stocks are may have access to if you held the stock for at least 60 days around the payment date. REITs and some preferred stocks usually pay non-may have access to dividends.
Can I avoid capital gains tax by holding stocks forever?
Yes, as long as you do not sell. However, when you die, your heirs receive a "step-up in basis" — they inherit the stock at its value on the date of your death, not your original purchase price. This eliminates the tax on gains that occurred during your lifetime.
Should I hire a tax professional for stock taxes?
If you have a few straightforward trades, you can handle it yourself. If you trade frequently, harvest losses, or have stocks in multiple accounts, a tax professional can save you money by catching deductions and strategies you might miss. The cost is often worth it if your gains are large.