You put $4,000 into an index fund in 2019. Today the account says $10,000. That $6,000 of growth is real, it shows up on every statement, and as far as the IRS is concerned it does not exist yet.

Investment taxes run backwards from paycheck taxes, where money is withheld before you ever see it. Here the government waits, sometimes for decades, and asks for a cut only on the day you sell.

What follows is general information about how those rules work, not tax advice for your situation.

Five panels on capital gains: tax applies only to the gain over cost basis, short term is taxed like a paycheck while long term gets lower rates, losses offset gains, and wash sales are disallowed.

Cost Basis and the Gain That Only Exists on Paper

Your cost basis is what you paid for an investment, including commissions and fees. If you reinvest dividends automatically, each reinvestment buys new shares and raises your total basis. People who forget that overstate their gain and overpay.

A gain is unrealized while you still own the asset and realized the moment you sell. Only realized gains are taxed, so the $6,000 above costs you nothing this year no matter how high the fund climbs. Sell at $10,000 with a $4,000 basis and you have realized a $6,000 capital gain.

The One Year Line

Hold an asset one year or less and the profit is a short-term capital gain, taxed at ordinary income rates, the same 10 to 37 percent brackets that apply to your wages.

Hold it more than one year and it becomes a long-term capital gain, taxed at 0, 15, or 20 percent. The clock starts the day after you buy and runs through the day you sell.

Which long-term rate applies depends on your total taxable income, not the size of the gain. The 2026 thresholds, which are adjusted for inflation every year:

  • Single: 0 percent up to $49,450, 15 percent up to $545,500, 20 percent above that.

  • Married filing jointly: 0 percent up to $98,900, 15 percent up to $613,700, 20 percent above that.

  • Head of household: 0 percent up to $66,200, 15 percent up to $579,600, 20 percent above that.

Long-term gains stack on top of ordinary income rather than replacing it, so wages fill the lower rungs first.

What the Wait Is Worth

Take a single filer with $45,000 of taxable income and that same $6,000 gain, using 2026 figures.

Sold at eleven months, the gain is ordinary income. It stacks from $45,000 to $51,000, so $5,400 of it is taxed at 12 percent ($648) and the last $600 crosses into the 22 percent bracket ($132). Tax on the gain: $780.

Sold at thirteen months, it is long-term. The first $4,450 sits under the $49,450 zero-rate ceiling and is taxed at nothing. The remaining $1,550 is taxed at 15 percent. Tax on the gain: about $233.

Same investment, same profit, $547 apart for waiting eight more weeks.

The Extra 3.8 Percent for Higher Earners

Above certain incomes a surtax lands on top. The net investment income tax adds 3.8 percent to investment income, including capital gains, dividends, interest, and rent.

It applies once modified adjusted gross income passes $200,000 for single and head of household filers, $250,000 for joint filers, and $125,000 for married filing separately, and it hits the smaller of your net investment income or the amount by which you went over.

Those thresholds have been frozen since 2013 and are not indexed for inflation, so wage growth alone pulls more people over the line each year. In the top bracket the real long-term rate is 23.8 percent, not 20.

Losses Count, and They Carry Forward

A realized capital loss first cancels out realized capital gains, dollar for dollar.

If losses exceed gains, you can deduct up to $3,000 of the excess against ordinary income such as wages ($1,500 if married filing separately). That limit has stood since 1978 and has never been indexed for inflation.

The rest carries forward indefinitely, with no expiration. A $20,000 net loss can shelter $3,000 of wages a year for six years and change, or erase a large gain the moment you have one. Deliberately selling losers to bank those losses is called tax loss harvesting.

The Wash Sale Rule Closes the Obvious Loophole

The obvious trick is to sell at a loss on Monday and buy the same shares back on Tuesday. Congress blocked it in 1921.

Under the wash sale rule, buying the same or a substantially identical security within 30 days before or 30 days after the sale disallows the loss. That is a 61-day window with the sale in the middle, and it counts purchases in your spouse's accounts and your IRA, not just the account you sold from.

The loss is postponed rather than destroyed. The disallowed amount is added to the basis of the replacement shares, so you recover it when you sell those. The exception is a purchase made inside an IRA, where the loss is gone for good.

Basis Resets at Death

If you never sell, the gain may never be taxed. Whoever inherits an investment from you gets a new cost basis equal to its fair market value on your date of death. This is the step-up in basis.

A stock bought for $10,000 and worth $200,000 at death carries a $190,000 unrealized gain. Your heir's basis becomes $200,000, so selling the next week produces almost no taxable gain. Decades of appreciation escape income tax permanently.

Giving that stock away while you are alive works differently, since your basis follows the shares to the recipient along with the entire built-in gain. Very large estates can owe federal estate tax separately, though the exclusion is $15,000,000 per person for deaths in 2026 and is indexed for inflation.

Your Home Has Its Own Rule

If you owned a home and lived in it as your main home for at least two of the five years before selling, you can exclude up to $250,000 of gain, or $500,000 for a married couple filing jointly, once every two years.

Gain above the exclusion is an ordinary long-term capital gain. Basis here is the purchase price plus capital improvements such as a new roof, but not routine repairs, which is why receipts can matter decades later. Both exclusion amounts were set in 1997 and are not indexed, so expensive markets increasingly blow past them.

None of This Applies Inside a Retirement Account

Buying and selling inside a 401(k) or a traditional IRA triggers no capital gains tax at all. You can rebalance or sell a winner and owe nothing along the way.

The catch comes on the way out. Traditional withdrawals are taxed as ordinary income at your regular bracket no matter how the money was earned inside, so the preferential long-term rates never apply. Qualified Roth withdrawals come out tax free.

Two consequences follow. Losses inside a retirement account carry no tax value, so there is nothing to harvest. And a holding you plan to keep for decades can sit in a taxable account, where the low long-term rate and the step-up in basis are both available.

Summary

Capital gains tax is charged on realized profit, so nothing is owed until you sell. Crossing the one year mark moves a gain from ordinary income rates to the 0, 15, or 20 percent long-term rates, with a 3.8 percent surtax layered on for higher earners. Losses offset gains plus $3,000 of ordinary income a year and carry forward with no expiration, repurchasing within 30 days disallows the loss, and inside a retirement account sales are untaxed but withdrawals are ordinary income.