How this page is reviewed
See methodology, assumptions & sources
| Risk tier | High YMYL |
|---|---|
| Author | Calculover Editorial Team Finance and legal education |
| Editorial owner | Calculover Tax & Payroll Desk Tax and wage methodology owner |
| Reviewer | Calculover Editorial Review High-risk source and limitation review |
| Last reviewed | 2026-05-10 |
| Last verified | 2026-05-10 |
| Data effective date | 2026-01-01 |
Methodology
What Is Capital Gains Tax and How Do You Calculate It? applies the tax-rate, threshold, and taxable-base logic documented in the calculator formula section, then separates user-entered assumptions from statutory or source-linked rate inputs.
Assumptions
- What Is Capital Gains Tax and How Do You Calculate It? relies on the values the user enters and does not independently verify income, balances, legal status, policy terms, or market quotes.
- Taxable income, deductions, credits, filing status, jurisdiction, and timing are simplified to the fields available in the calculator.
- Federal, state, local, and international tax rules can change after the listed last-verified date.
Limitations
- What Is Capital Gains Tax and How Do You Calculate It? does not prepare a tax return, determine final liability, apply every credit or deduction, or account for all state, local, foreign, penalty, or surtax rules.
- Confirm current forms, thresholds, and filing obligations with the IRS, the relevant tax authority, or a qualified tax professional before filing or paying tax.
Sources
- Topic No. 409 Capital Gains and Losses, Internal Revenue Service
- Federal Income Tax Rates and Brackets, Internal Revenue Service
Professional guidance: What Is Capital Gains Tax and How Do You Calculate It? is for tax education and planning only and is not tax, legal, accounting, or filing advice. Verify current rules with the relevant tax authority or a qualified tax professional.
When you sell a capital asset — including publicly traded stocks, index ETFs, cryptocurrency, private business equity, or real estate — for more than your adjusted cost basis, the resulting profit is subject to capital gains tax. However, the Internal Revenue Code splits investment gains into two completely different tax regimes based on a single strict milestone: Did your holding period strictly exceed 365 days?
Selling at 365 days or fewer triggers punitive short-term rates taxed as ordinary income up to 37% (plus state taxes and potential payroll/surtaxes). Waiting until day 366 unlocks preferential long-term capital gains rates of 0%, 15%, or 20%. Understanding how capital gains layer onto your ordinary income, how the 3.8% Net Investment Income Tax (NIIT) activates, and how to harness tax-loss harvesting can preserve tens of thousands of dollars across your investing lifetime.
Tax & Investment Precision Calculators
Model after-tax portfolio growth, adjusted cost basis, and federal tax brackets in seconds.
Short-Term vs. Long-Term Mechanics #
The distinction between short-term and long-term gains is one of the most asymmetric tax advantages available to individual investors under the Internal Revenue Code:
| Holding Period | IRS Classification | Applicable Tax Schedule | Top Federal Rate (2026) |
|---|---|---|---|
| 1 Year or Less (≤ 365 Days) | Short-Term Capital Gain | Taxed at ordinary marginal income tax brackets (10%, 12%, 22%, 24%, 32%, 35%, 37%). | 37.0% (+ 3.8% NIIT = 40.8%) |
| More Than 1 Year (> 365 Days) | Long-Term Capital Gain | Taxed at preferential statutory rates (0%, 15%, or 20%) under IRC § 1(h). | 20.0% (+ 3.8% NIIT = 23.8%) |
Because long-term capital gains stack on top of your ordinary wage income, your ordinary taxable income establishes the starting threshold from which your capital gains brackets begin. If your ordinary income already pushes you into the 15% or 20% capital gains bracket, your realized gains are taxed at that higher tier.
Interactive Capital Gains Tax & Liability Simulator #
Explore how different filing profiles, salary baselines, and capital gains amounts interact across the 2026 tax brackets, contrasting the immediate savings of holding long-term versus short-term:
2026 Capital Gains Tax & Savings Simulator
Select a taxpayer profile to evaluate federal tax liabilities, 0% bracket headroom, and short-term penalty costs.
| Filing Scenario | Capital Gain | Long-Term Tax | Short-Term Tax | Tax Savings | Effective Rate |
|---|---|---|---|---|---|
| Middle Couple ($120k Salary) | $40,000 | $6,000 | $8,800 | $2,800 | 15.0% |
| Coast FIRE ($30k Pension) | $50,000 | $0 | $5,800 | $5,800 | 0.0% |
| High Executive ($320k Salary) | $100,000 | $18,800 | $35,000 | $16,200 | 18.8% |
| Asset Sale ($180k Base) | $600,000 | $121,800 | $222,000 | $100,200 | 20.3% |
2026 Federal Capital Gains Tax Brackets #
The IRS adjusts statutory federal long-term capital gains thresholds annually for inflation under Revenue Procedure 2025-32. Below are the official inflation-adjusted brackets for the 2026 tax year:
| Tax Rate | Single Filers | Married Filing Jointly | Head of Household | Married Filing Separately |
|---|---|---|---|---|
| 0% Rate | Up to $48,350 | Up to $96,700 | Up to $64,750 | Up to $48,350 |
| 15% Rate | $48,351 to $533,400 | $96,701 to $600,050 | $64,751 to $566,700 | $48,351 to $300,025 |
| 20% Rate | Over $533,400 | Over $600,050 | Over $566,700 | Over $300,025 |
Capital gains are added to taxable income after ordinary income (wages, interest, non-qualified dividends). For example, if a married couple has $70,000 of taxable wage income and realizes a $40,000 long-term capital gain, the first $26,700 of the gain fills the remaining 0% bracket up to $96,700, incurring $0 tax. Only the remaining $13,300 is taxed at the 15% rate ($1,995 total tax).
Asset & Transaction Taxation Matrix #
Not all capital assets follow identical tax schedules. Real estate, digital currencies, and precious metals each have bespoke statutory rules and exclusions:
| Asset Category | Long-Term Tax Treatment | Special Exclusions & Rules | Key Optimization Strategy |
|---|---|---|---|
| Equities & ETFs Public Equities & Funds Index funds, individual stocks, mutual funds, corporate debt | 0%, 15%, or 20% statutory rates based on combined taxable income, plus 3.8% NIIT if MAGI threshold met. | Subject to 30-day Wash-Sale Rule (IRC § 1091). Dividends taxed separately (Qualified at LTCG rates; Ordinary at regular income). | Tax-loss harvest losing positions to offset realized gains and up to $3,000 in ordinary wage income annually. |
| Real Estate Primary & Investment Property Residential homes, rental units, commercial land | Primary homes: Section 121 Exclusion shields profit. Rentals: 15% or 20% LTCG + 25% depreciation recapture. | Section 121: Exclude up to $250,000 (Single) or $500,000 (MFJ) profit if owned & used as primary home for 2 of last 5 years. | Execute IRC § 1031 Like-Kind Exchanges on commercial/rental properties to defer 100% of capital gains and recapture tax. |
| Crypto & Digital Cryptocurrency & NFTs Bitcoin, Ethereum, digital tokens, tokenized assets | Treated as property under IRS Notice 2014-21. Held > 365 days qualifies for 0%, 15%, or 20% LTCG rates. | Every crypto-to-crypto swap is an immediate taxable realization event. Staking & mining rewards are ordinary income upon receipt. | Track granular cost-basis lots using Specific Identification (HIFO — Highest-In, First-Out) to minimize realized gains on liquidation. |
| Collectibles Precious Metals & Art Physical gold/silver bullion, coins, fine art, rare wines, antiques | Subject to a maximum statutory federal rate of 28% under IRC § 1(h)(4) if held longer than 1 year. | Short-term sales taxed at ordinary rates. Physical metal ETFs (like GLD/SLV) are taxed as collectibles, NOT standard securities! | Hold gold and silver exposure within Self-Directed Traditional or Roth IRAs to shelter profits from the 28% collectibles penalty. |
The 3.8% Net Investment Income Tax (NIIT) #
Under Section 1411 of the Internal Revenue Code, high-earning taxpayers are assessed an additional 3.8% Net Investment Income Tax (NIIT). Unlike statutory capital gains brackets, NIIT thresholds are NOT indexed for inflation, ensnaring more households each year:
- Single & Head of Household: $200,000 Modified Adjusted Gross Income (MAGI)
- Married Filing Jointly: $250,000 Modified Adjusted Gross Income (MAGI)
- Married Filing Separately: $125,000 Modified Adjusted Gross Income (MAGI)
The surtax applies to the lesser of your total Net Investment Income (capital gains, dividends, taxable interest, passive rental income) or the amount by which your MAGI exceeds the statutory threshold.
Standard Top Long-Term Bracket: 20.0% + Net Investment Income Surtax: 3.8% = Top Federal Capital Gains Rate: 23.8% Middle Bracket with NIIT: 15.0% + 3.8% = 18.8% 4 Proven Strategies to Minimize Capital Gains #
High-net-worth investors utilize specific provisions in the tax code to legally defer, reduce, or completely eliminate capital gains liabilities:
Tax-Loss Harvesting
Deliberately selling losing positions to generate capital losses that neutralize realized capital gains dollar-for-dollar across your taxable portfolio.
| Gain Offset | Dollar-for-Dollar (100%) |
| Ordinary Income Cap | $3,000 / tax year |
| Carryforward Period | Indefinite (Lifetime) |
| Critical Guardrail | 30-Day Wash-Sale Rule |
Takeaway: If you realize $25,000 in gains and harvest $28,000 in losses, your net capital gains tax is $0 and you deduct the excess $3,000 from W-2 salary.
0% Bracket Gain Harvesting
Systematically liquidating appreciated positions during low-income gap years (sabbaticals, early retirement, business launch) up to the 0% threshold.
| 2026 Single Ceiling | $48,350 Taxable Income |
| 2026 MFJ Ceiling | $96,700 Taxable Income |
| Federal Tax Rate | 0.0% Exact |
| Immediate Rebuy | Permitted (Resets Basis) |
Takeaway: Unlike tax-loss selling, the wash-sale rule does NOT apply to gains. You can sell at a profit, pay 0% tax, and rebuy immediately to reset basis higher.
Asset Location Optimization
Placing tax-inefficient assets (REITs, high-yield bonds, active trading strategies) into Roth and 401(k) accounts while placing index ETFs in taxable accounts.
| Broad Index ETFs | Taxable Brokerage |
| REITs & Corporate Bonds | Traditional 401(k) / IRA |
| High-Growth Stocks | Roth IRA (Tax-Free Exit) |
| Dividend Drag Shield | Eliminates Yearly Tax Drag |
Takeaway: Broad index funds generate minimal capital gain distributions, allowing your money to compound untaxed until you decide to sell.
Step-Up Basis & Gifting
Utilizing statutory basis resets at death under IRC § 1014 or donating appreciated shares directly to donor-advised funds or registered 501(c)(3) charities.
| Stepped-Up Basis | Resets to FMV at Death |
| Charitable Donation | 0% Tax + Full FMV Deduction |
| Lifetime Gift Exemption | Carryover Basis Applies |
| Section 1014 Benefit | 100% Paper Gains Erased |
Takeaway: Donating appreciated stock avoids capital gains tax entirely and provides a full fair-market-value itemized tax deduction on Schedule A.
Worked Tax Calculations (Stocks & Real Estate) #
Worked Example 1: Multi-Year Index Fund Liquidation
A married couple filing jointly reports $120,000 in ordinary taxable salary. They sell shares in an S&P 500 index fund purchased 5 years ago, generating a $50,000 realized gain.
- Holding Period Check: 5 years (> 365 days) (rightarrow) Qualifies as a Long-Term Capital Gain.
- Total Taxable Income: ($120,000 + $50,000 = $170,000).
- Bracket Stacking: The couple's $120,000 salary exceeds the $96,700 0% ceiling. Therefore, the entire $50,000 gain sits comfortably inside the 15% bracket ($96,701 to $600,050).
- NIIT Evaluation: Combined MAGI is $170,000, well below the $250,000 MFJ threshold (rightarrow) $0 NIIT owed.
- Total Federal Tax: ($50,000 × 0.15 = $7,500).
- Short-Term Contrast: Had they sold at 11 months, the $50,000 gain would have been taxed at their 22% marginal ordinary income rate, costing $11,000 — an unforced $3,500 tax penalty.
Worked Example 2: Primary Residence Sale (Section 121)
A single homeowner purchased a home in 2019 for $350,000. In 2026, they sell the home for $720,000 after living in it continuously as their primary residence for 7 years. Over the years, they invested $40,000 in un-repaired capital renovations (new roof, kitchen remodel). Selling costs and broker fees total $35,000.
- Adjusted Cost Basis: ($350,000 (Purchase) + $40,000 (Improvements) = $390,000).
- Net Realized Amount: ($720,000 - $35,000 (Closing Costs) = $685,000).
- Gross Realized Gain: ($685,000 - $390,000 = $295,000).
- Section 121 Primary Exclusion: Because they met the 2-out-of-5-year occupancy requirement, the first $250,000 of gain is completely excluded from federal income taxation.
- Taxable Capital Gain: ($295,000 - $250,000 = $45,000).
- Tax Calculation: The remaining $45,000 is taxed at the 15% long-term rate ($6,750), shielding 85% of their substantial real estate equity tax-free.
Tax-Loss Harvesting & The Wash-Sale Rule #
Tax-loss harvesting converts market downturns into tax savings by realizing losses to offset taxable gains. However, the IRS enforces strict accounting mechanics through IRC § 1212 and the Wash-Sale Rule (IRC § 1091):
- Netting Hierarchy: Short-term losses offset short-term gains first. Long-term losses offset long-term gains first. Net remaining losses in either bucket can then offset the other.
- The $3,000 Ordinary Income Deduction: If net total capital losses exceed total capital gains, up to $3,000 per year ($1,500 if married filing separately) can be deducted directly against ordinary wage income on Form 1040.
- Indefinite Carryforward: Unused capital losses never expire; they carry forward to subsequent tax years indefinitely until fully absorbed.
If you sell a security at a loss and acquire a "substantially identical" security within a 61-day window (30 days before the sale, the date of sale, or 30 days after the sale), the loss is strictly disallowed. The disallowed loss is added to the cost basis of the new position, postponing the tax benefit until the newly acquired position is sold.
Costly Capital Gains Tax Traps #
Avoid these four widespread execution errors that lead to unexpected IRS deficiency notices and unnecessary tax drag:
The 365-Day Calendar Cliff
Selling an asset on the exact 365th day from purchase believing it qualifies for preferential long-term capital gains brackets.
The Law: The tax code requires your holding period to strictly exceed one year. You must hold for at least 366 full days (purchase date + 366 days). Liquidating on day 365 triggers ordinary income tax rates up to 37%.
IRA Wash-Sale Permanent Disallowance
Selling stock at a loss in a taxable brokerage and repurchasing the same stock inside a Roth IRA or 401(k) to skirt the wash-sale rule.
The Law: Under Revenue Ruling 2008-5, a wash sale triggered inside an IRA permanently destroys the loss deduction. Unlike taxable accounts where the loss adds to basis, basis adjustments are impossible in an IRA — the loss is vaporized forever.
Unadjusted Basis & Double Taxation
Calculating stock basis using only initial purchase prices, ignoring reinvested dividends, stock splits, and return-of-capital distributions.
The Law: Reinvested dividends were already taxed in the year paid. Failing to add them to your cost basis causes you to pay tax a second time on the exact same earnings upon liquidation.
Ignoring State Capital Gains Levies
Assuming that federal 0% or 15% long-term rates mean state capital gains taxes will be equivalently low or non-existent.
The Law: Most states tax capital gains as standard wage income without preferential rates (e.g. California up to 13.3%, New York up to 10.9%). Combined federal and state rates can exceed 37% even on long-term assets.
Frequently Asked Questions #
Do I have to pay capital gains tax on stocks I haven't sold?
No. Under the realization doctrine of the U.S. tax code, capital gains tax is only triggered when a sale, trade, or disposition occurs. Unrealized gains (paper profits on assets you still own) compound 100% tax-free until you execute a liquidation event.
How is cryptocurrency taxed under capital gains rules?
Under IRS Notice 2014-21, digital assets and cryptocurrencies are classified as property. Trading Bitcoin for Ethereum, converting crypto to US dollars, or using crypto to buy physical goods are all realization events triggering short-term or long-term capital gains based on your acquisition holding period.
Can capital losses offset ordinary wage income?
Yes. Capital losses offset capital gains dollar-for-dollar. If net capital losses exceed total capital gains, you can deduct up to $3,000 per year against ordinary W-2 income ($1,500 if married filing separately). Any remaining net losses roll forward indefinitely into future tax years.
What is the 3.8% Net Investment Income Tax (NIIT)?
Under IRC § 1411, higher-income taxpayers pay an additional 3.8% surtax on investment income (capital gains, dividends, passive rentals) to the extent their Modified Adjusted Gross Income exceeds $200,000 for single filers or $250,000 for married couples filing jointly.
What is the "step-up in basis" upon death?
Under IRC § 1014, inherited taxable assets receive a new cost basis equal to the fair market value on the deceased owner's date of death. This permanently erases all lifetime capital gains tax liability for the heirs.
Primary Sources & Citations #
- Internal Revenue Service. (2025). IRS Revenue Procedure 2025-32: 2026 Inflation Adjustments & Statutory Tax Brackets. Washington, D.C.
- Internal Revenue Code. 26 U.S. Code § 1(h) - Maximum capital gains rate and 26 U.S. Code § 1411 - Net investment income tax.
- Internal Revenue Service. (2014). IRS Notice 2014-21: Guidance on the Tax Treatment of Virtual Currencies.
- Joint Committee on Taxation. (2024). Overview of the Federal Tax Treatment of Capital Gains and Capital Losses (JCX-18-24).
- Congressional Research Service. (2025). Capital Gains Taxation: Economic Analysis and Current Policy Debates.
Our team of financial analysts, CPAs, and software engineers designs precision calculation tools and evidence-based tax guides. Every article is rigorously peer-reviewed against primary IRS statutory publications and validated for computational accuracy. Learn about our editorial standards.
Looking for more? Browse all free financial resources including interactive guides, calculators, and tax comparisons.