Capital gains tax is the tax you pay when you sell an investment for more than you paid for it. It is one of the most consequential taxes an investor ever faces — and one of the most misunderstood. The difference between a short-term gain (taxed as ordinary income, up to 37%) and a long-term gain (taxed at preferential rates of 0%, 15%, or 20%) can be tens of thousands of dollars on a single sale. Add in the Net Investment Income Tax, the wash-sale rule, and the primary residence exclusion, and capital gains planning becomes one of the highest-leverage areas of personal tax strategy.
This guide walks through the rules that determine how your gains are taxed, the strategies that can minimize those taxes, and the traps that catch investors who do not plan ahead. The 2025 figures are used throughout, with notes on what changes in 2026 when several Tax Cuts and Jobs Act provisions are scheduled to sunset.
Short-term vs long-term: the holding period rule
The holding period rule is the single most important concept in capital gains tax. If you hold an asset for one year or less before selling, any gain is short-term and taxed as ordinary income at your marginal rate (10%, 12%, 22%, 24%, 32%, 35%, or 37%). If you hold the asset for more than one year, the gain is long-term and taxed at preferential rates of 0%, 15%, or 20%, depending on your income. The difference is dramatic — a top-bracket taxpayer pays 37% on a short-term gain but only 20% on a long-term gain, a 17-percentage-point saving.
The holding period starts the day after you acquire the asset and ends on the day you sell it. A purchase on January 15, 2025, has a holding period that begins January 16, 2025. To qualify for long-term treatment, you must hold the asset through January 16, 2026 — selling on January 15, 2026, would still be short-term. Investors near the one-year mark sometimes hold an appreciated position for a few extra days specifically to cross the long-term threshold, though this exposes them to the risk of a price drop during the holding period.
The 2025 long-term capital gains brackets
For 2025, the long-term capital gains brackets for most filing statuses are: 0% on taxable income up to $48,350 (single) or $96,700 (married filing jointly); 15% on income from $48,351 to $533,400 (single) or $96,701 to $600,050 (married filing jointly); and 20% on income above those thresholds. The brackets are tied to taxable income, not just capital gains — so a retiree with $40,000 of ordinary income and $30,000 of long-term capital gains would have $8,350 of the gains taxed at 0% and the remaining $21,650 taxed at 15%.
The 0% bracket is one of the most underused provisions in the tax code. A married couple with $90,000 of total taxable income in 2025, all from long-term capital gains, pays zero federal tax on those gains. This creates a powerful planning opportunity for retirees in low-income years, who can harvest gains up to the top of the 0% bracket and reset their cost basis without owing any federal tax. The strategy is sometimes called "tax-gain harvesting" and works in years when the household's taxable income (including the gains) stays below the 0% bracket ceiling.
The Net Investment Income Tax (NIIT)
The Net Investment Income Tax is a 3.8% surcharge on investment income — including capital gains, dividends, interest, rents, and passive business income — that applies to taxpayers with modified adjusted gross income above $200,000 (single) or $250,000 (married filing jointly). The thresholds are not indexed for inflation, so more taxpayers fall into the NIIT each year. Unlike ordinary income tax brackets, the NIIT threshold does not adjust with inflation, which means a growing number of middle-income investors are caught by it.
The NIIT applies to the lesser of your net investment income or the amount by which your MAGI exceeds the threshold. A single filer with $180,000 of salary and $40,000 of capital gains has MAGI of $220,000 — $20,000 above the threshold. The NIIT applies to the lesser of $40,000 (net investment income) or $20,000 (excess over threshold), so $20,000 of the gains is subject to the 3.8% surcharge, adding $760 to the tax bill. This means a long-term gain that nominally falls in the 15% bracket can actually be taxed at 18.8% once the NIIT is included.
The wash-sale rule
The wash-sale rule prevents investors from claiming a tax loss while maintaining essentially the same investment position. Under IRC § 1091, if you sell a security at a loss and buy the same or "substantially identical" security within 30 days before or 30 days after the sale, the loss is disallowed. The disallowed loss is added to the cost basis of the replacement shares, so the loss is not permanently lost — it is deferred until the replacement shares are sold. The wash-sale window is 61 days total: 30 days before, the day of sale, and 30 days after.
"Substantially identical" is not perfectly defined, but the IRS has ruled that shares of the same company are obviously identical, while shares of different mutual funds tracking the same index are usually not. An S&P 500 fund from Vanguard and an S&P 500 fund from Fidelity are generally considered not substantially identical, allowing an investor to switch from one to the other to harvest a loss without triggering the wash-sale rule. Buying an options contract on the same security would be substantially identical. The rule applies per taxpayer, but the IRS has also extended it to IRAs — if your IRA buys the same security within the window, the loss in your taxable account is disallowed permanently.
Tax-loss harvesting strategy
Tax-loss harvesting is the practice of intentionally selling investments at a loss to offset capital gains and reduce taxable income. Each year, you can use capital losses to offset capital gains dollar-for-dollar, with no limit. If your losses exceed your gains, you can deduct up to $3,000 of the excess against ordinary income each year, with any remaining loss carried forward indefinitely to future years. The $3,000 ordinary income offset is per return, not per person, so a married couple gets one $3,000 deduction, not two.
The mechanics matter. Short-term losses first offset short-term gains, and long-term losses first offset long-term gains. If there is an excess of one type, it then offsets the other type. Because short-term gains are taxed at higher rates, it is more valuable to use losses to offset short-term gains than long-term gains. A well-executed loss harvesting strategy at the end of each tax year can save thousands of dollars, particularly in volatile years when broad market declines create losses across many positions. The harvest must be paired with a wash-sale-safe replacement purchase if the investor wants to maintain market exposure.
The primary residence exclusion
The sale of a primary residence receives one of the most generous tax breaks in the code: under IRC § 121, a taxpayer can exclude up to $250,000 of gain (single) or $500,000 of gain (married filing jointly) on the sale of a home that has been their primary residence for at least two of the five years preceding the sale. The two years do not need to be consecutive — they just need to total 24 months of occupancy within the 60-month window ending on the sale date.
The exclusion can be used repeatedly, but not more than once every two years. A married couple can claim the full $500,000 exclusion only if both spouses meet the two-year residency test (or one meets it and the other is granted a partial exclusion under the rules for changes in employment, health, or unforeseen circumstances). Gain in excess of the exclusion is long-term if the home was held more than one year. Cost basis includes the original purchase price plus closing costs and major improvements — not repairs or maintenance. Keeping records of capital improvements (new roof, kitchen remodel, addition) over the years of ownership can substantially reduce the taxable gain at sale.
Collectibles, crypto, and QSBS
Three special asset classes have their own capital gains rules. Collectibles — including art, antiques, stamps, coins, and precious metals — are taxed at a maximum long-term rate of 28% rather than the standard 20%, even for taxpayers in the top bracket. The 28% rate also applies to qualified small business stock (QSBS) gains that exceed the Section 1202 exclusion. Cryptocurrency is treated as property, meaning every sale or exchange is a taxable event, with gains taxed under the same short-term/long-term rules as stocks.
Qualified Small Business Stock under Section 1202 offers the most generous exclusion in the code: the greater of $10 million or 10 times the taxpayer's basis in the stock, per issuer, on stock acquired after September 27, 2010, and held for more than five years. A founder who acquires QSBS at incorporation and sells after five years can shield up to $10 million of gain entirely from federal tax. The rules are technical — the issuer must be a domestic C corporation with gross assets under $50 million at issuance, and the business must be in a qualified trade (excluding professional services, banking, farming, hospitality, and several others).
Frequently asked questions
More than one year. The holding period starts the day after you acquire the security and ends on the day you sell it. A stock purchased on January 15, 2025, must be held through January 16, 2026 (the day after the one-year anniversary) to qualify for long-term treatment. Selling one day earlier — on January 15 — would still produce a short-term gain taxed as ordinary income.
Only against capital gains. You can offset any amount of capital gains with capital losses in the same year, with no limit. But if your losses exceed your gains, you can deduct only $3,000 of the excess against ordinary income per year ($1,500 if married filing separately). Any unused loss carries forward to future years indefinitely, retaining its character as short-term or long-term.
Not currently. The wash-sale rule under IRC § 1091 applies to "stocks and securities," and the IRS has not formally extended it to cryptocurrency, which is treated as property. This means you can sell Bitcoin at a loss and immediately repurchase it without triggering the wash-sale rule. However, Congress has repeatedly proposed closing this loophole, so the rule may change. Investors should also be aware that the wash-sale rule does apply to crypto held inside an IRA.
Last reviewed June 25, 2026. This article is informational and does not constitute legal, tax, or financial advice. Consult a qualified professional for guidance specific to your situation.