$LevyIO
InvestmentsApril 11, 202618 min read

Capital Gains Tax Calculator: What You Actually Owe on Investments

Reviewed by Brazora Monk·Last updated April 30, 2026

Most investors assume capital gains tax is simple: sell at a profit, pay 15%. That assumption produces five common and expensive errors — missing the income stacking rules that push you into a higher bracket, ignoring the 3.8% Net Investment Income Tax, miscalculating cost basis on reinvested dividends, triggering wash sales on cryptocurrency, and paying ordinary income rates when holding just two more weeks would qualify the gain as long-term. This guide corrects each of those errors with exact 2026 rates, thresholds, and worked examples.

Key Takeaways

  • Long-term capital gains (assets held 12+ months) are taxed at 0%, 15%, or 20% in 2026 — the rate depends on your total taxable income, not just the gain itself
  • Short-term gains (12 months or less) are taxed at ordinary income rates up to 37% — the same as your salary
  • The 3.8% Net Investment Income Tax (NIIT) adds on top of capital gains for single filers above $200,000 MAGI or married filers above $250,000
  • Capital gains stack on top of ordinary income — a small gain can push you into a higher rate bracket even if your wages alone wouldn't
  • Tax-loss harvesting can offset unlimited capital gains and up to $3,000 of ordinary income per year, with losses carrying forward indefinitely

The Myth of the Flat 15% Capital Gains Rate

The 15% long-term capital gains rate is real — but it applies only to investors whose total taxable income falls within specific thresholds. According to IRS Revenue Procedure 2025-32, the 2026 long-term capital gains brackets are:

RateSingle Filer (Taxable Income)Married Filing JointlyHead of Household
0%Up to $49,450Up to $98,900Up to $66,750
15%$49,451 – $545,500$98,901 – $613,700$66,751 – $579,600
20%Over $545,500Over $613,700Over $579,600

The key phrase is "taxable income" — not just investment income. Long-term capital gains are added on top of your other income (wages, business income, interest) to determine which bracket they land in. A software engineer earning $120,000 in salary who also sells $50,000 in appreciated stock doesn't pay 15% on the full $50,000 gain. The gains stack on top of salary, and the portion that pushes total income above the 15% threshold gets taxed at 20%.

Per the Tax Foundation's 2026 analysis, only about 7% of taxpayers pay the 20% long-term capital gains rate. But a much larger percentage unknowingly push themselves into a higher rate by not modeling the income stacking effect before selling. Use the Capital Gains Tax Calculator to see exactly where your gains land after stacking.

Short-Term vs Long-Term: The Holding Period That Changes Everything

The single most controllable variable in your capital gains tax bill is holding period. Assets held for more than 12 months qualify for preferential long-term rates (0%, 15%, or 20%). Assets held for 12 months or less are short-term gains, taxed at ordinary income rates — the same brackets as your salary, from 10% to 37%.

The holding period is counted precisely: the day you buy does not count, but the day you sell does. If you bought 100 shares of a stock on April 10, 2025, you must wait until at least April 11, 2026 to qualify for long-term treatment. Selling on April 10 makes it a short-term gain.

Real Cost of Impatience: Short-Term vs Long-Term on a $50,000 Gain

Investor has $80,000 in W-2 wages (single filer, 2026), sells stock with a $50,000 gain.

Short-Term (held ≤ 12 months)

Total taxable income: $130,000 – $15,750 standard = $114,250

$50,000 gain taxed at 22–24% = ~$11,500

Capital gains tax: ~$11,500

Long-Term (held > 12 months)

Ordinary income: $80,000 – $15,750 = $64,250 (in 22% bracket)

$35,250 of gain taxed at 15% = $5,288

$14,750 of gain taxed at 15% = $2,213

Capital gains tax: ~$7,500

Waiting beyond the 12-month mark saves approximately $4,000 on a $50,000 gain. That's an 8% return on doing nothing except waiting.

The Net Investment Income Tax: The Rate You Might Be Forgetting

The Affordable Care Act created an additional 3.8% Net Investment Income Tax (NIIT) on investment income for higher-income taxpayers. As of 2026, the NIIT thresholds — unlike most tax figures — are not indexed for inflation. They remain fixed at:

  • $200,000 for single filers and heads of household
  • $250,000 for married filing jointly
  • $125,000 for married filing separately

The NIIT applies to the lesser of: (1) your net investment income, or (2) the amount by which your Modified AGI exceeds the threshold above. It is calculated on Form 8960 and is owed in addition to regular capital gains tax.

Net investment income includes capital gains, dividends, interest, rental income, and passive business income. It does not include wages, active business income, or Social Security benefits. Because the thresholds haven't been inflation-adjusted since 2013, an increasing share of upper-middle-income households now pay the NIIT — a phenomenon tax professionals call "bracket creep." Per the Congressional Budget Office, NIIT revenue has grown from $12 billion in 2014 to over $38 billion in 2024.

Effective Maximum Capital Gains Rate: Adding It All Up

For a high-income investor in 2026, the maximum effective federal capital gains rate is not 20% — it can reach 23.8%:

Rate ComponentWho Pays ItRate
Long-term capital gains (base rate)All long-term investors0%, 15%, or 20%
Net Investment Income Tax (NIIT)MAGI over $200K (single) / $250K (MFJ)+3.8%
Maximum combined federal rate20% bracket + NIIT23.8%
State capital gains tax (varies)Residents of most states0% – 13.3%
Combined federal + state max (CA)High-income CA residents37.1%

Understanding Your Cost Basis: Where Most Errors Occur

Your taxable capital gain is the difference between your adjusted cost basis and your proceeds. Most investors know this in principle, but calculating cost basis correctly is where errors actually happen — and overpaying taxes as a result.

Common Cost Basis Mistakes

  • Forgetting reinvested dividends: When a mutual fund or ETF automatically reinvests dividends into additional shares, each reinvestment is a separate purchase that increases your cost basis. Many investors forget to add these purchases, overstating their taxable gain. Your brokerage's Form 1099-B should show "covered" shares with cost basis reported to the IRS — but "uncovered" shares (typically purchased before 2011–2012) require manual tracking.
  • Ignoring improvements on real estate: Capital improvements to a rental property (new roof, HVAC system, kitchen remodel) add to your cost basis, reducing the eventual taxable gain. Per IRS Publication 551, improvements are distinguished from repairs: a repair maintains the property in its current condition; an improvement adds value or extends its useful life.
  • Inherited assets and the step-up: Assets inherited from a deceased person receive a stepped-up cost basis to their fair market value on the date of death (IRC Section 1014). If you inherit stock worth $100,000 that the decedent purchased for $20,000, your basis is $100,000 — not $20,000. Selling immediately may generate zero taxable gain.
  • Gifts and carryover basis: Assets received as gifts carry over the donor's original cost basis (with some exceptions). If your parent gifts you stock purchased for $5,000 when it's worth $30,000, your basis is $5,000 — and you'll owe capital gains on $25,000 when you sell.

Capital Gains on Specific Asset Types

Stocks and ETFs

Standard holding period rules apply. The IRS requires you to choose a cost basis method — FIFO (first in, first out), specific identification, or average cost — before selling. Specific identification gives you the most tax flexibility: you can choose to sell the shares with the highest basis first to minimize taxable gain. This election must be made at the time of the sale, not retroactively.

Real Estate and the Section 121 Exclusion

The most generous capital gains exemption in the tax code is the Section 121 home sale exclusion: up to $250,000 of gain ($500,000 for married filing jointly) is excluded from income when selling a primary residence, provided you owned and used the home as your primary residence for at least 2 of the preceding 5 years. This exclusion applies every two years and does not need to be rolled into a new purchase.

Gain exceeding the exclusion is taxed as long-term capital gain if you've owned the home more than a year. However, the portion attributable to depreciation previously claimed (for a home office or rental use) is subject to Section 1250 "unrecaptured depreciation" at a maximum 25% rate. See the Tax Implications of Selling Your Home guide for a complete walkthrough.

Cryptocurrency

The IRS treats cryptocurrency as property (IRS Notice 2014-21, confirmed repeatedly through 2025 enforcement actions). Every sale, trade, or exchange of crypto — including swapping one coin for another — is a taxable event. The holding period rules are identical to stocks: hold more than 12 months for long-term rates, 12 months or less for ordinary rates.

One critical difference: the wash sale rule (which disallows loss deductions when you repurchase a "substantially identical" security within 30 days) currently applies only to securities, not cryptocurrency, as of 2026. This means crypto investors can sell at a loss and immediately repurchase the same coin to harvest a tax loss while maintaining their position — a strategy unavailable for stocks. This gap is under active legislative scrutiny and may close in future legislation.

Tax-Loss Harvesting: Turning Losses Into Tax Savings

Tax-loss harvesting is the deliberate sale of investments at a loss to offset capital gains and reduce your tax bill. The mechanics, per IRS Publication 550:

  • Capital losses first offset capital gains of the same type (short-term losses offset short-term gains; long-term losses offset long-term gains)
  • Net losses of one type can then offset gains of the other type
  • After offsetting all capital gains, up to $3,000 of net capital losses can be deducted against ordinary income per year
  • Losses exceeding $3,000 carry forward indefinitely to future years with no expiration
  • The wash sale rule disallows the loss if you purchase a "substantially identical" security within 30 days before or after the sale (does not apply to crypto as of 2026)

Tax-loss harvesting is most valuable in years with large capital gains. A portfolio with $40,000 in long-term gains can be fully offset by $40,000 in harvested losses, saving $6,000 in federal tax at the 15% rate. Professional wealth managers routinely perform year-end harvesting; individual investors can do the same by systematically reviewing their portfolio in October and November each year.

5 Strategies to Reduce Capital Gains Tax Legally

1. Hold Assets for Long-Term Treatment

The simplest and most reliable strategy: wait until you've held an asset for more than 12 months before selling. Depending on your income bracket, this can reduce your rate from 22–37% (short-term) to 0–20% (long-term). As the worked example above showed, the difference on a $50,000 gain can exceed $4,000.

2. Manage Your Total Taxable Income

Because capital gains stack on top of ordinary income, keeping ordinary income low can keep more of your gains in the 0% or 15% bracket. Strategies include maximizing pre-tax retirement contributions (traditional 401(k), SEP-IRA), contributing to an HSA, and claiming all above-the-line deductions. A single taxpayer who reduces taxable income from $55,000 to $49,000 by contributing to a 401(k) can bring the entire long-term capital gain into the 0% bracket.

3. Harvest Losses to Offset Gains

Review your portfolio annually for positions with unrealized losses and harvest them to offset realized gains. Be mindful of wash sale rules for securities: if you want to maintain the economic exposure, you can sell the losing position and immediately purchase a similar (but not substantially identical) ETF or fund. For example, sell a specific S&P 500 index fund and buy a different S&P 500-tracking ETF to maintain market exposure.

4. Donate Appreciated Securities to Charity

One of the most tax-efficient charitable strategies: donating long-term appreciated stock directly to a qualified charity (or donor-advised fund) gives you a charitable deduction for the full fair market value while avoiding all capital gains tax on the appreciation. For example, donating stock purchased for $5,000 and now worth $25,000 saves both the $3,000 capital gains tax (at 15%) and provides a $25,000 charitable deduction — a combined benefit of $8,500 or more depending on your income tax bracket.

5. Use Opportunity Zone Investments

Qualified Opportunity Zone (QOZ) investments, established by the Tax Cuts and Jobs Act, allow investors to defer capital gains by reinvesting proceeds into a Qualified Opportunity Fund within 180 days of the sale. Deferral lasts until December 31, 2026, at which point the deferred gains become taxable. For gains recognized after 2026, appreciation in the QOZ investment held for 10+ years is permanently excluded from tax. This strategy is most appropriate for investors with large, one-time capital gains who have longer investment horizons.

Capital Gains Reporting: Forms and Process

Capital gains and losses are reported on Schedule D (Form 1040) with details on each transaction provided on Form 8949. Your brokerage will send a Form 1099-B summarizing all sales, which serves as the source for your Form 8949 entries.

  • Form 1099-B: Issued by brokers, reports proceeds, cost basis (for covered securities), and holding period
  • Form 8949: Detail form listing each transaction — short-term in Part I, long-term in Part II
  • Schedule D: Summarizes net short-term and long-term gains/losses from Form 8949; the net long-term gain flows to the Qualified Dividends and Capital Gain Tax Worksheet
  • Form 8960: Calculates Net Investment Income Tax if your MAGI exceeds the $200,000/$250,000 threshold

For frequent traders or investors with many transactions, tax software like TurboTax or H&R Block can import 1099-B data directly from major brokerages, eliminating manual entry. See the full comparison in TurboTax vs H&R Block 2026.

State Capital Gains Taxes: California, New York, and the Others

Unlike federal law, most states do not offer a preferential rate for long-term capital gains. The majority of states tax capital gains at ordinary income rates. As reported by the Tax Foundation's 2026 State Business Tax Climate Index, the states with the highest effective capital gains tax rates when combined with federal rates include California (13.3% state + 23.8% federal = 37.1%), Oregon (9.9% + 23.8% = 33.7%), Minnesota (9.85% + 23.8% = 33.65%), and New Jersey (10.75% + 23.8% = 34.55%).

The nine states with no income tax (Florida, Texas, Nevada, Wyoming, Washington, Alaska, South Dakota, Tennessee, New Hampshire) also have no state capital gains tax — a meaningful benefit for investors with large unrealized gains who have the flexibility to relocate before a major sale. However, California actively audits for "safe harbor" residency changes made immediately before large transactions, so timing and documentation matter significantly.

Frequently Asked Questions

How is capital gains tax calculated on stocks I've held for years?

Subtract your cost basis (purchase price + commissions) from your sale proceeds to get the gain. If held more than 12 months, the long-term rate (0%, 15%, or 20%) applies based on your total taxable income. That gain stacks on top of your ordinary income — wages, business income — when determining which long-term bracket applies. If your MAGI exceeds $200,000 (single) or $250,000 (MFJ), add 3.8% NIIT on top.

Can I avoid capital gains tax by reinvesting the proceeds?

Not automatically. Unlike the old "rollover" rules for home sales (eliminated in 1997), simply reinvesting proceeds into another stock or asset does not defer your capital gains. The exceptions are Qualified Opportunity Zone investments (reinvest within 180 days to defer gains until Dec 31, 2026) and certain installment sales. Reinvesting inside a 401(k) or IRA also avoids immediate recognition, but only applies to new contributions within annual limits.

Do I owe capital gains tax when I sell my house?

Probably not entirely. The Section 121 exclusion exempts up to $250,000 of gain ($500,000 for married filing jointly) when you sell a primary residence you've owned and lived in for at least 2 of the 5 years before the sale. Gain above the exclusion is taxed as long-term capital gain. If you used part of the home as a business (claimed home office depreciation or rented it), the depreciation recapture portion is taxed at up to 25%.

What is the wash sale rule and how does it affect tax-loss harvesting?

The wash sale rule disallows a capital loss deduction if you buy a "substantially identical" security within 30 days before or after the sale. The disallowed loss is added to the cost basis of the new shares (so it's not permanently lost — just deferred). To preserve the loss while maintaining market exposure, sell the losing position and purchase a similar but not identical security — for example, sell one S&P 500 ETF and buy a different S&P 500-tracking ETF. The wash sale rule currently does not apply to cryptocurrency.

What capital gains rate applies to collectibles and small business stock?

Collectibles (art, coins, wine, rugs, antiques) held more than one year are taxed at a maximum 28% rate — higher than the normal 20% maximum for other assets. Qualified Small Business Stock (QSBS) under Section 1202 can qualify for exclusion of up to 100% of gain (up to $10 million or 10x basis) if the stock was held more than 5 years and meets specific requirements. These are specialized categories requiring careful documentation.

Do capital gains affect my eligibility for ACA health insurance subsidies?

Yes, significantly. ACA premium tax credits are based on MAGI, which includes capital gains. A large capital gain in a year when you're receiving marketplace health insurance subsidies can dramatically reduce or eliminate your subsidy — and you may owe the excess back at tax time. If you receive ACA subsidies, model your capital gains carefully before selling to avoid losing thousands in premium assistance. This is one of the most common and costly "hidden" costs of large investment sales for early retirees and self-employed individuals.

Calculate Your Capital Gains Tax

Enter your purchase price, sale price, holding period, and income. See your exact tax using 2026 rates including NIIT.

Use the Capital Gains Calculator →

Related Articles