Capital gains tax explained
What a capital gain actually is
A capital gain is the profit you make when you sell an investment โ a stock, a fund, crypto, or a second property โ for more than you paid for it. The key word is sell: a gain is only taxed when you realize it.
If a stock you own doubles but you keep holding it, you owe nothing. The tax clock only starts the moment you sell and lock in the profit.
That single fact is the foundation of almost every capital-gains strategy. Because the tax is triggered by the sale, you largely control when it happens โ which year, in which bracket, and after how long you have held the asset. Our capital gains tax calculator turns a sale price and cost basis into the federal tax you would owe, split across the brackets below.
The one rule that changes everything: long-term vs short-term
How long you held the asset decides which tax system applies. Held for more than one year, the profit is a long-term gain taxed at the favourable 0%, 15% or 20% rates. Held for one year or less, it is a short-term gain taxed as ordinary income โ at the same 10%โ37% brackets as your salary, which can be more than double the long-term rate.
The holding-period clock starts the day after you buy and ends the day you sell, so a stock bought on 5 March is long-term only if sold on 6 March the following year or later. Selling even a day early can move a gain from the 15% long-term rate into a 24% or 32% ordinary bracket โ one of the most expensive single-day mistakes in investing.
The 2026 long-term brackets
The long-term rate you pay depends on your total taxable income, because the gain stacks on top of everything else you earned. For 2026 the 0% rate applies up to $49,450 of taxable income for single filers ($98,900 married filing jointly, $66,200 head of household). The 15% rate applies above that up to $545,500 single ($613,700 joint, $579,600 head of household), and 20% applies to income beyond those ceilings.
Because the gain is stacked above your other income, a single sale can straddle two bands โ part taxed at 0% and the rest at 15%, for example. This is why a retiree with little other income can sometimes sell a large position almost tax-free, while the same sale for a high earner is taxed entirely at 20%. The capital gains calculator splits the gain across the bands automatically once you enter your other taxable income.
The 3.8% surtax high earners forget
On top of the headline rates, high earners owe the Net Investment Income Tax (NIIT) โ an extra 3.8% on investment income once modified adjusted gross income passes $200,000 for single filers or $250,000 for married couples filing jointly. It applies to the smaller of your net investment income or the amount of income above the threshold, so it can turn a 20% headline rate into an effective 23.8%.
NIIT is also federal only, and so is everything in this guide. Most states tax capital gains as well โ California treats them as ordinary income up to 13.3%, while nine states including Texas, Florida and Washington have no income tax at all. Your true rate is the federal long-term rate, plus NIIT if it applies, plus your state.
Losses are a tool, not just bad luck
Capital losses offset capital gains dollar-for-dollar. If you have a $10,000 gain and a $4,000 loss, you are only taxed on the net $6,000. And if your losses exceed your gains, you can use up to $3,000 of the excess to offset ordinary income each year, carrying anything left over forward to future years indefinitely.
Investors use this deliberately โ selling a losing position to bank the loss against a gain elsewhere is called tax-loss harvesting. Just watch the wash-sale rule: if you rebuy the same or a "substantially identical" security within 30 days, the IRS disallows the loss. Net your gains and losses first, then enter the net gain into the calculator.
The timing moves that cut the bill
Because you control the sale, a few simple moves can sharply lower what you owe: (1) hold for at least a year and a day to convert a short-term gain into a long-term one; (2) spread a large sale across two tax years to keep more of it inside the 0% or 15% band; (3) realize gains in a low-income year โ a sabbatical, early retirement, or before a salary jump; (4) harvest losses in the same year to offset the gain.
The most powerful move of all is to hold investments inside tax-advantaged accounts in the first place. Gains inside a 401(k) or Roth IRA are not taxed when you sell within the account, which is why most savers fill those buckets before investing in a taxable brokerage. See how that priority works in our retirement saving guide, model tax-free growth with the Roth IRA calculator, or run a specific sale through the capital gains calculator.