Every time you sell an investment for more than you paid for it, the profit is taxable. That profit is called a capital gain, and how much tax you pay on it depends almost entirely on one thing: how long you held the investment before selling. The difference between a short-term and a long-term capital gain can mean the difference between paying 37% and paying 0% — on the exact same profit. Understanding capital gains tax is one of the most financially impactful things an investor can learn, because the decisions you make before you sell determine your tax bill more than almost anything else.
What Is a Capital Gain?
A capital gain occurs when you sell a capital asset — stocks, bonds, mutual funds, real estate, cryptocurrency, collectibles — for more than you paid for it. Your cost basis is what you paid for the asset, including any commissions or fees. If you buy 100 shares of a stock at $50 each ($5,000 total) and later sell them for $80 each ($8,000 total), your capital gain is $3,000. If you sell for less than you paid, you have a capital loss — which can be used to offset other gains or reduce ordinary income up to $3,000 per year, with unused losses carrying forward indefinitely.
The Critical One-Year Rule
The tax code treats capital gains very differently depending on how long you held the asset. If you held it for one year or less — meaning 365 days or fewer — gains are taxed as ordinary income at the same rates as your salary or wages. This is a short-term capital gain. If you held it for more than one year — 366 days or more — gains qualify for preferential long-term rates that are significantly lower. The difference can be dramatic: a high earner in the 37% income bracket pays 37% on short-term gains but only 20% on long-term gains. Waiting one additional day before selling can translate into saving tens of thousands of dollars on a large position.
Short-Term Capital Gains: Taxed as Ordinary Income
Short-term capital gains are simply added to your other taxable income and taxed at your applicable bracket rate. There are no special reduced rates — a $10,000 short-term gain is treated identically to $10,000 in additional wages. The 2024 federal income tax brackets for a single filer apply directly to these gains.
- 10% bracket: income up to $11,600
- 12% bracket: $11,601 to $47,150
- 22% bracket: $47,151 to $100,525
- 24% bracket: $100,526 to $191,950
- 32% bracket: $191,951 to $243,725
- 35% bracket: $243,726 to $609,350
- 37% bracket: over $609,350
Long-Term Capital Gains Tax Rates (2024)
Long-term capital gains receive their own separate, lower rate structure. For most taxpayers, long-term gains are taxed at 0%, 15%, or 20% — well below ordinary income rates. The rates are based on your taxable income, not just the gain itself.
- 0% rate: taxable income up to $47,025 (single) or $94,050 (married filing jointly) — many middle-income Americans pay no federal tax on long-term gains
- 15% rate: $47,026 to $518,900 (single) — the rate that applies to the vast majority of investors
- 20% rate: above $518,900 (single) — applies only to high earners
- Special 25% rate: unrecaptured Section 1250 gain from real estate depreciation
- Special 28% rate: gains on collectibles and certain small business stock
A couple filing jointly with $70,000 in total taxable income could pay 0% federal tax on long-term capital gains. This is one of the most underused opportunities in the tax code — particularly powerful for early retirees managing income strategically.
A Concrete Example: The Cost of Selling Too Soon
Suppose you're a single filer earning $90,000 in wages and you have $30,000 in investment gains to realize. Your ordinary income puts you in the 22% bracket. If the gain is short-term, you pay 22% on it — $6,600 in federal tax. If the gain is long-term, you pay 15% — $4,500 in federal tax. That's $2,100 saved simply by holding the position for more than one year before selling. On a $200,000 gain, the same math produces $14,000 in tax savings. Patience is among the most tax-efficient investment strategies available to anyone.
Cost Basis: What You Actually Paid
Cost basis is your starting point for every capital gain calculation. For stock purchases it's the price paid plus commissions. But cost basis gets complicated when you've bought shares at multiple times and prices. You can choose which shares to sell first — this is called lot identification. FIFO (first in, first out) sells your oldest shares first; specific lot identification lets you choose exactly which shares to sell. Choosing the highest-basis lots reduces your taxable gain. Choosing long-term lots avoids short-term rates. These decisions, made before you place the sell order, can meaningfully change your tax outcome.
Inherited assets receive a stepped-up basis — their cost basis resets to fair market value at the original owner's date of death. This means heirs can sell inherited investments without owing tax on any appreciation that occurred before inheritance. For highly appreciated long-held assets passed down through generations, this step-up can eliminate hundreds of thousands of dollars in capital gains tax. It's one of the most significant wealth transfer benefits in the entire tax code.
Tax-Loss Harvesting: Turning Losses Into Savings
Tax-loss harvesting is the strategy of intentionally selling investments that have declined in value to generate a capital loss that offsets realized gains elsewhere. If you have $25,000 in gains from one position and $10,000 in losses from another, harvesting those losses reduces your net taxable gain to $15,000 — a real reduction in your tax bill. Losses that exceed gains can offset up to $3,000 of ordinary income per year, and excess losses carry forward indefinitely to offset future years' gains.
- Sell an investment that has declined in value to lock in the loss for tax purposes
- Immediately reinvest in a similar — but not substantially identical — investment to maintain market exposure
- The wash-sale rule disallows the loss if you repurchase the same or substantially identical security within 30 days before or after the sale
- Apply harvested losses first against same-type gains (long-term losses against long-term gains, short-term against short-term), then cross-apply if needed
- Net losses above $3,000 carry forward to future tax years with no time limit
Capital Gains on Your Primary Residence
Real estate is subject to capital gains rules, but your primary home receives a major exclusion under Section 121 of the tax code. If you've owned and lived in the home as your primary residence for at least two of the past five years, you can exclude up to $250,000 of capital gains (single filer) or $500,000 (married filing jointly) from federal tax. This exclusion can be used once every two years. On the sale of an investment property, vacation home, or a property that doesn't meet the primary residence test, all capital gains are fully taxable at standard rates. Depreciation recapture on rental property is taxed at a special 25% rate up to the depreciation claimed, then at regular long-term rates above that.
Capital Gains Inside Retirement Accounts
One of the most powerful features of tax-advantaged retirement accounts is that capital gains inside them are not taxed when they occur. Within a traditional 401(k) or IRA, you can buy and sell investments freely, realize gains, and reinvest without triggering any current-year tax bill. You pay ordinary income tax only when you withdraw funds in retirement — by which point you're typically in a lower bracket. Inside a Roth IRA, all gains are permanently exempt from tax at withdrawal, assuming you meet the qualified distribution requirements. This makes retirement accounts the highest-priority home for investments you expect to appreciate significantly.
The 3.8% Net Investment Income Tax
High earners face an additional tax on investment income called the Net Investment Income Tax (NIIT), enacted as part of the Affordable Care Act. The NIIT applies an additional 3.8% to net investment income — including capital gains, dividends, interest, and passive rental income — for single filers with modified adjusted gross income above $200,000 and married joint filers above $250,000. Combined with the 20% long-term capital gains rate, high earners effectively pay 23.8% on long-term gains. While still well below the 37% top ordinary income rate, NIIT is a real cost that factors into planning for large investment transactions.
Strategies to Minimize Capital Gains Tax
- Hold investments for more than one year before selling — the single most impactful and universally applicable strategy
- Prioritize placing high-growth investments inside Roth IRAs and 401(k)s where gains compound tax-free
- Use tax-loss harvesting throughout the year to offset gains with realized losses
- Gift highly appreciated shares to charity instead of cash — you avoid the capital gains and receive a deduction for the full fair market value
- Realize long-term gains in low-income years when you may qualify for the 0% long-term rate
- When selling partial positions, use specific lot identification to choose the highest-basis shares and minimize the taxable gain
- For large real estate sales, consider installment sales to spread the gain across multiple tax years
For large transactions — selling a business, a concentrated stock position built up over decades, or a significantly appreciated property — working with a CPA before you sell (not after) consistently pays for itself many times over. The tax on a major transaction is largely determined before the sale closes.
Capital gains taxes are among the most plannable taxes in the entire code. Unlike income taxes on wages, which are owed on money as you earn it, capital gains taxes don't arise until you sell. The timing of your sales — a decision entirely within your control — determines when and at what rate you're taxed. Investors who think about tax consequences before they sell, not after, consistently keep more of their returns. The difference between thoughtful tax planning and reactive selling can amount to tens or hundreds of thousands of dollars over a lifetime of investing.
Estimate your income and capital gains tax with our Income Tax Calculator →