Module 10 · 10 min read
How stocks are taxed
Separate sale proceeds from investment gains, learn how holding periods, dividends and losses are taxed in the U.S. and find the official IRS rules.
Written by the StockEducation Editorial Team · Reviewed by Associate Professor Charles Lo, CPA, PhD · Updated · How we check lessons
How are stocks taxed?
In the U.S., stocks in a taxable account are generally taxed when you sell at a gain or receive dividends, not while the price simply rises. The gain is your sale proceeds minus your adjusted basis. Shares held more than one year generally produce long term gains taxed at 0%, 15% or 20%, while short term gains are taxed as ordinary income.
Key takeaways
- Sale proceeds minus adjusted basis give the gain or loss; the gain is not itself the tax bill.
- Shares held more than one year generally qualify for long term rates of 0%, 15% or 20%; gains on shares held a year or less are taxed as ordinary income.
- For a single filer with $80,000 of other taxable income in 2026, a $3,000 gain costs $660 in federal tax if short term and $450 if long term.
- Dividends can be taxable without a sale, and reinvesting them does not make them tax free.
- Net capital losses can offset up to $3,000 of other income a year, but wash sale rules can delay a loss.
- Keep your own records and use the rules for your country, account and tax year.

Start the lessonTake the quick checkRead the FAQSee the sources
Part 1 of 5 · Gain versus proceeds
What part of a stock sale is taxed?
You are taxed on your gain, not on the sale price. For a U.S. stock sale, start with the amount you received and subtract your adjusted basis, which is roughly what the shares cost you. A positive result is a capital gain; a negative result is a capital loss.1
Say your net sale proceeds are $1,300 and the shares’ adjusted basis is $1,000. The difference is a $300 gain before any tax is worked out. The full $1,300 is not profit, and the $300 is not the tax bill either.
Hypothetical: from sale proceeds to taxable gain
Move the net sale proceeds in the calculator while the adjusted basis stays at $1,000, and the result switches between a gain, a loss and zero. It shows the first step only, not a tax bill.
A price rise while you still own the shares is generally unrealized, which means it is not taxed yet. A sale or another relevant event changes that. Dividends are different again: they can create taxable income without any sale, so “I did not sell” is not a complete tax check.
Why your basis may differ from the purchase price
U.S. stock basis can include purchase commissions and other acquisition costs. Gifts, inheritances and later adjustments follow their own rules.2 In the example above, the $1,000 basis already includes costs and the $1,300 is already net, so a cost is never subtracted twice.
Proceeds, gain and tax owed are three different amounts.
Part 2 of 5 · Holding period
How does your holding period change the tax?
Hold shares more than one year and a gain is generally long term; hold them one year or less and it is short term. Exceptions apply.1 Net short term gains are taxed at your ordinary income rates. Net long term gains are taxed at 0%, 15% or 20%, depending on your taxable income.1
For 2026, a single filer’s long term gains within the first $49,450 of taxable income are taxed at 0%, and the 15% rate applies up to $545,500.3

Worked example
A single filer sells shares for $13,000 that cost $10,000, a $3,000 gain. Using the 2026 brackets, here is the federal tax on that gain for two people with different incomes.3
Federal tax on a $3,000 gain, single filer, 2026 (hypothetical)
Held a year or less Held over a year
At $80,000 of other taxable income, waiting past the one year mark cuts the tax on the gain from $660 to $450. At $40,000, it cuts it from $360 to zero, because the whole gain fits under the $49,450 limit for the 0% rate.
That is a real saving, though a longer holding period does not by itself make an investment better. State taxes and the 3.8% net investment income tax for higher earners are not included here.
One day past a year moves a gain from ordinary income rates to the 0%, 15% or 20% long term rates.
Part 3 of 5 · Dividends and losses
How are dividends and losses taxed?
In a taxable U.S. account, dividends can be taxable even when you sell nothing. Some dividends, called qualified dividends, get the lower capital gain rates if conditions are met; the rest are taxed as ordinary income. The dividend version of Form 1099 your broker sends each year shows which is which.4
Reinvesting a dividend does not make it tax free. It is still income for the year, and the shares it buys get a basis equal to the reinvested amount.5,6 Keep those records, because that basis reduces your taxable gain when you eventually sell.
Capital losses
U.S. capital losses are first netted against your gains. If losses are bigger, up to $3,000 of the excess ($1,500 if married filing separately) can be deducted from other income each year, and the rest carries forward to later years.1 A loss is a deduction, not a dollar for dollar refund.
Worked example
Suppose $5,000 of losses and $1,000 of gains in the same year. The losses first wipe out the $1,000 of gains. Of the $4,000 left, $3,000 reduces other income this year and $1,000 carries forward.
Hypothetical: where $5,000 of capital losses goes
The wash sale rule
If you sell at a loss and buy substantially identical securities within 30 days before or after the sale, U.S. wash sale rules can disallow the loss. A replacement purchase in an IRA or Roth IRA does not increase the IRA’s basis. That includes purchases in your IRA or Roth IRA, so a loss only counts once every related account has been checked.6,7
The wash sale window: 61 days around a loss sale
- Day −30Window opensA purchase from here on counts
- Day 0Loss saleShares sold below their basis
- Day +30Window closesPurchases after this do not trigger the rule
Dividends are income in the year they arrive, and a loss is a deduction, not a refund.
Part 4 of 5 · Accounts and countries
Do your account and country change the answer?
Trades inside an IRA or 401(k) are generally not taxed when they happen. In traditional accounts, tax usually comes when you withdraw; qualified Roth withdrawals can be tax free.8 Eligibility, contribution limits, early withdrawal rules and reporting all need their own checks.
Outside the U.S., or with foreign investments, a U.S. rule does not carry over. Tax residence, the account, the investment and the tax year decide the treatment, and cross border holdings can add withholding tax and more than one reporting duty.
- United Kingdom. HMRC explains that gains on shares outside an ISA may be subject to Capital Gains Tax, with tax year allowances. See HMRC’s share disposal guide.
- Canada. The CRA separates capital gains, Canadian dividends and other investment income. See the CRA investment income guide.
- Japan. Check residence, account and income category in the National Tax Agency’s individual income tax resources before choosing a filing or withholding treatment.

Trades inside an IRA or 401(k) are not taxed when they happen; the account’s withdrawal rules decide the tax.
Part 5 of 5 · Records
What records should you keep?
Good records turn tax time from guessing into arithmetic. The Form 1099 your broker sends for sales is a starting point, not a substitute for checking that it is right.6
- Keep every trade. Save the purchase and sale dates, share counts, prices and costs for each lot.
- Support your basis. Keep records of commissions, reinvested dividends and any gift or inheritance details.
- Track income as it arrives. Keep each dividend Form 1099 and your account statements for distributions.
- Compute the gain yourself. Net proceeds minus adjusted basis. A result below zero is a loss, but it is not yet an allowable deduction until netting and wash sale rules are checked.
- List what the math cannot answer. Which year and country apply, which income type and account rules matter, and any missing records or special transactions are questions for a qualified tax professional.

A broker’s Form 1099 is a starting point; the lot records are what prove the basis.
Quick check
Quick quiz: test what you just read
Pick an answer to see why it is right. 5 questions, no account needed.
1. You sell shares for net proceeds of $1,300. Their adjusted basis is $1,000. What is taxed?
2. For 2026, a single filer with $40,000 of other taxable income sells shares held 14 months for a $3,000 gain. What federal tax is due on the gain?
3. Reinvesting a dividend in more shares means the dividend is:
4. You have $5,000 of capital losses and $1,000 of gains this year. How much can be deducted from other income?
5. Which of these can trigger the wash sale rule after you sell a stock at a loss?
Questions people ask
How stocks are taxed FAQ
What is a wash sale?
It happens when you sell a security at a loss and buy substantially identical stock or securities within 30 days before or after the sale.7 U.S. rules can then disallow the loss for now; for a usual taxable replacement, the disallowed amount is generally added to the new shares’ basis. Purchases in related accounts, such as an IRA, can also trigger the rule.
Can capital losses lower my taxes?
Yes. Losses first offset gains, then up to $3,000 a year of the excess ($1,500 if married filing separately) can offset other income, with the rest carried forward.1 A fall in price only counts once you actually sell.
Are reinvested dividends taxable?
In a taxable U.S. account, generally yes. The dividend is income for the year whether you take cash or buy more shares.5 Each reinvestment adds to your cost basis, which lowers your taxable gain when you sell.
What is cost basis?
Cost basis is generally what you paid for an investment, including commissions and other acquisition costs, adjusted for later events. Selling shares for $1,300 with a $1,000 basis produces a $300 gain, not $1,300 of profit. Gifts and inheritances follow their own basis rules.2
Do I pay tax on trades inside an IRA or 401(k)?
Generally not when the trades happen. Traditional accounts are usually taxed when you withdraw, and qualified Roth withdrawals can be tax free.8 Confirm the current rules for your account.
You finished this lesson.
You now have the main ideas from this lesson. Next, practice where mistakes cost nothing: a free account saves your progress and unlocks the practice simulator with virtual money.
Free, no card. Lessons stay free to read without an account.
Your notes on one card, and what comes next
- Step 1 · DoneHow stocks are taxed
See your notes on one card
- Sale proceeds minus adjusted basis give the gain or loss; the gain is not itself the tax bill.
- Shares held more than one year generally qualify for long term rates of 0%, 15% or 20%; gains on shares held a year or less are taxed as ordinary income.
- For a single filer with $80,000 of other taxable income in 2026, a $3,000 gain costs $660 in federal tax if short term and $450 if long term.
- Dividends can be taxable without a sale, and reinvesting them does not make them tax free.
- Net capital losses can offset up to $3,000 of other income a year, but wash sale rules can delay a loss.
- Keep your own records and use the rules for your country, account and tax year.
- 2Step 2 · NowSave your progress with a free account
Keep your course progress and practice on real U.S. stocks with virtual cash.
Create your free account No card needed. Lessons stay free to read. - 3Step 3Follow the learning pathThe learning pathFree
Learn the rest in the right order
Ten modules of lessons, videos, tools and quizzes, ordered so each step builds on the last, from market basics to company analysis and risk.
Start the learning path
Want the full sequence? See the course outline →
Sources and assumptions
- IRS Topic 409: Capital Gains and Losses. U.S. capital asset gains, holding period categories and loss limits. Use applicable year rules; no rates or thresholds are supplied here
- IRS Topic 703: Basis of Assets. Acquisition costs, adjusted basis and special acquisition cases
- IRS Revenue Procedure 2025 32: 2026 tax brackets and capital gain thresholds
- IRS Topic 404: Dividends and Other Corporate Distributions. U.S. dividend categories and reporting context
- IRS: How reinvested dividends are reported
- IRS Publication 550: Investment Income and Expenses. Dividend reinvestment, wash sales and transaction records. Consult the edition and updates applicable to your year
- IRS: Instructions for Schedule D (Form 1040), wash sales and capital loss limits
- IRS: Traditional and Roth IRAs
- HMRC: Tax When You Sell Shares. UK share disposals, account exemptions and tax year allowances
- CRA: Investment Income. Canadian investment income categories and filing resources
- Japan NTA: Individual Income Tax. Current official guide and related taxpayer resources
StockEducation provides general education, not personal financial, tax or legal advice. Companies and funds named here are teaching examples only. Nothing here recommends buying or selling any security. Investing involves risk, including the loss of money you invest.
