Calculate your exact capital gains tax for 2026 — short-term, long-term, NIIT, and state taxes
Capital gains tax is levied on the profit realized when you sell an asset for more than you paid for it — the difference between your cost basis and your sale price. The IRS divides capital gains into two categories with dramatically different tax treatment depending entirely on how long you held the asset before selling. Short-term capital gains apply to assets held one year or less and are taxed as ordinary income at your marginal federal income tax rate, which in 2026 can be as high as 37% for high earners. Long-term capital gains apply to assets held longer than one year and receive preferential tax treatment at 0%, 15%, or 20% depending on your total taxable income — a rate that is in every bracket below the highest equal to or lower than the equivalent ordinary income rate, often dramatically so. The single decision of when to sell an appreciated asset — one day before or one day after the one-year holding anniversary — can change the tax rate on the gain by 15-22 percentage points, potentially saving tens of thousands of dollars on significant gains.
The 2026 long-term capital gains brackets are inflation-adjusted versions of the 2025 thresholds, reflecting cost-of-living increases applied annually under the Tax Cuts and Jobs Act. For single filers, the 0% rate applies to long-term gains when total taxable income including the gain remains below approximately $48,350. The 15% rate covers the range from $48,350 to $533,400. The 20% rate applies to income above $533,400. For married couples filing jointly, these thresholds roughly double: 0% up to $96,700, 15% between $96,700 and $600,050, and 20% above $600,050. Head of household filers receive thresholds between single and joint returns. An important nuance: the capital gain itself is stacked on top of ordinary income for bracket determination, meaning a lower-income earner with a large capital gain may find portions of the gain taxed at different rates as it pushes through multiple brackets — this calculator handles that correctly by stacking the gain above ordinary income when determining the applicable rate.
The Net Investment Income Tax (NIIT), introduced by the Affordable Care Act in 2013, imposes an additional 3.8% tax on net investment income — including capital gains, dividends, rental income, and interest — for taxpayers whose modified adjusted gross income (MAGI) exceeds specific thresholds. For single filers, NIIT applies to the lesser of net investment income or the amount by which MAGI exceeds $200,000. For married filing jointly, the threshold is $250,000. Unlike ordinary income tax brackets, these NIIT thresholds are not inflation-adjusted — they have been fixed at the same dollar levels since the tax was enacted in 2013, meaning they capture more taxpayers each year as wages and investment income rise. In 2026, a single earner with $150,000 in wages and a $100,000 capital gain has MAGI of $250,000, exceeding the $200,000 threshold by $50,000. NIIT applies to the lesser of the $100,000 gain or the $50,000 excess — generating $1,900 in additional federal tax on top of the standard capital gains rate.
The practical impact of NIIT is to create effective federal capital gains rates of 18.8% (15% + 3.8%) and 23.8% (20% + 3.8%) for high-income taxpayers rather than the headline 15% and 20% rates most people know. For taxpayers near the NIIT threshold, careful income management — timing asset sales across tax years, harvesting capital losses to offset gains, or utilizing qualified opportunity zone investments to defer gains — can meaningfully reduce or eliminate NIIT exposure. The NIIT threshold stacks with the long-term capital gains bracket thresholds, creating a complex interaction where the same gain can simultaneously be subject to multiple rate increases as total income crosses different thresholds. This calculator computes NIIT separately and displays it as a distinct line item so you can see exactly how much of your tax bill comes from each component.
Your cost basis — the original value of an asset used to determine capital gains or losses — is the single most important number in a capital gains calculation and the one most frequently calculated incorrectly by individual investors. For stocks purchased through a brokerage, cost basis includes the purchase price plus any commissions paid. For stocks acquired through dividend reinvestment plans (DRIPs), cost basis includes each reinvested dividend at the price it was used to purchase shares — many investors sell DRIP shares without realizing they've been accumulating basis for years through reinvestment, significantly overstating their taxable gain. For mutual funds, cost basis depends on the accounting method selected: FIFO (first in, first out), specific share identification, or average cost basis — each producing different gain calculations and tax outcomes from identical holdings. Specific share identification, which lets you choose exactly which shares to sell, is almost always the most tax-efficient method for appreciated holdings because it allows you to sell the highest-cost shares first, minimizing the recognized gain.
Real estate cost basis carries additional complexity beyond the purchase price. Capital improvements — additions, renovations, or permanent upgrades that extend useful life or add value — increase the cost basis dollar for dollar, reducing the taxable gain on sale. A home purchased for $400,000, improved with a $75,000 kitchen addition and a $25,000 HVAC replacement, has an adjusted cost basis of $500,000 — meaning a $700,000 sale generates a $200,000 gain rather than $300,000. Keeping records of all capital improvements throughout ownership is essential for accurate gain calculation and can produce thousands in tax savings on significant real estate appreciation. The homeowner primary residence exclusion — up to $250,000 for single filers and $500,000 for married filing jointly — applies after adjusting basis for improvements, making accurate basis tracking even more consequential for homeowners near the exclusion threshold.
Tax-loss harvesting is the strategic practice of selling investments that have declined in value to realize capital losses that offset capital gains, reducing overall tax liability. Capital losses first offset capital gains dollar for dollar — short-term losses against short-term gains, long-term losses against long-term gains, then net losses crossing categories. If total capital losses exceed capital gains in a given year, up to $3,000 of net losses can offset ordinary income annually, with excess losses carried forward indefinitely to offset future gains. An investor with $20,000 in long-term capital gains and $12,000 in capital losses from underperforming positions has a net gain of only $8,000 — potentially cutting the tax bill by $1,800 compared to not harvesting the losses. The remaining $12,000 in harvested losses came at the price of no longer holding those positions, making the wash-sale rule a critical consideration: repurchasing substantially identical securities within 30 days before or after the sale disallows the loss for tax purposes.
Strategic tax-loss harvesting becomes particularly powerful in volatile markets where temporary price declines create harvesting opportunities without fundamentally changing long-term investment thesis. An investor holding an S&P 500 index fund that has declined 15% can sell it, immediately purchase a similar but not substantially identical fund (such as a different index fund tracking a related but distinct benchmark), and lock in the tax loss while maintaining essentially the same market exposure. This technique is legal, widely practiced, and most effectively implemented through year-end portfolio reviews in November and December when the full year's gain picture is clear. Robo-advisors including Betterment and Wealthfront offer automated daily tax-loss harvesting as a service, continuously scanning portfolios for harvesting opportunities throughout the year — an approach that research suggests can add 0.5-1.5% annually in after-tax returns for taxable investors compared to buy-and-hold strategies with identical pre-tax returns.
Real estate capital gains receive both favorable treatment through the Section 121 primary residence exclusion and potentially harsh treatment for rental properties subject to depreciation recapture — understanding both is essential for real estate investors approaching a sale. The Section 121 exclusion allows homeowners who have lived in their primary residence for at least two of the five years immediately preceding the sale to exclude up to $250,000 in gains ($500,000 married filing jointly) from federal capital gains tax entirely. On a home purchased for $350,000 and sold for $800,000, a married couple excludes $450,000 of the $450,000 gain — potentially owing zero federal capital gains tax despite enormous appreciation. Partial exclusions apply for homes meeting partial eligibility due to job relocation, health needs, or other unforeseen circumstances, allowing prorated exclusion amounts based on the fraction of the two-year requirement met.
Rental property sales face an additional complication beyond standard capital gains: depreciation recapture. Rental property owners deduct depreciation annually (typically over 27.5 years for residential property) to offset rental income — reducing taxable income each year but simultaneously reducing the property's adjusted cost basis. When the property is sold, the IRS recaptures those depreciation deductions by taxing the depreciated amount at a maximum 25% federal rate (Section 1250 unrecaptured depreciation), regardless of the taxpayer's normal capital gains rate. A rental property purchased for $400,000 and held for 10 years accumulates approximately $145,000 in depreciation ($400,000 ÷ 27.5 × 10), which is taxed at up to 25% on sale — creating $36,250 in potential depreciation recapture tax before any consideration of additional appreciation gains. 1031 exchanges allow rental property owners to defer both capital gains and depreciation recapture by reinvesting proceeds into like-kind property within specific timelines, potentially deferring millions in taxes indefinitely through successive exchanges.