Understanding Capital Gains Taxes

Capital gains tax applies when you sell an asset for more than you paid for it. The tax rate depends on how long you held the asset and your total taxable income. This calculator helps you estimate your tax liability for stocks, cryptocurrency, real estate, and other capital assets.

2025 Long-Term Capital Gains Rates

0% Rate

Single: Up to $48,350
Married Filing Jointly: Up to $96,700
Head of Household: Up to $64,750

15% Rate

Single: $48,350 - $533,400
Married Filing Jointly: $96,700 - $600,050
Head of Household: $64,750 - $566,700

20% Rate

Single: Over $533,400
Married Filing Jointly: Over $600,050
Head of Household: Over $566,700

Net Investment Income Tax (NIIT)

High earners may also owe the 3.8% Net Investment Income Tax on capital gains when their Modified Adjusted Gross Income (MAGI) exceeds $200,000 (single) or $250,000 (married filing jointly). This can bring the maximum effective rate to 23.8% for long-term gains.

How This Calculator Works

Step 1: Determine Holding Period

The calculator first determines whether your gain is short-term (held 1 year or less) or long-term (held more than 1 year). Short-term gains are taxed at ordinary income rates (10-37%), while long-term gains receive preferential rates (0%, 15%, or 20%).

Step 2: Calculate Your Gain or Loss

Your capital gain equals the sale price minus your cost basis. Cost basis includes the original purchase price plus any transaction fees, commissions, or improvements (for real estate).

Step 3: Apply Tax Brackets

Long-term gains are taxed based on your total taxable income (including the gain). The calculator "stacks" your capital gains on top of your ordinary income to determine which brackets apply.

Step 4: Calculate NIIT (if applicable)

If your MAGI exceeds the threshold ($200,000 single / $250,000 MFJ), the calculator adds 3.8% NIIT on the lesser of your net investment income or the amount by which your MAGI exceeds the threshold.

Cost Basis Methods

  • FIFO (First In, First Out): Assumes you sell your oldest shares first. Default method if you don't specify.
  • Specific Identification: You choose which specific shares to sell. Requires good record-keeping.
  • Average Cost: Available for mutual funds. Takes the average cost of all shares.

Key Capital Gains Concepts

Short-Term vs Long-Term

The distinction between short-term and long-term is one of the most important in tax law. Hold an asset for more than one year to qualify for the preferential long-term rates. The difference can be dramatic - a gain taxed at 37% (short-term for high earners) vs 20% (long-term) represents a 45% reduction in tax.

Wash Sale Rule

You cannot claim a loss if you purchase a "substantially identical" security within 30 days before or after selling at a loss. This includes buying the same stock, options on that stock, or similar securities in an IRA. The disallowed loss is added to the cost basis of the replacement shares.

Tax Loss Harvesting

Strategically selling investments at a loss to offset gains elsewhere. Losses first offset gains of the same type (short vs long), then the opposite type. Net losses up to $3,000 can offset ordinary income, with excess carrying forward indefinitely.

Primary Residence Exclusion

You may exclude up to $250,000 ($500,000 if married filing jointly) of gain from selling your primary residence if you owned and lived in it for at least 2 of the past 5 years. This is one of the most valuable tax breaks available.

Cryptocurrency Taxation

The IRS treats cryptocurrency as property. Selling, trading for another crypto, or using crypto to buy goods/services are all taxable events. Each transaction requires calculating gain/loss based on your cost basis at the time of acquisition.

Inherited Assets (Step-Up in Basis)

When you inherit assets, your cost basis is "stepped up" to the fair market value at the date of death. This can eliminate decades of unrealized gains - a major benefit for inherited stocks, real estate, and other appreciated assets.

Capital Gains Tax Strategies

Hold for Long-Term Treatment

Whenever possible, hold assets for more than one year before selling. The difference between short-term (up to 37%) and long-term rates (up to 20%) can save thousands or even tens of thousands in taxes.

Harvest Losses Strategically

Review your portfolio before year-end for loss harvesting opportunities. Sell losing positions to offset gains, then potentially repurchase after 30 days (to avoid wash sale rules) or buy similar but not identical investments immediately.

Use the 0% Bracket

If your taxable income is below $48,350 (single) or $96,700 (MFJ), you may pay 0% on long-term gains. Retirees or those in gap years can strategically realize gains during low-income periods.

Bunch Income Across Years

If you have flexibility in when to realize gains, consider your income in adjacent years. It may be better to realize gains in a year when your other income is lower.

Consider Qualified Opportunity Zones

Investing capital gains in Qualified Opportunity Zone funds can defer and potentially reduce taxes on those gains. A 10+ year hold can eliminate tax on the QOZ investment appreciation entirely.

Charitable Giving

Donating appreciated assets to charity allows you to deduct the fair market value while avoiding capital gains tax entirely. This is especially valuable for highly appreciated stock.

Installment Sales

For large sales (especially real estate), consider an installment sale to spread the gain over multiple years. This can keep you in lower tax brackets and defer NIIT.

Frequently Asked Questions

Capital Gains Tax Resources

IRS Publications

  • Publication 550: Investment Income and Expenses - comprehensive guide to capital gains reporting
  • Publication 544: Sales and Other Dispositions of Assets
  • Publication 523: Selling Your Home - explains the primary residence exclusion
  • Publication 551: Basis of Assets - detailed cost basis guidance

Tax Forms

  • Schedule D (Form 1040): Capital Gains and Losses
  • Form 8949: Sales and Other Dispositions of Capital Assets
  • Form 1099-B: Proceeds from Broker and Barter Exchange Transactions
  • Form 8960: Net Investment Income Tax

Professional Consultation

While this calculator provides estimates for tax planning, complex situations may require professional guidance. Consider consulting a CPA or tax attorney for:

  • Large real estate transactions or 1031 exchanges
  • Complex cost basis situations
  • International investments or foreign tax credits
  • Estate planning and step-up in basis strategies
  • Qualified Opportunity Zone investments