Capital Gains Tax Calculator
Estimate tax on investment profits. Compare short-term vs long-term capital gains rates. Includes Net Investment Income Tax (NIIT).
U.S. Capital Gains Tax Statistics
$1.1T
Total net capital gains reported by U.S. taxpayers in tax year 2022 — a 42% drop from the 2021 peak (IRS SOI, 2024)
73%
Of all capital gains are reported by taxpayers earning over $1 million — the top 0.3% of filers (CBO, 2024)
$250K
Primary residence capital gains exclusion for single filers ($500K married) — the most valuable individual tax break for homeowners (IRS, 2025)
Long-term capital gains are taxed at 0%, 15%, or 20% — roughly half the rate of short-term gains, which are taxed as ordinary income up to 37% (Tax Foundation, 2025). This differential creates a powerful incentive to hold investments for more than one year before selling. High-income investors also face the 3.8% Net Investment Income Tax (NIIT), bringing the maximum federal rate on long-term gains to 23.8%. Use the calculator above to estimate your capital gains tax liability. For your overall federal tax picture, see the income tax calculator. To understand how gains interact with your tax bracket, try the tax bracket calculator. Cryptocurrency investors should use our crypto tax calculator for asset-specific calculations.
How Capital Gains Tax Works
A capital gain occurs when you sell an asset — stocks, bonds, real estate, cryptocurrency, or other investments — for more than you paid for it. The difference between your purchase price (cost basis) and your sale price is your capital gain, and the IRS taxes it. Capital gains tax rates depend on two factors: how long you held the asset and your total taxable income.
The tax code creates a strong incentive to hold investments for more than one year. Short-term capital gains (assets held one year or less) are taxed at your ordinary income tax rate, which can be as high as 37%. Long-term capital gains (assets held more than one year) qualify for preferential rates of 0%, 15%, or 20% — substantially lower than ordinary income rates for most taxpayers.
Short-Term vs. Long-Term Capital Gains Rates
The holding period — calculated from the day after you purchased the asset to the day you sell it — determines which rate applies. If you hold an asset for exactly 365 days, it is still short-term. You need to hold it for at least 366 days (one year and one day) for the gain to qualify as long-term.
Short-Term Capital Gains (Held 1 Year or Less)
Short-term gains are added to your ordinary income and taxed at your regular marginal tax bracket — anywhere from 10% to 37% in 2026. This means a day trader or someone who frequently buys and sells investments within a year can face tax rates nearly double what a long-term investor pays.
Long-Term Capital Gains (Held Over 1 Year)
Long-term gains are taxed at three preferential rates based on your total taxable income (ordinary income plus capital gains):
| Tax Rate | Single Filer (Taxable Income) | Married Filing Jointly |
|---|---|---|
| 0% | Up to $48,350 | Up to $96,700 |
| 15% | $48,350 – $533,400 | $96,700 – $600,050 |
| 20% | Over $533,400 | Over $600,050 |
The 0% rate is particularly valuable for lower-income investors. A single filer with up to $48,350 in total taxable income (including the gain) pays zero federal tax on long-term capital gains. This creates opportunities for strategic tax planning, such as harvesting gains in low-income years or during early retirement before Social Security begins.
The Net Investment Income Tax (NIIT): The Hidden 3.8% Surtax
High-income investors face an additional 3.8% Net Investment Income Tax (NIIT) on top of the regular capital gains rate. This surtax applies to the lesser of your net investment income or the amount by which your modified adjusted gross income (MAGI) exceeds the threshold:
- Single filers: MAGI above $200,000
- Married filing jointly: MAGI above $250,000
- Head of household: MAGI above $200,000
With NIIT, the maximum federal tax rate on long-term capital gains is effectively 23.8% (20% + 3.8%), and the maximum on short-term gains is 40.8% (37% + 3.8%). For high-income investors in states like California (13.3% state rate), the combined rate can exceed 50%.
Net investment income includes capital gains, dividends, interest, rental income, and royalties. It does not include wages, self-employment income, Social Security benefits, or tax-exempt interest. Check your overall tax burden with our effective tax rate calculator.
Worked Example: Long-Term Capital Gain on Stock Sale
Suppose you are a single filer with $80,000 in salary. You bought 100 shares of a stock at $100 each ($10,000 cost basis) and sold them 18 months later at $180 each ($18,000 sale price). Your long-term capital gain is $8,000.
| Component | Amount |
|---|---|
| Salary (W-2) | $80,000 |
| Standard Deduction | -$15,000 |
| Ordinary Taxable Income | $65,000 |
| Long-Term Capital Gain | $8,000 |
| Total Taxable Income | $73,000 |
| LTCG Tax Rate (income under $48,350 threshold) | 15% |
| NIIT (MAGI under $200,000) | $0 |
| Capital Gains Tax Owed | $1,200 |
The $8,000 gain is taxed at 15% = $1,200. If this had been a short-term gain instead, it would have been added to ordinary income and taxed at the 22% marginal rate, costing $1,760 — $560 more. This illustrates why holding investments for over one year can be highly beneficial.
Capital Losses and the $3,000 Deduction Rule
When you sell an investment for less than you paid, you realize a capital loss. Capital losses are valuable for tax purposes because they can offset gains and reduce your tax bill:
- Losses offset gains dollar-for-dollar: Short-term losses offset short-term gains first, then excess losses offset long-term gains. Vice versa for long-term losses.
- Net losses up to $3,000 deduct against ordinary income: If your total losses exceed your total gains, you can deduct up to $3,000 ($1,500 if married filing separately) of net capital losses against ordinary income each year.
- Unused losses carry forward indefinitely: Any net losses beyond $3,000 carry over to future tax years. A $50,000 net loss in one year can offset gains and $3,000 of income for many years to come.
Tax-Loss Harvesting: A Powerful Strategy
Tax-loss harvesting is the practice of intentionally selling investments at a loss to offset realized capital gains. This strategy does not eliminate the tax — it defers it — but the time value of money makes deferral valuable, and in some cases the tax is never paid (for example, if holdings are donated to charity or passed to heirs who receive a stepped-up basis).
Here is how it works in practice: You sold Stock A for a $10,000 long-term gain. Without harvesting, you owe $1,500 in tax (at 15%). But you also hold Stock B, which has an unrealized loss of $8,000. By selling Stock B, you realize the $8,000 loss, offsetting most of the gain. Your net gain is now just $2,000, reducing your tax to $300 — a savings of $1,200.
After selling Stock B, you can reinvest the proceeds into a similar (but not "substantially identical") investment to maintain your portfolio allocation. However, you must be careful about the wash sale rule.
The Wash Sale Rule Explained
The IRS wash sale rule prevents you from claiming a tax loss on a security if you purchase a "substantially identical" security within 30 days before or after the sale (a 61-day window). If you trigger a wash sale, the loss is not gone — it is added to the cost basis of the replacement shares, effectively deferring the deduction.
Examples of wash sale triggers include:
- Selling shares of an S&P 500 ETF at a loss and buying a substantially identical S&P 500 ETF from a different provider within 30 days
- Buying back the same stock within 30 days of selling it at a loss
- Purchasing the same security in your IRA within 30 days of selling it at a loss in your taxable account
To avoid wash sales while maintaining market exposure, you can switch between asset classes (sell a total market fund, buy a large-cap fund), wait 31 days before reinvesting, or use the loss to offset gains from other positions you do not plan to repurchase.
Qualified Dividends: Capital Gains Tax Treatment
Qualified dividends are taxed at the same preferential rates as long-term capital gains (0%, 15%, or 20%), not at ordinary income rates. To qualify, dividends must be paid by a U.S. corporation or qualified foreign corporation, and you must have held the stock for at least 61 days during the 121-day period around the ex-dividend date.
Most dividends from major U.S. companies, broad market ETFs, and many international funds meet the qualified dividend criteria. Dividends that do not qualify — such as those from REITs, money market funds, and certain foreign investments — are taxed as ordinary income at your regular marginal tax bracket.
Special Capital Gains Situations
Real Estate: The $250,000/$500,000 Exclusion
When you sell your primary residence, you can exclude up to $250,000 in capital gains ($500,000 if married filing jointly) from tax — completely tax-free. To qualify, you must have owned and lived in the home for at least 2 of the 5 years before the sale. This exclusion can be used once every 2 years. Investment properties do not qualify for this exclusion but may benefit from a 1031 exchange to defer gains.
Cryptocurrency
The IRS treats cryptocurrency as property, meaning capital gains rules apply to every sale, exchange, or use of crypto. Selling Bitcoin for dollars, exchanging Ethereum for another altcoin, or using crypto to purchase goods are all taxable events. The same short-term/long-term distinction and rates apply. Crypto tax tracking can be complex because of frequent trades, hard forks, airdrops, and staking rewards.
Collectibles and Precious Metals
Long-term capital gains on collectibles (art, antiques, coins, stamps, gems, precious metals, most gold and silver ETFs) are taxed at a maximum rate of 28% — higher than the 20% maximum for stocks and bonds. Short-term gains on collectibles are still taxed at ordinary income rates.
Practical Tips to Minimize Capital Gains Tax
- Hold investments for over one year whenever possible to qualify for the lower long-term rates. The tax savings between short-term (up to 37%) and long-term (0-20%) can be substantial.
- Use tax-advantaged accounts: Gains in Roth IRAs and 401(k)s are not subject to capital gains tax. Consider holding high-growth investments in these accounts.
- Harvest losses annually: Review your portfolio at least once a year (typically in December) for tax-loss harvesting opportunities.
- Gift appreciated assets: Donating appreciated securities to charity allows you to deduct the full market value without paying capital gains tax on the appreciation.
- Take advantage of the 0% rate: In years with low income (early retirement, career transitions, sabbaticals), sell appreciated investments to realize gains at the 0% rate.
- Offset gains with the $3,000 ordinary income deduction: Even in years without gains, you can harvest $3,000 in losses to reduce your ordinary income tax.
- Use specific identification: When selling partial positions, identify the highest-cost-basis shares to minimize the gain (or maximize the loss). Most brokers support this through "specific lot" selection.
Common Capital Gains Tax Mistakes
- Selling one day too early: If you sell on day 365, the gain is short-term. Waiting one more day (day 366 or later) converts it to long-term, potentially cutting your tax rate in half.
- Ignoring cost basis: Your broker reports the sale proceeds, but you must ensure the cost basis is correct — especially for shares purchased through reinvested dividends, stock splits, or mergers. Incorrect basis means incorrect gain calculation.
- Triggering wash sales accidentally: Automatic dividend reinvestment plans (DRIPs) can trigger a wash sale if you sell shares at a loss while the DRIP buys new shares of the same stock within 30 days.
- Forgetting state taxes: Most states tax capital gains as ordinary income. In California, combined federal and state rates on short-term gains can exceed 50% for high earners.
- Not tracking crypto transactions: Every crypto-to-crypto trade is a taxable event. Failing to track these trades is a common source of IRS compliance issues.
Related Tax Calculators
Capital gains are just one piece of your overall tax situation. These related tools help you plan comprehensively:
- Income Tax Calculator — Estimate your full federal income tax, including the bracket impact of capital gains.
- Tax Bracket Calculator — Understand how gains interact with your ordinary income brackets.
- Effective Tax Rate Calculator — See your true overall tax burden including investment income.
- Self-Employment Tax Calculator — If you trade as a business, SE tax rules may apply differently.
- Paycheck Calculator — Compare your investment gains tax with your regular paycheck withholding.