How Are Stocks Taxed?
Last updated July 2026
Short answer
Stocks are taxed on two things: the gains you realize when you sell, and the dividends you receive while you hold. You owe nothing on a stock that has simply risen in value; that unrealized gain is untaxed until you sell. When you do sell at a profit, a stock held one year or less is a short-term gain taxed at your ordinary income rate, while a stock held longer than one year is a long-term gain taxed at the lower 0, 15, or 20 percent rates. Dividends are taxed each year, at those same lower rates if they are qualified or at ordinary rates if they are not. Capital losses offset gains and up to 3,000 dollars of ordinary income a year. A 401k, IRA, or Roth IRA shelters all of this. Walnut, an AI investing app, can show you which of your holdings are income-heavy, but it is not an investment adviser or a tax adviser. This is general information, not tax advice.
Taxes on stocks confuse a lot of new investors because the rules sound complicated, but the structure is simple once you separate the two moments when tax can happen. This guide walks through both taxable events, why a paper gain is not taxed, how the one-year holding line changes your rate, the difference between qualified and ordinary dividends, how losses help, and how tax-advantaged accounts change the whole picture. It is descriptive and educational, not a set of buy or sell calls, and it is not tax advice. Rates and thresholds change from year to year, so verify current figures with the IRS or a licensed professional.
The two taxable events: selling and dividends
There are only two ways a stock creates a tax bill. The first is a capital gain, which happens when you sell a stock for more than you paid. The second is a dividend, a cash payout that a company sends to shareholders while they still hold the stock. Selling is an event you control and choose to trigger; a dividend is paid on the company's schedule whether or not you do anything.
That split matters because it tells you where the tax comes from. Growth stocks that pay no dividend generate no yearly tax at all until you sell them, so their entire tax bill is deferred and lands in one year of your choosing. Dividend-paying stocks hand you a smaller taxable event every quarter, whether you want the cash or reinvest it. Knowing which of your holdings do which is the whole game, and it is a question about your real positions, not a generic list.
You owe nothing on unrealized gains
The single most reassuring fact for a long-term investor is that the US does not tax gains you have not sold. If you buy a stock at 100 dollars and it rises to 400, you owe zero capital gains tax the entire time you hold it. That paper profit is called an unrealized gain, and it becomes taxable only when you realize it by selling. This is why buy-and-hold investing is naturally tax-efficient: every year you do not sell is a year you defer the tax, and the money that would have gone to taxes keeps compounding for you.
The flip side is that once you sell, the gain is locked in for that tax year and cannot be undone. That is why the timing of a sale, and specifically whether you have held long enough for the lower long-term rate, is worth understanding before you place the trade. None of this is a reason to hold or sell any particular stock; it is context, and your own situation may differ.
Short-term vs long-term: the one-year line
When you sell at a profit, the rate you pay depends entirely on how long you owned the stock. Hold it for one year or less and the gain is short-term, taxed at your ordinary income rate, the same brackets that apply to your wages. Hold it for more than one year and it becomes a long-term gain, taxed at the lower long-term capital gains rates of 0, 15, or 20 percent for most filers, based on your taxable income.
That gap is often large. Someone in a high ordinary bracket can pay a meaningfully higher rate on a short-term gain than on the same gain held a few extra weeks to cross the one-year mark. This is why many long-term investors are deliberate about the holding period before selling a winner. The exact income thresholds that set your long-term rate adjust every year, so treat 0, 15, and 20 as the structure and verify current figures before relying on any number. This is not tax advice.
Qualified vs ordinary dividends
Dividends are taxed in the year you receive them, but not all dividends are taxed the same way. A qualified dividend, which is what most US common stocks pay when you have held the shares long enough, is taxed at the lower long-term capital gains rates. An ordinary or non-qualified dividend, which includes many REIT distributions and payouts that fail the holding-period test, is taxed at your higher ordinary income rate.
The practical takeaway is that a portfolio heavy in qualified-dividend payers is more tax-efficient in a taxable account than one heavy in REITs or high-yield income funds, all else equal. Reinvesting a dividend does not avoid the tax; the payout is still income the year it is paid, though it does raise your cost basis for later. For the full breakdown of the holding-period test and the rates, see how dividends are taxed. This is general information, not tax advice.
How losses offset gains
Losses are not just a setback; they have real tax value. When you sell a stock for less than you paid, the capital loss offsets your capital gains dollar for dollar. If your losses for the year exceed your gains, you can use up to 3,000 dollars of the excess to reduce your ordinary income, and carry any remaining loss forward to future tax years indefinitely.
This is the mechanism behind tax-loss harvesting, where an investor deliberately sells a position that has dropped to bank the loss, often reinvesting the proceeds in a similar holding to stay in the market. The main constraint is the IRS wash-sale rule, which disallows the loss if you rebuy the same or a substantially identical security within 30 days. Losses only work this way in taxable accounts, since nothing inside a 401k or IRA is deductible. Consult a tax professional before acting on a harvesting plan.
How tax-advantaged accounts shelter all of this
Everything above describes a taxable brokerage account. The picture changes completely inside a tax-advantaged account. In a traditional 401k or IRA, dividends and capital gains are not taxed as they happen; the account grows untouched and you pay ordinary income tax only when you withdraw in retirement. In a Roth IRA, you contribute after-tax dollars and then qualified withdrawals, including every dollar of growth and dividends, come out entirely tax-free.
This is why the account a stock sits in can matter as much as the stock itself. An income-heavy holding that throws off a yearly tax bill in a taxable account produces no yearly tax inside an IRA or Roth. Deciding which holdings belong in which account is the practice of tax-efficient investing. The right split depends on your income, brackets, and goals, so treat this as a framework and confirm the specifics with a tax professional.
How stocks are taxed, at a glance
| Event | When it happens | How it is taxed |
|---|---|---|
| Capital gain | You sell a stock for more than you paid | Only in the year you sell (realized). Short-term at ordinary rates if held one year or less, long-term at 0/15/20 percent if held longer |
| Capital loss | You sell a stock for less than you paid | Offsets capital gains dollar for dollar, then up to 3,000 dollars of ordinary income a year, with the rest carried forward |
| Qualified dividend | A payout from a stock you have held long enough | Taxed each year at the lower long-term rates (0, 15, or 20 percent) |
| Ordinary (non-qualified) dividend | A payout that fails the holding-period test, or from REITs and some funds | Taxed each year at your ordinary income rate |
| Unrealized gain | A stock you own has risen but you have not sold | Not taxed at all until you sell |
The pattern is consistent: nothing is taxed until you either sell or receive a payout, and the rate you pay depends on how long you held and what kind of income it is. Long holding periods and qualified dividends land in the lower brackets; quick sales and non-qualified payouts land in the higher ones. Every figure here can change from year to year and depends on your individual circumstances, so verify current details with the IRS or a licensed professional before making any decision.
Where Walnut fits
Understanding how stocks are taxed is one thing; seeing how it applies to your actual portfolio is another, because it depends on which holdings pay dividends, how long you have held each one, and which account each sits in. That is a question about your real positions, which is where an AI assistant that can read across your accounts helps. Walnut lets you connect any major US broker, then chat in plain words through Claude, ChatGPT, or its built-in AI to ask which of your holdings are the income-heavy ones and how your positions have moved. You can build baskets around a plan, track every position against the S&P 500, and place trades that Walnut only sends to your broker after you approve them. It reads your accounts by default and does not move money on its own. Walnut is not an investment adviser or a tax adviser, and it does not tell you what to buy.
Try Walnut on top of your broker
Walnut connects your accounts, then helps you see which holdings are income-heavy and how your positions have moved, by chatting through Claude, ChatGPT, or its built-in AI. Walnut is not an investment adviser or a tax adviser and does not tell you what to buy.
FAQ
How are stocks taxed?
Stocks are taxed in two situations. First, when you sell for a profit you owe capital gains tax on the gain, at short-term rates if you held one year or less and at lower long-term rates if you held longer. Second, dividends you receive while holding are taxed each year, at lower qualified rates or at your ordinary rate depending on the holding-period test. You owe nothing on a stock that has simply gone up until you sell it. This is general information, not tax advice.
Do I pay tax if I don't sell?
No. A gain you have not sold is called an unrealized gain, and the US does not tax it. A stock can double in value and you owe no capital gains tax as long as you keep holding it. The tax event happens only when you realize the gain by selling. The one thing that can still be taxed while you hold is a dividend the stock pays out. This is descriptive, not tax advice.
What is the difference between short-term and long-term capital gains?
It is the holding period. If you sell a stock you held for one year or less, the gain is short-term and taxed at your ordinary income rate, the same schedule as your paycheck. If you held it longer than one year, the gain is long-term and taxed at the lower long-term rates of 0, 15, or 20 percent for most filers depending on income. Crossing the one-year mark can meaningfully change the after-tax result. Verify current figures and consult a tax professional.
How are dividends taxed?
Dividends are taxed in the year you receive them, even if you reinvest them. Qualified dividends, which come from most US stocks you have held long enough, are taxed at the lower long-term capital gains rates. Ordinary or non-qualified dividends, including many REIT payouts, are taxed at your ordinary income rate. Inside a Roth, IRA, or 401k, dividends are not taxed yearly at all. See the dividends guide for detail. This is not tax advice.
How do capital losses affect my taxes?
A capital loss from selling a stock below what you paid offsets your capital gains dollar for dollar. If your losses exceed your gains, you can deduct up to 3,000 dollars against ordinary income in a year, and carry any remaining loss forward to future years. This is why some investors sell losers deliberately, a practice called tax-loss harvesting, though the wash-sale rule limits rebuying the same stock too quickly. Consult a tax professional.
Are stocks in a 401k or IRA taxed?
Not year to year. Inside a traditional 401k or IRA, dividends and capital gains are not taxed as they happen; you pay ordinary income tax only when you withdraw in retirement. Inside a Roth IRA you contribute after-tax dollars and qualified withdrawals, including all the growth, come out tax-free. These accounts shelter the same stocks that would generate a yearly bill in a taxable brokerage account. This is general information, not tax advice.
Do I owe tax when I reinvest dividends?
Yes, in a taxable account. A reinvested dividend is still income you received, so it is taxed in the year it is paid even though you never saw the cash. The reinvestment does raise your cost basis in the new shares, which lowers your taxable gain when you eventually sell them. Inside a Roth, IRA, or 401k, reinvested dividends are not taxed. Verify the specifics with a tax professional.
Does Walnut calculate my stock taxes?
No. Walnut is not a registered investment adviser or a tax adviser, and it does not prepare returns or tell you what to buy or sell. It can read your connected accounts so you can see, in plain words, which holdings pay a lot of dividends and how your positions have moved, which is useful context. Any actual tax figure or filing decision should come from your brokerage tax forms and a qualified tax professional.
From here, see how the gain itself is calculated in capital gains tax, the current rate brackets in capital gains tax rates, the dividend detail in how dividends are taxed, and the full picture in tax-efficient investing.
Walnut is informational and is not a registered investment adviser or a tax adviser. This page explains how stocks are taxed in general; it is not a recommendation to buy, sell, or hold any security, and it is not tax advice. Investing involves risk, including the possible loss of principal, and past performance does not indicate future results. Tax rules, rates, brackets, and holding-period tests change and depend on your individual circumstances; verify current details with the IRS or a licensed professional before making any decision. Do your own research or consult a licensed financial or tax professional.