Capital gains tax on stocks is the tax on your profit when you sell shares for more than you paid, and how long you owned them sets the rate. Shares held more than a year get the lower long-term rates; shares held a year or less are taxed like salary. This guide sets out the federal rules for US taxpayers in 2026: holding periods, the rate thresholds, the 3.8% net investment income tax, state taxes, how losses and cost basis methods change the bill, the forms your broker sends and a full worked calculation. Tax law changes and every return is different, so treat the figures as illustrations and confirm your own situation with a tax professional. For the wider picture of owning shares, start at the stocks and investing hub.
How is a stock sale taxed?
A stock sale is taxed on the gain, the sale proceeds minus your cost basis, in the tax year of the trade.
Proceeds are what you receive after commissions and fees. Cost basis is usually the purchase price plus purchase costs, adjusted later for events such as stock splits or return-of-capital payments. A paper profit is never taxed, however large: only realized gains count, and when proceeds fall short of basis the shortfall is a capital loss that can reduce the tax on other gains. The prices on our stock and ETF pages show what a position would fetch today; your basis comes from your purchase records.
The tax year follows the trade date, not the settlement date. Settlement for US stock trades runs on this timetable: One business day after the trade (T+1), since May 28, 2024. IRS Publication 550 still puts a year-end sale in the year of the trade, so shares sold on December 31, 2026 are a 2026 sale even though the cash arrives in January.
Some investment income sits outside this calculation. Dividends are taxed when paid, at long-term rates if they are qualified and at ordinary rates otherwise, as explained in qualified vs ordinary dividends. Mutual funds and some ETFs pass realized gains to shareholders as capital gain distributions, which Publication 550 treats as long-term however briefly you have owned the fund. Interest on bonds and Treasury bills is ordinary income, covered in are T-bills taxable. Trades inside an IRA or 401(k) are not taxed when made; withdrawals follow each account's rules, compared in Roth vs traditional IRA.
How long do you need to hold a stock for long-term rates?
You need to hold shares for more than one year, counting from the day after the purchase through the day you sell.
The IRS starts the clock the day after the trade date and includes the day of sale. A position bought on March 3, 2025 therefore turns long-term with a sale on March 4, 2026 or later; selling on March 3, 2026, exactly one year on, still produces a short-term gain. Use trade dates at both ends, never settlement dates.
A few situations follow their own rules:
- Reinvested dividends. Each reinvestment buys a new lot with its own start date, so a dividend reinvestment plan leaves many small lots that turn long-term on different days.
- Inherited shares count as long-term from the start, however briefly anyone held them.
- Gifted shares usually carry the giver's holding period along with the giver's basis.
- Wash sale replacements take over the holding period of the shares sold at a loss, as the guide to the wash sale rule explains.
What are the 2026 capital gains tax rates?
For 2026, long-term gains are taxed at 0% up to $49,450 of taxable income (single) or $98,900 (married filing jointly); 15% above that; 20% above $545,500 (single) or $613,700 (joint).
The other filing statuses have their own thresholds: 0% up to $66,200 of taxable income and 20% above $579,600 for heads of household; 0% up to $49,450 and 20% above $306,850 for married people filing separately. Short-term gains get no special rate. They are added to wages and other ordinary income and taxed at the 2026 brackets of 10%, 12%, 22%, 24%, 32%, 35% and 37%, with the top rate applying above $640,600 of taxable income for single filers and $768,700 for married couples filing jointly.
Two details trip people up. The thresholds apply to taxable income, after the standard deduction of $16,100 for single filers and married people filing separately, $24,150 for heads of household and $32,200 for married couples filing jointly or your itemized deductions, not to the gain alone. And long-term gains, together with qualified dividends, are stacked on top of your ordinary income, so a single gain can straddle two rates. The table shows the federal rate on the next dollar of gain for a single filer at different income levels.
| Single filer's taxable income before the gain | Rate on a short-term gain | Rate on a long-term gain |
|---|---|---|
| $40,000 | 12% | 0% |
| $90,000 | 22% | 15% |
| $180,000 | 24% | 15% |
| $300,000 | 35% | 15% |
| $600,000 | 35% | 20% |
At the two highest incomes, modified AGI is also above the threshold for the 3.8% surtax, so either kind of gain would owe that too. Some long-term gains face a higher cap. Topic 409 sets a 28% maximum for collectibles and for the taxable part of a gain on qualified small business stock under section 1202, and Publication 550 counts gold, silver and platinum bullion as collectibles, along with gains on a trust interest that come from collectibles the trust holds.
How do you calculate capital gains tax on a stock sale?
Subtract basis from proceeds, sort the result by holding period, net it with your other gains and losses, then apply the rates for your taxable income.
Work out the gain or loss on each sale
Take the proceeds after fees and subtract the adjusted basis of the shares sold. Your broker's Form 1099-B shows both for most shares bought since 2011; for older or transferred shares you may need your own records.
Sort each result by holding period
More than one year from trade date to trade date is long-term; one year or less is short-term.
Net within each group, then across groups
Short-term losses offset short-term gains and long-term losses offset long-term gains. A net loss in one group then reduces a net gain in the other. Capital gain distributions from funds join the long-term group.
Stack the result on your other taxable income
Start from ordinary taxable income after deductions. A net short-term gain is taxed with it at ordinary rates; a net long-term gain sits on top and is taxed at 0%, 15% or 20% depending on where each dollar lands.
Add the surtax and state tax if they apply
Compare modified AGI with the net investment income tax thresholds, then apply your state's rules, which usually tax gains as ordinary income.
Worked example: Federal tax on a $40,000 long-term gain, married filing jointly, 2026
A married couple has $110,000 of wages and takes the standard deduction. In June 2026 they sell 500 shares of an index fund bought in 2019 for $25,000, receiving $65,000.
| Step | Income | Federal tax |
|---|---|---|
| Wages | $110,000 | |
| Minus the standard deduction | −$32,200 | |
| Ordinary taxable income | $77,800 | $8,840 |
| Long-term gain: $65,000 − $25,000 | $40,000 | |
| Gain that fits below the 0% ceiling of $98,900 | $21,100 | $0 |
| Gain above the ceiling, taxed at 15% | $18,900 | $2,835 |
| Total | $117,800 of taxable income | $11,675 |
- Tax on the ordinary income: 10% of the first $24,800 plus 12% of the next $53,000, or $2,480 + $6,360 = $8,840
- Tax caused by the sale: $2,835, an effective 7.1% of the gain
- Had the shares been held a year or less, all $117,800 would be ordinary income, taxed at $15,340. The sale would then cost $6,500, or 16.25% of the gain, so long-term treatment saves $3,665
- Modified AGI is $150,000, below the $250,000 joint threshold, so no 3.8% surtax applies
When does the 3.8% net investment income tax apply?
The 3.8% net investment income tax applies once modified AGI passes a threshold, and it taxes the smaller of your net investment income or the amount over that threshold.
The tax is 3.8% on the smaller of net investment income and the amount by which modified AGI exceeds $200,000 (single) or $250,000 (married filing jointly), with a $125,000 threshold for married people filing separately; heads of household share the single threshold. The thresholds are fixed in the tax code rather than indexed, so inflation pulls more investors above them over time. Net investment income includes gains on stocks and funds, dividends, interest and most rental income, less related expenses. Wages and withdrawals from IRAs and 401(k)s are not investment income, but they do raise modified AGI, which is how a large salary exposes an ordinary-sized gain to the surtax. It applies to short-term and long-term gains alike and is figured on Form 8960.
Worked example: The surtax on a single filer's $40,000 gain
A single filer earns $185,000 in wages in 2026 and sells shares held for three years at a $40,000 gain, bringing modified AGI to $225,000.
- Modified AGI over the $200,000 threshold: $25,000
- Net investment income: $40,000
- Surtax: 3.8% of the smaller amount, $25,000, is $950
- Income tax on the gain: ordinary taxable income of $168,900 already fills the 0% band, and total taxable income of $208,900 is far below the 20% threshold, so the whole gain is taxed at 15%, or $6,000
- Federal tax on the gain: $6,950, an effective 17.4%
Do states tax capital gains on stocks?
Most states with an income tax treat capital gains as ordinary income, adding their own rate on top of the federal tax.
The approaches differ widely, as four examples show:
| State | How long-term gains on stocks are taxed |
|---|---|
| California | As ordinary income, with no lower rate for capital gains. 2025 rates for single filers reach 9.3% from $72,724 of taxable income and 12.3% above $742,953, plus a 1% Behavioral Health Services Tax on taxable income over $1 million |
| Washington | A 7% capital gains tax on long-term gains above an annual standard deduction, $278,000 for 2025, rising to 9.9% on taxable gains over $1 million from 2025; assets in certain retirement accounts are exempt |
| Wisconsin | 30% of net long-term capital gain is excluded (60% for farm assets), and the rest is taxed at regular rates |
| Texas | No personal income tax, so no state tax on the gain |
A state's rate can outweigh the federal one. In California, a gain that falls in the federal 0% band is still taxed at the state's ordinary rates. Rates, deductions and exclusions change most years, so check your state tax agency's current instructions before estimating the total.
How do capital losses offset gains?
Losses first offset gains with the same holding period, then gains of the other kind, and a remaining net loss is deductible up to $3,000 a year against ordinary income ($1,500 if married filing separately).
Whatever is left carries forward to later years until used, keeping its short-term or long-term character, according to Publication 550. Netting can also change which rate applies. Suppose a year brings $4,000 of short-term gains and $7,000 of short-term losses, plus $10,000 of long-term gains and $2,000 of long-term losses. The short-term side nets to a $3,000 loss and the long-term side to an $8,000 gain, leaving a $5,000 net long-term gain taxed at long-term rates. Without the short-term losses, the $4,000 of short-term gain would have been taxed at ordinary rates.
A year with more losses than gains works the other way: a net loss of $11,000 gives a $3,000 deduction against wages and an $8,000 carryforward. A loss on shares you still own counts for nothing until you sell, and a sale followed by a quick repurchase can lose the deduction under the wash sale rule. Selling losing positions on purpose to collect these offsets is the subject of tax loss harvesting.
How do cost basis methods change your gain?
When you sell part of a position bought at different prices, the lots you choose set the basis, and so the gain.
Three methods are common:
- First in, first out (FIFO). The oldest shares are sold first. It is the IRS default when you do not identify shares, and brokers apply it to stocks unless you instruct otherwise.
- Specific identification. You name the exact lots to sell. Under Treasury regulation 1.1012-1, the instruction counts if you give it no later than the settlement date, and a standing order such as highest cost first also qualifies; you should get written confirmation from the broker.
- Average cost. Available only for shares of mutual funds and other regulated investment companies, and for shares bought through a dividend reinvestment plan. Every share carries the average basis, and the oldest shares are treated as sold first for the holding period. Brokers may make it the default for funds, and the election must generally be revoked by the earlier of one year after you make it or your first sale of those shares.
Worked example: One sale, three basis methods
You own three lots of the same index fund and sell 50 shares at $130 in October 2026, for proceeds of $6,500.
| Lot | Bought | Shares | Price | Basis |
|---|---|---|---|---|
| A | March 2022 | 50 | $80 | $4,000 |
| B | January 2024 | 50 | $140 | $7,000 |
| C | February 2026 | 50 | $120 | $6,000 |
| Method | Basis of the 50 shares sold | Result |
|---|---|---|
| FIFO (lot A) | $4,000 | $2,500 long-term gain |
| Specific identification, lot B | $7,000 | $500 long-term loss |
| Specific identification, lot C | $6,000 | $500 short-term gain |
| Average cost: $17,000 ÷ 150 shares = $113.33 | $5,667 | $833 long-term gain |
FIFO realizes the biggest gain, while naming lot B turns the same trade into a deductible loss. Average cost is an option here only because these are fund shares; for individual stocks the choice is FIFO or specific identification.
How do Form 1099-B and Form 8949 work?
Your broker reports each sale on Form 1099-B, and you carry those sales to Form 8949 and Schedule D of Form 1040.
The 1099-B lists the shares sold, the dates acquired and sold, the proceeds and, for covered securities, the basis. Covered securities are stocks acquired from 2011 onward and fund or reinvestment-plan shares acquired from 2012; for older shares the broker may leave basis blank and check box 5, leaving the figure to your own records. Box 1g shows any wash sale loss the broker disallowed, and box 12 is checked when basis was reported to the IRS.
Form 8949 splits sales into short-term and long-term sections and, within each, by checkbox: A or D when the 1099-B showed basis reported to the IRS, B or E when it did not, and C or F when no 1099-B arrived. Boxes G through L cover digital assets reported on the new Form 1099-DA. If every sale was reported with basis and needs no adjustment, you can skip Form 8949 and enter the totals directly on Schedule D, lines 1a and 8a. Otherwise adjustments go in column (g) with a code in column (f), such as W for a disallowed wash sale loss or B when the basis on the 1099-B is wrong. Schedule D then nets everything and feeds the tax calculation. Crypto sales use the same rates with their own reporting quirks, explained in our crypto tax guide.
How are inherited and gifted shares taxed?
Inherited shares usually take a basis equal to their market value on the date of death, while gifted shares generally keep the giver's original basis. An executor can elect a later alternate valuation date instead, and inherited shares always count as long-term, so an heir who sells soon after the death is taxed only on any rise since then. Take shares a parent bought for $5,000 that are worth $20,000 at death. The heir's basis is $20,000, so a sale at $21,000 produces a $1,000 long-term gain; had the parent given the shares away while alive, the $5,000 basis would carry over and the same sale would produce a $16,000 gain. If gifted shares are worth less than the giver's basis on the day of the gift, a later loss is measured from that lower value, and a sale between the two figures gives neither gain nor loss. Part of any gift tax paid on the appreciation is added to basis. Publication 551 also blocks one shortcut: appreciated shares given to someone who dies within a year and leaves them back to the giver or the giver's spouse keep the decedent's old basis.
What are the risks and common mistakes with capital gains tax?
The costliest mistakes involve timing, basis records and overlooked accounts rather than the rates themselves.
- Selling a day early. A sale on the one-year anniversary of the purchase is still short-term. In a 24% bracket, that day costs 9% of the gain compared with the 15% long-term rate.
- Missing basis. For shares bought before 2011, and sometimes for shares received as gifts or moved between brokers, the 1099-B may show no basis. Leaving it blank can mean paying tax on the whole sale price, so keep purchase records.
- Accepting the default lot. If you do not identify lots by settlement, FIFO usually sells the oldest, cheapest shares and realizes the largest gain.
- Fund distributions in a bad year. Funds can pay taxable capital gain distributions in a year when their price fell and you sold nothing.
- No withholding on sales. A large gain is not covered by paycheck withholding, and Topic 409 notes that you may need to make estimated tax payments.
- Ignoring state tax. A state that taxes gains as ordinary income can charge more than the federal long-term rate on the same gain.
- Rules change. Brackets are indexed every year and Congress can change the rates or the surtax. This page reflects the 2026 rules as of November 2026; it is not tax advice, and a tax professional can apply the rules to your return.
