Finance

Capital Gains Tax Calculator

Calculate your capital gains tax on investments, stocks, and real estate. Estimates federal tax liability for short-term and long-term capital gains.

Holding period
$
$
$
$
$
Estimated capital gains tax
$7,500
Sale price
$150,000
Cost basis
$100,000
Capital gain
$50,000
Federal tax (15%)
$7,500
Total tax
$7,500
Effective tax rate
15.0%
Net profit after tax
$42,500

Tax breakdown

This is an estimate for federal taxes only. State taxes may apply. Consult a tax professional for personalized advice.

What is capital gains tax?

Capital gains tax is a federal tax on the profit you make when selling an asset for more than you paid for it. The "gain" is the difference between your sale price and your cost basis (original purchase price plus certain adjustments). This tax applies to investments like stocks, bonds, mutual funds, real estate, and other capital assets.

The U.S. tax code treats capital gains differently from ordinary income like wages or salary. The tax rate you pay depends on two main factors: how long you held the asset before selling (your holding period) and your total taxable income for the year. Understanding these rules can help you make smarter investment decisions and potentially reduce your tax liability through strategic planning.

Capital gains taxes only apply when you actually sell an asset and "realize" the gain. If your investments increase in value but you don't sell them, you have an "unrealized" gain that isn't taxed until you sell. This is why investors sometimes refer to holding appreciated assets as having "paper gains."

Short-term vs long-term capital gains

The IRS distinguishes between two types of capital gains based on how long you owned the asset before selling:

Short-term capital gains

If you sell an asset within one year or less of purchasing it, any profit is considered a short-term capital gain. These gains are taxed at your ordinary income tax rate, which can be as high as 37% for the highest earners. The short-term rates for 2025 are:

Tax RateSingleMarried Filing JointlyHead of Household
10%Up to $11,925Up to $23,850Up to $17,000
12%$11,926–$48,475$23,851–$96,950$17,001–$64,850
22%$48,476–$103,350$96,951–$206,700$64,851–$103,350
24%$103,351–$197,300$206,701–$394,600$103,351–$197,300
32%$197,301–$250,525$394,601–$501,050$197,301–$250,500
35%$250,526–$626,350$501,051–$751,600$250,501–$626,350
37%Over $626,350Over $751,600Over $626,350

Long-term capital gains

If you hold an asset for more than one year before selling, you qualify for preferential long-term capital gains rates. These rates are significantly lower than ordinary income rates, providing a tax incentive for long-term investing. The 2025 long-term capital gains rates are:

Tax RateSingleMarried Filing JointlyMarried Filing SeparatelyHead of Household
0%Up to $48,350Up to $96,700Up to $48,350Up to $64,750
15%$48,351–$533,400$96,701–$600,050$48,351–$300,025$64,751–$566,700
20%Over $533,400Over $600,050Over $300,025Over $566,700

The difference between short-term and long-term rates can be substantial. For example, a high earner in the 37% tax bracket would pay only 20% on long-term gains—a 17 percentage point savings. This is why tax advisors often recommend holding investments for at least one year and one day before selling.

How capital gains tax is calculated

The calculation follows a straightforward process:

Capital Gain=Net ProceedsCost Basis\text{Capital Gain} = \text{Net Proceeds} - \text{Cost Basis}

Where:

  • Net Proceeds = Sale price minus selling costs (commissions, fees, closing costs)
  • Cost Basis = Original purchase price plus capital improvements

Understanding cost basis

Your cost basis isn't always just what you paid for an asset. Several factors can adjust it:

Additions to cost basis:

  • Purchase commissions and fees
  • Capital improvements (for real estate)
  • Legal and title fees
  • Reinvested dividends (for stocks in taxable accounts)

Reductions to cost basis:

  • Depreciation taken on rental property
  • Return of capital distributions
  • Insurance reimbursements for casualty losses

For inherited assets, you typically receive a "stepped-up basis" equal to the fair market value at the time of the decedent's death, which can significantly reduce or eliminate capital gains taxes on appreciated assets.

Tax bracket stacking

An important concept is that your capital gains "stack on top" of your ordinary income when determining which tax bracket applies. For example, if you're single with $40,000 in wages and a $20,000 long-term capital gain in 2025:

  1. Your wages fill up income brackets first
  2. Your capital gain starts where your wages end ($40,000)
  3. The first $8,350 of your gain (from $40,000 to $48,350) is taxed at 0%
  4. The remaining $11,650 is taxed at 15%

This stacking effect means that even moderate-income taxpayers can sometimes owe 15% or 20% on some of their capital gains if the gains push their total income into higher brackets.

Net Investment Income Tax (NIIT)

High-income taxpayers face an additional 3.8% Net Investment Income Tax (NIIT) on top of regular capital gains taxes. This surtax applies when your modified adjusted gross income (MAGI) exceeds these thresholds:

Filing StatusMAGI Threshold
Single$200,000
Married filing jointly$250,000
Married filing separately$125,000
Head of household$200,000

The NIIT applies to the lesser of your net investment income or the amount by which your MAGI exceeds the threshold. Net investment income includes capital gains, dividends, interest, rental income, and royalties.

For example, if you're single with $220,000 in MAGI including a $50,000 capital gain, the NIIT would apply to $20,000 (the excess over $200,000), adding $760 to your tax bill ($20,000 × 3.8%).

Capital losses and tax-loss harvesting

When you sell an asset for less than your cost basis, you have a capital loss. These losses can offset your capital gains:

  1. Short-term losses offset short-term gains first
  2. Long-term losses offset long-term gains first
  3. Net losses of one type can offset gains of the other type
  4. Up to $3,000 of net capital losses can offset ordinary income
  5. Excess losses carry forward to future tax years indefinitely

Tax-loss harvesting is a strategy where you intentionally sell losing investments to realize losses that offset gains. This can reduce your current tax bill while maintaining your investment strategy by purchasing similar (but not "substantially identical") securities.

Be aware of the "wash sale" rule: if you buy substantially identical securities within 30 days before or after selling at a loss, you cannot claim the loss for tax purposes.

Special capital gains situations

Real estate

Primary residence sales may qualify for an exclusion of up to $250,000 in gains ($500,000 for married couples filing jointly) if you've owned and lived in the home for at least two of the last five years. Investment properties don't qualify for this exclusion.

Rental property sales are subject to depreciation recapture, taxed at a maximum rate of 25% on the portion of the gain attributable to depreciation deductions previously taken.

Collectibles

Long-term gains on collectibles (art, antiques, coins, precious metals) are taxed at a maximum rate of 28%, higher than the standard 20% maximum for other long-term gains.

Qualified small business stock (QSBS)

Stock in certain small businesses held for more than five years may qualify for partial or complete exclusion from capital gains tax under Section 1202, potentially saving significant taxes for entrepreneurs and early investors.

Strategies to minimize capital gains tax

Hold investments longer

The simplest strategy is holding assets for more than one year to qualify for long-term rates. The difference between paying 37% (short-term) and 20% (long-term) can be substantial.

Use tax-advantaged accounts

Investments in 401(k)s, IRAs, and other tax-advantaged accounts grow tax-deferred (traditional) or tax-free (Roth), eliminating capital gains taxes on trades within the account.

Time your sales strategically

Consider selling in years when your other income is lower, such as early retirement or a sabbatical year. This might keep your gains in the 0% or 15% bracket.

Gift appreciated assets

Gifting appreciated assets to charity allows you to deduct the fair market value while avoiding capital gains tax entirely. Gifting to family members in lower tax brackets (not children subject to kiddie tax) can also result in lower overall taxes.

Harvest losses

Strategically realize losses to offset gains in the same year, reducing your net taxable gains.

Use installment sales

For large gains, especially on real estate, an installment sale spreads the gain over multiple years, potentially keeping you in lower tax brackets.

Consider a 1031 exchange

Real estate investors can defer capital gains taxes by exchanging one investment property for another "like-kind" property under Section 1031.

State capital gains taxes

In addition to federal taxes, many states tax capital gains. Treatment varies significantly:

  • No state income tax: Alaska, Florida, Nevada, New Hampshire (interest and dividends only), South Dakota, Tennessee, Texas, Washington (though it has a separate capital gains tax), Wyoming
  • Preferential rates: Some states tax capital gains at lower rates than ordinary income
  • Full taxation: Most states tax capital gains as ordinary income

State taxes can add 3% to 13% or more to your total capital gains tax burden, depending on where you live.

Filing requirements

Capital gains and losses are reported on your federal tax return using:

  • Form 8949: Details individual transactions with dates, proceeds, cost basis, and gain/loss
  • Schedule D: Summarizes total capital gains and losses
  • Form 1040: Reports the final tax owed

Most brokerages provide Form 1099-B with transaction details, making reporting straightforward. However, you're responsible for tracking cost basis, especially for assets purchased before brokerages were required to report basis or for inherited and gifted assets.

Limitations of this calculator

This calculator provides estimates for federal capital gains taxes only. It does not account for:

  • State income taxes on capital gains
  • Local taxes (in some jurisdictions)
  • Alternative Minimum Tax (AMT) implications
  • Depreciation recapture on real estate
  • Special rates for collectibles or QSBS
  • Complex situations like wash sales or inherited assets with special basis rules

For accurate tax planning and filing, consult with a qualified tax professional who can consider your complete financial situation and applicable tax laws.