Calculate taxes on stocks, crypto, and real estate with NIIT, short/long-term rates, and cost basis methods
Updated January 2025
2025 Tax Brackets
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
Short-term gains apply to assets held one year or less and are taxed at ordinary income rates (10-37%). Long-term gains apply to assets held more than one year and receive preferential rates of 0%, 15%, or 20% depending on your taxable income. The holding period is calculated from the day after purchase to the sale date.
The NIIT is an additional 3.8% tax on investment income (including capital gains) for high earners. It applies when your Modified AGI exceeds $200,000 (single), $250,000 (MFJ), or $125,000 (MFS). The tax is calculated on the lesser of net investment income or the amount by which MAGI exceeds the threshold.
The IRS treats cryptocurrency as property. Taxable events include: selling crypto for cash, trading one crypto for another, using crypto to buy goods/services, and receiving crypto as income. Each transaction requires calculating gain/loss based on your cost basis. The same short-term/long-term rules apply based on holding period.
The wash sale rule prevents you from claiming a tax loss if you purchase substantially identical securities within 30 days before or after the sale. This includes stocks, options, and even purchases in IRAs. The disallowed loss is added to the cost basis of the replacement shares, deferring (not eliminating) the tax benefit.
Yes. Capital losses first offset gains of the same type (short-term losses offset short-term gains, long-term offset long-term). Remaining losses offset gains of the other type. If net losses exceed gains, you can deduct up to $3,000 against ordinary income. Excess losses carry forward indefinitely to future years.
For 2025, you pay 0% on long-term gains if your taxable income (including the gains) stays below $48,350 (single) or $96,700 (MFJ). This is valuable for retirees, those in gap years, or anyone with a low-income year. You can strategically realize gains to fill up the 0% bracket.
Cost basis is your original investment in an asset for tax purposes. It includes: purchase price, commissions/fees, and for real estate, closing costs and improvements. For stocks, you can use FIFO (first in, first out), specific identification, or average cost (mutual funds only). Brokerages report cost basis on Form 1099-B.
Real estate gains follow the same rules as other capital assets. However, primary residence sales may qualify for the $250,000/$500,000 exclusion if you owned and lived in the home for 2+ of the past 5 years. Investment property is subject to depreciation recapture (taxed at up to 25%) in addition to capital gains.
A 1031 exchange (like-kind exchange) allows you to defer capital gains tax on investment real estate by reinvesting proceeds into similar property. Strict rules apply: you must identify replacement property within 45 days and close within 180 days. You must use a qualified intermediary - cannot touch the funds yourself.
Most states tax capital gains as ordinary income. Nine states have no income tax (AK, FL, NV, NH, SD, TN, TX, WA, WY). California taxes capital gains up to 13.3%. Some states offer preferential rates for long-term gains. Check your state's specific rules as they vary significantly.
When you inherit assets, your cost basis is "stepped up" to the fair market value at the date of death. This eliminates all unrealized gains during the decedent's lifetime. For example, if someone bought stock for $10,000 and it's worth $100,000 at death, your basis is $100,000 - not $10,000.
Report capital gains on Schedule D using information from Form 8949. Your broker provides Form 1099-B with cost basis information. Short-term gains go in Part I, long-term in Part II. The net gain flows to Form 1040 line 7. Tax software handles this automatically when you import your 1099-B.
Qualified dividends are taxed at the same preferential rates as long-term capital gains (0%, 15%, or 20%). Ordinary (non-qualified) dividends are taxed as ordinary income. To be qualified, dividends must be from US corporations or qualified foreign corporations, and you must meet holding period requirements.
Tax-loss harvesting involves selling investments at a loss to offset gains and reduce taxes. You can then reinvest in similar (but not identical) securities to maintain your portfolio allocation. This is especially valuable at year-end but can be done anytime. Watch for wash sale rules.
Yes. If you have net capital losses, you can deduct up to $3,000 per year against ordinary income ($1,500 if married filing separately). Losses exceeding $3,000 carry forward to future years indefinitely until fully used. This makes losses valuable even without gains to offset.
Collectibles (art, antiques, coins, precious metals, stamps, wine) are taxed at a maximum rate of 28% for long-term gains - higher than the standard 20% maximum. Short-term gains on collectibles are taxed as ordinary income. NFTs may be classified as collectibles depending on their nature.
When selling depreciable property (like rental real estate), depreciation you've claimed is "recaptured" and taxed at up to 25%. This is separate from capital gains on appreciation. For example, if you claimed $50,000 in depreciation, that amount is taxed at up to 25% even if your overall gain qualifies for the 15% rate.
No. Gains within traditional IRAs, 401(k)s, and similar accounts are not taxed until withdrawal, and then they're taxed as ordinary income (not capital gains). Roth accounts grow tax-free - qualified withdrawals are completely tax-free. This is why tax-advantaged accounts are so valuable for investing.
Qualified Opportunity Zones (QOZ) are designated low-income areas where investing capital gains can provide tax benefits. Benefits include: deferral of original gain until 2026, reduction of 10% if held 5+ years, and elimination of tax on QOZ appreciation if held 10+ years. Requires investment through a Qualified Opportunity Fund.
For ISOs (Incentive Stock Options), there's no tax at exercise (though AMT may apply). When you sell, gain is taxed as capital gain if you hold 1+ year from exercise and 2+ years from grant. For NSOs (Non-Qualified Stock Options), the spread at exercise is ordinary income. Subsequent appreciation is capital gain based on holding period.
Related Tax Calculators
Explore our other tax planning tools to optimize your financial strategy.
1099 vs W-2 Calculator
Compare self-employment taxes, business deductions, and take-home pay between contractor and employee status.
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
Related Demand Letters
Based on your calculation, you may need a demand letter. Get your free template: