Capital Gains Tax

Estimate tax on profits.

2025 Capital Gains Tax Calculator Overview

The capital gains tax calculator computes the federal tax you owe when you sell a capital asset — stocks, bonds, mutual funds, real estate, business interests, collectibles — at a profit. The tax rate depends on two factors: how long you held the asset and your total taxable income. Getting this calculation right before you sell can save thousands of dollars through strategic timing and loss harvesting.

The IRS distinguishes between two types of capital gains:

  • Short-term capital gains (STCG): Profits on assets held for one year or less. Taxed as ordinary income — the same rate as wages, up to 37% in 2025. There is no preferential rate for short-term gains.
  • Long-term capital gains (LTCG): Profits on assets held for more than one year. Taxed at preferential rates of 0%, 15%, or 20% depending on your taxable income, per the IRS capital gains tax topic. Most middle-income investors pay the 15% rate; the 0% rate applies to those in lower income brackets.

2025 Long-Term Capital Gains Tax Brackets:

  • 0%: Single filers with taxable income up to $48,350; Married filing jointly up to $96,700; Head of household up to $64,750
  • 15%: Single $48,350–$533,400; MFJ $96,700–$600,050; HoH $64,750–$566,700
  • 20%: Single above $533,400; MFJ above $600,050; HoH above $566,700

Additionally, high-income taxpayers owe the 3.8% Net Investment Income Tax (NIIT) on the lesser of net investment income or the amount by which MAGI exceeds $200,000 (single) or $250,000 (MFJ), per IRS NIIT guidance. This means the effective maximum LTCG rate is 23.8% (20% + 3.8%) for the highest earners — still dramatically lower than the 37% ordinary income rate on short-term gains.

For Canadian investors, capital gains are subject to the Canada Revenue Agency inclusion rate rules — currently 50% for individuals (up to $250,000 of annual capital gains) and 67% above that threshold (following the 2024 federal budget change), included in ordinary income and taxed at your marginal provincial + federal rate. See CRA capital gains guidance.

Capital Gains Tax Formula and Calculation Method

Capital gains tax is calculated in four steps: determine the holding period, compute the gain, apply the applicable rate (which may be split across brackets), and add the NIIT if applicable.

Step 1 — Capital Gain
Capital Gain = Sale Price − Adjusted Cost Basis
Adjusted Cost Basis = Purchase Price + Commissions + Improvements − Depreciation

Step 2 — Holding Period Classification
Short-term: Held ≤ 365 days → taxed at ordinary income rates (10%–37%)
Long-term: Held > 365 days → taxed at 0%, 15%, or 20% (2025 brackets)

Step 3 — 2025 LTCG Rate Application (Single Filer)
0% on gain that falls within taxable income ≤ $48,350
15% on gain within taxable income $48,350–$533,400
20% on gain above $533,400

Step 4 — Add NIIT if MAGI > $200,000 (single) or $250,000 (MFJ)
NIIT = 3.8% × min(net investment income, MAGI − threshold)

Total Tax = Ordinary Income Tax + LTCG Tax + NIIT

Worked Example — Single Filer, $95,000 Ordinary Income, $50,000 Long-Term Gain:

  • Taxable income before gain: $95,000 − $15,000 standard deduction = $80,000
  • Total taxable income with gain: $80,000 + $50,000 = $130,000
  • LTCG stacks on top of ordinary income: the $80,000 of ordinary income fills brackets up to $80,000; the $50,000 LTCG sits between $80,000 and $130,000
  • 0% LTCG bracket: $48,350 threshold. The ordinary income of $80,000 already exceeds this, so none of the $50,000 gain qualifies for the 0% rate.
  • 15% LTCG bracket: all $50,000 of gain falls between $80,000 and $533,400 → 15% × $50,000 = $7,500
  • NIIT: MAGI = $130,000 < $200,000 threshold → $0 NIIT
  • Total LTCG tax: $7,500

Compare to short-term treatment: $50,000 STCG added to $80,000 ordinary income would push total taxable income to $130,000. The portion from $103,350 to $130,000 ($26,650) is taxed at 22%, and the portion from $80,000 to $103,350 ($23,350) is also at 22%. Short-term tax ≈ $50,000 × 22% = $11,000. The long-term rate saves $3,500 — on a $50,000 gain, holding one extra day past the one-year mark could be worth thousands in reduced taxes.

How to Calculate Your Capital Gains Tax

Use these steps to accurately calculate your capital gains tax before selling an asset.

  1. Determine your cost basis. The cost basis is what you paid for the asset, adjusted for certain events. For stocks, it is the purchase price plus commissions. For inherited assets, the basis is "stepped up" to the fair market value on the date of the decedent's death — a major tax advantage. For gifted assets, it is typically the donor's original basis (carryover basis). For real estate, the original purchase price is adjusted for improvements and depreciation. Your brokerage firm is required to track and report cost basis on Form 1099-B for covered securities (generally those purchased after 2011).
  2. Compute the gross gain or loss. Gain = Proceeds − Adjusted Basis. If you sold 100 shares at $85 each that you purchased at $42, the gain is (100 × $85) − (100 × $42) = $8,500 − $4,200 = $4,300. If you received dividends that were automatically reinvested, each reinvestment lot has its own purchase price and holding period.
  3. Determine the holding period. Count from the day after purchase to and including the date of sale. The IRS uses a strict day-counting rule: if you bought on March 15, 2024 and sold on March 15, 2025 — exactly 365 days — the gain is SHORT-term. You must hold until March 16, 2025 for long-term treatment. Brokerage platforms typically display the holding period alongside each position.
  4. Net gains against losses (tax-loss harvesting). Short-term losses offset short-term gains first, then long-term gains. Long-term losses offset long-term gains first, then short-term gains. Net losses up to $3,000/year can offset ordinary income (wages, etc.); excess losses carry forward to future years. Example: $15,000 LTCG and $10,000 in realized LTCL → net LTCG of $5,000 is taxable.
  5. Estimate your taxable income for the year. Enter your expected W-2 wages, business income, other investment income, and deductions. The calculator needs your ordinary income to determine where the capital gain "stacks" in the tax bracket structure — since LTCG sits on top of ordinary income for rate purposes.
  6. Enter the gain into the calculator. Specify whether it is short-term or long-term, your filing status, and your total ordinary taxable income. The calculator applies the 2025 brackets, checks for NIIT applicability, and outputs your capital gains tax liability, effective rate, and after-tax proceeds.
  7. Review state capital gains tax. Most states do not distinguish between short- and long-term gains — both are taxed at your state ordinary income rate. California (13.3% top rate), New York (10.9%), and Oregon (9.9%) represent the highest state capital gains tax burdens. Nine states have no income tax (Florida, Texas, Nevada, etc.). Factor in your state rate for a complete picture. Canadian residents apply provincial rates per their home province.

Understanding Your Capital Gains Tax Results

Your capital gains tax calculation reveals several important metrics that should guide your selling decisions.

After-Tax Proceeds: The net amount you keep after federal and state capital gains tax. On a $100,000 gain for a California single filer in the 15% LTCG bracket, federal LTCG tax is $15,000 and California state tax is ~$13,300 — leaving after-tax proceeds of $71,700. This is the actual wealth created by the sale. For a short-term gain at the same income level, federal tax would be ~$22,000 (22% bracket), making the long-term after-tax proceeds $18,600 more simply by waiting past the one-year mark.

Marginal vs. Effective LTCG Rate: If your gain spans multiple brackets (e.g., part at 0% and part at 15%), your marginal rate is 15% but your effective rate on the total gain is lower. The calculator shows both. A single filer with $30,000 in ordinary taxable income and a $40,000 LTCG: the first $18,350 of gain fills the 0% bracket ($48,350 − $30,000), and the remaining $21,650 is taxed at 15%. Effective LTCG rate = $3,247.50 ÷ $40,000 = 8.1%.

The 0% Bracket Opportunity: Single filers with taxable income below $48,350 and married filers below $96,700 pay zero federal tax on long-term capital gains. This creates a powerful planning opportunity: in years with low income (early retirement before Social Security, business loss years, years of high deductions), deliberately harvesting long-term gains at 0% resets your cost basis to the current higher price, permanently reducing future taxable gains. This strategy — "gain harvesting" — is the inverse of tax-loss harvesting.

Collectibles and Unrecaptured Section 1250 Gain: Special rates apply to certain asset types. Gains from collectibles (coins, art, antiques) are taxed at a maximum of 28% even for long-term holdings. Unrecaptured Section 1250 gain (depreciation recapture on real property) is taxed at a maximum of 25% — not the preferential 0/15/20% rates. The calculator flags these special categories based on asset type input.

Wash-Sale Rule Impact: If you sell a security at a loss and repurchase the same or substantially identical security within 30 days before or after the sale, the IRS wash-sale rule disallows the loss. The disallowed loss is added to the cost basis of the repurchased shares — it is deferred, not permanently lost. Violating the wash-sale rule while pursuing tax-loss harvesting is a common and costly mistake.

Expert Capital Gains Tax Minimization Strategies

  • Wait past one year to convert STCG to LTCG — the tax savings can be enormous. For a high-income single earner in the 37% ordinary income bracket, converting a $50,000 short-term gain to long-term saves ($50,000 × (37% − 20%)) = $8,500 in federal tax by waiting one additional day past the one-year mark. Before selling a position you've held for 11 months, always check the holding-period date. Brokerage platforms display this clearly for each lot.
  • Harvest losses annually to offset gains. Review your taxable portfolio every November and December for unrealized losses that can be realized to offset current-year gains. A $20,000 loss harvested against a $20,000 LTCG saves $3,000 (at 15%) to $5,600 (at 23.8% with NIIT) in federal tax. Immediately reinvest in a similar (but not substantially identical) fund to maintain market exposure. For example, sell a Vanguard S&P 500 ETF at a loss and immediately buy a Schwab S&P 500 ETF — similar exposure, no wash-sale violation.
  • Use the 0% LTCG bracket strategically in low-income years. If your income drops below $48,350 (single) or $96,700 (MFJ) in any year — due to early retirement, sabbatical, or high deductions — sell appreciated assets with no federal capital gains tax. A retiree in their early 60s before Social Security claiming might have $40,000 in income and a $48,350 LTCG threshold, allowing them to harvest $8,350 in gains completely tax-free. Repeat this annually over multiple low-income years to systematically reset cost basis.
  • Donate appreciated securities directly to charity. If you intend to make charitable contributions, donate appreciated long-term securities directly rather than selling first and donating cash. You avoid the capital gains tax entirely and still get a full fair-market-value charitable deduction. On a stock with a $0 basis worth $10,000, you avoid $1,500 in LTCG tax (at 15%) and deduct $10,000 — a dual tax benefit worth $1,500 in saved LTCG tax plus $2,200+ in income tax deduction (at 22% marginal rate).
  • Consider a charitable remainder trust for large appreciated positions. A CRT allows you to contribute a large appreciated asset, avoid immediate capital gains tax at transfer, take a partial charitable deduction, and receive an income stream for life or a term of years. The remaining assets go to charity at death. For someone with $1,000,000 of low-basis stock, a CRT can defer $150,000–$200,000 in capital gains tax while generating lifetime income and a charitable deduction of $200,000–$400,000 depending on the trust structure.
  • Leverage Opportunity Zone (QOZ) investments to defer and reduce LTCG. Gains reinvested in a qualified opportunity zone fund within 180 days of realization defer federal tax until 2026 (or earlier sale). Additionally, gains held in the QOZ fund for 10+ years are permanently excluded from federal tax. A $200,000 capital gain reinvested in a QOZ fund in 2025 defers the $30,000 LTCG tax due until 2026, and any new gains on the QOZ investment itself over 10 years are permanently tax-free per IRS Opportunity Zone guidance.

Short-Term vs Long-Term Capital Gains Tax Rates (2026)

The IRS divides capital gains into two categories based on how long you held the asset before selling. Short-term capital gains apply to assets held for one year or less and are taxed at your ordinary income tax rate — the same rate you pay on wages. Long-term capital gains apply to assets held longer than one year and receive preferential tax rates of 0%, 15%, or 20% depending on your taxable income.

Filing Status0% Rate15% Rate20% Rate
SingleUp to $48,350$48,351 – $533,400Over $533,400
Married Filing JointlyUp to $96,700$96,701 – $600,050Over $600,050
Head of HouseholdUp to $64,750$64,751 – $566,700Over $566,700

Source: IRS Topic 409 — Capital Gains and Losses. Thresholds are for tax year 2025; 2026 figures are inflation-adjusted estimates.

The practical implication: if you can hold an investment for at least 366 days before selling, you could cut your tax rate from as high as 37% (top ordinary rate) down to 15% or even 0%. Use the calculator above to model your exact scenario.

Capital Gains Tax by Bracket — How Much Will I Pay?

Your capital gains tax is determined by your total taxable income, not just the gain itself. The gain "stacks" on top of your ordinary income, and only the portion that lands in each bracket is taxed at that bracket's rate.

Example: Single filer, $60,000 salary, $25,000 long-term stock gain

Total taxable income: $85,000. The first $48,350 of your gain falls in the 0% bracket (since your salary already used part of it). The remaining gain above $48,350 is taxed at 15%. Result: approximately $2,498 in capital gains tax — not $3,750 (which is what a flat 15% on $25,000 would be).

This stacking effect means that strategic timing of asset sales — spreading them across tax years — can keep more of your gains in the 0% bracket. Enter your income and gain in the calculator above to see exactly where your gain falls.

Capital Gains Tax on Real Estate and Residential Property

Real estate capital gains follow the same short-term / long-term rules as stocks, but homeowners get a powerful exclusion: Section 121 lets you exclude up to $250,000 of gain ($500,000 for married couples filing jointly) when selling a primary residence you've owned and lived in for at least 2 of the last 5 years.

For investment and rental properties, no Section 121 exclusion applies. Instead, you owe capital gains tax on the full profit plus depreciation recapture at a flat 25% rate on any depreciation you claimed (or should have claimed) during ownership.

Purchase price: $300,000 + $40,000 improvements = $340,000 adjusted basis

Sale price: $500,000 – $30,000 selling costs = $470,000 net proceeds

Gain: $470,000 – $340,000 = $130,000 capital gain

If primary residence (2+ years): $0 tax (under $250k exclusion)

If rental property: ~$19,500 at 15% + depreciation recapture

You can defer real estate capital gains using a 1031 like-kind exchange, which lets you roll the proceeds into another investment property without triggering tax. See our rental property investing guide for a complete walkthrough of 1031 exchange rules.

Source: IRS Topic 701 — Sale of Your Home

How to Calculate Capital Gains on Stocks

Stock capital gains are calculated as: Sale Price − Cost Basis = Capital Gain (or Loss). Your cost basis includes the purchase price plus any commissions or fees paid to acquire the shares.

If you bought shares at different times (multiple lots), you can choose which shares to sell using specific identification — telling your broker exactly which lot to sell. Without specific identification, brokers default to FIFO (first in, first out), which sells your oldest shares first.

This matters because selling your highest-cost-basis shares first minimizes your taxable gain. For example:

Lot 1: 100 shares bought at $50 (basis: $5,000)

Lot 2: 100 shares bought at $80 (basis: $8,000)

Current price: $100. Selling 100 shares at $100 = $10,000 proceeds.

FIFO (Lot 1): $10,000 − $5,000 = $5,000 gain

Specific ID (Lot 2): $10,000 − $8,000 = $2,000 gain

Tax-loss harvesting is another strategy: selling losing positions to offset gains. You can deduct up to $3,000 of net capital losses against ordinary income per year, with any excess carried forward. Use the calculator above to model different sale scenarios and see the tax impact of each. See our stock return calculator to estimate pre-tax returns.

Source: IRS Publication 550 — Investment Income and Expenses

Capital Gains Tax Rates for Trusts and Estates

Trusts and estates hit the top 20% long-term capital gains rate at much lower income thresholds than individuals. For 2025, a trust reaches the 20% bracket at just $15,450 of taxable income (vs. $533,400 for a single filer). This compressed bracket structure means trusts pay significantly more capital gains tax on the same dollar amount of gains.

The workaround: distributing gains to beneficiaries. When a trust distributes capital gains (if the trust document allows it), those gains are taxed at the beneficiary's individual rate — usually a much lower bracket. This strategy requires careful trust document review and is one area where working with a tax advisor pays for itself. Use the calculator above to compare tax on gains at trust-level vs. individual rates.

Capital Gain Tax Formula and Computation

The complete capital gains tax computation follows these steps:

Step 1: Calculate Adjusted Basis = Purchase Price + Improvements + Acquisition Costs

Step 2: Calculate Net Proceeds = Sale Price − Selling Costs (commissions, fees)

Step 3: Capital Gain = Net Proceeds − Adjusted Basis

Step 4: Determine holding period: ≤ 1 year = short-term; > 1 year = long-term

Step 5: Stack the gain on your ordinary income to find applicable tax bracket

Step 6: Apply the rate: short-term gains at ordinary rates; long-term at 0%/15%/20%

Step 7: Add 3.8% Net Investment Income Tax (NIIT) if MAGI exceeds $200,000 single / $250,000 married

The Net Investment Income Tax is often overlooked. High-income taxpayers effectively pay 18.8% or 23.8% on long-term gains, not the headline 15% or 20%. The calculator above accounts for NIIT automatically when you enter your total income.

Sources: IRS Topic 409, IRS Net Investment Income Tax

Frequently Asked Questions About Capital Gains Tax

What are the 2025 long-term capital gains tax rates?

In 2025, long-term capital gains (assets held more than one year) are taxed at three federal rates. The 0% rate applies to single filers with taxable income up to $48,350 and married filing jointly up to $96,700. The 15% rate applies to single filers with income between $48,350 and $533,400 (MFJ: $96,700–$600,050). The 20% rate applies above those thresholds. High-income filers also owe an additional 3.8% Net Investment Income Tax, bringing the effective maximum federal rate to 23.8%. See IRS Topic 409 for authoritative detail.

What is the difference between short-term and long-term capital gains?

Short-term capital gains are profits on assets held for one year or less and are taxed as ordinary income — the same rates as wages (10%–37% in 2025). Long-term capital gains are profits on assets held for more than one year and are taxed at preferential 0%, 15%, or 20% federal rates. The holding period determination is strict: an asset must be held for more than 365 days — not equal to 365 days — to qualify for long-term treatment.

Do capital gains affect my ordinary income tax bracket?

Capital gains themselves are not taxed at ordinary income rates (for long-term), but they do increase your adjusted gross income and can push your ordinary income into higher brackets. They also affect IRMAA Medicare surcharges, the taxability of Social Security benefits, eligibility for certain deductions, and the NIIT threshold. It is important to model capital gains in the context of your total income picture, not in isolation.

What is the capital gains tax rate on home sales?

Home sale gains qualify for a major exclusion under IRS Section 121: single filers can exclude up to $250,000 of gain; married filing jointly can exclude up to $500,000, provided the home was your primary residence for at least 2 of the last 5 years. Gains above the exclusion are taxed as long-term capital gains if the home was held for more than one year. A couple selling a home for $1,200,000 with a $400,000 basis and a $500,000 exclusion owes LTCG tax on ($800,000 gain − $500,000 exclusion) = $300,000, taxed at their applicable LTCG rate. Depreciation previously deducted (for home office or rental use) is subject to 25% unrecaptured Section 1250 recapture tax, not the standard LTCG rates.

How do I report capital gains on my tax return?

Capital gains are reported on Schedule D (Form 1040) and the details of each transaction on Form 8949. Your brokerage provides a consolidated Form 1099-B in February with all proceeds, cost basis (for covered securities), and holding period information. Short-term gains go to Part I of Schedule D; long-term gains to Part II. The net gain flows to Form 1040 line 7. If you have NIIT liability, report it on Form 8960.

Formula verified June 2026

Checked against IRS 2026 capital gains brackets & Net Investment Income Tax rules by our editorial team.

How we verify our math →