How to Use This Calculator
Enter the price you paid for an asset (stock, crypto, property), the price you sold it for, how long you held it, your total income for the year, and your filing status. The calculator shows your capital gain or loss and the tax you owe on it — plus a comparison of short-term vs. long-term rates to show you how much tax timing matters.
The most revealing thing to try? Add up your gains from multiple assets sold in the same year to see how they stack up against your income, then see what happens if you could have held one of them longer to qualify for long-term treatment.
Here's what each field means:
Purchase Price is how much you paid for the asset, including any fees or commissions. If you bought 100 shares of Apple at $150 per share plus a $25 trading fee, enter $15,025 total ($150 × 100 + $25).
Sale Price is how much you sold it for. Subtract your costs to sell (broker fees, etc.) from the gross proceeds. If you sold 100 shares at $175 and paid a $25 fee, your sale price is $17,475 ($175 × 100 - $25).
Holding Period determines whether the gain is short-term or long-term. Hold the asset more than 12 months to qualify for long-term rates. Hold it 12 months or less and it's taxed as ordinary income [1].
Total Annual Income matters because capital gains rates are stacked on top of your other income. Higher income pushes you into higher capital gains brackets [2].
Filing Status determines the income thresholds for capital gains rates. Single filers and married filing jointly have different breakpoints [3].
Short-Term vs. Long-Term Capital Gains: The Biggest Tax Difference
This is the single most important distinction in capital gains taxation: how long you held the asset.
Short-term capital gains are taxed at your ordinary income tax rates (10%, 12%, 22%, etc.). Hold the asset 12 months or less, and any profit is short-term [4].
Long-term capital gains are taxed at preferential rates: 0%, 15%, or 20% depending on your total income. You must hold the asset more than 12 months to qualify [5].
The difference is enormous. Consider 100 shares bought at $50 and sold at $75 — a $2,500 gain:
Scenario A: Held 10 months (short-term gain)
- If you're in the 22% federal bracket: $2,500 × 22% = $550 tax
Scenario B: Held 13 months (long-term gain)
- If you qualify for 15% rate: $2,500 × 15% = $375 tax
- Tax saved by waiting one month: $175
The waiting period is absolutely worth it unless you believe the stock will fall more than 7% in the next two months. And if you're in a lower income bracket, you might pay 0% tax on long-term gains [5].
2025 Long-Term Capital Gains Rates: Income Thresholds
Long-term gains are taxed at 0%, 15%, or 20% depending on your total taxable income:
Single Filers
- 0% rate: Income up to $48,350
- 15% rate: Income from $48,351 to $533,400
- 20% rate: Income above $533,400
Married Filing Jointly
- 0% rate: Income up to $96,700
- 15% rate: Income from $96,701 to $583,750
- 20% rate: Income above $583,750
Head of Household
- 0% rate: Income up to $64,650
- 15% rate: Income from $64,651 to $558,575
- 20% rate: Income above $558,575
The thresholds include your regular income plus capital gains, so they interact with your wages and other income [6].
Example: A single filer earns $50,000 in wages and has $10,000 in long-term capital gains:
- Total income: $60,000
- First $48,350 of gains taxed at 0%: $0 tax
- Remaining $1,650 of gains taxed at 15%: $248 tax
- Total capital gains tax: $248 (effective rate of 2.5% on the $10,000 gain)
This is why long-term capital gains are so valuable — lower-income filers might pay zero tax.
Cost Basis: What Price Did You Actually Buy At?
Cost basis is the true amount you invested in an asset. It includes:
- The purchase price
- Trading fees and commissions
- Any adjustments (like reinvested dividends)
When you sell, your gain is: Sale price - Cost basis = Capital gain
Example: You buy 100 shares of a dividend stock at $50/share:
- Stock purchase: $5,000
- Trading commission: $25
- Cost basis: $5,025
A year later, you receive dividends of $100. If your brokerage automatically reinvested them to buy shares, your cost basis increases:
- New cost basis: $5,125
You sell all 101 shares at $75 each:
- Sale proceeds: $7,575
- Cost basis: $5,125
- Capital gain: $2,450
Keeping accurate records of cost basis is critical. Your broker usually tracks this automatically, but it's worth verifying, especially if you've reinvested dividends or made transfers between accounts [7].
Real Example: Individual Stock Sale
Let's walk through a complete transaction:
Purchase:
- Date: January 2023
- Buy 100 shares of XYZ Corp at $50/share
- Trading fee: $10
- Total cost basis: $5,010
One year later, sell:
- Date: January 2024
- Sell 100 shares at $75/share
- Trading fee: $10
- Gross proceeds: $7,500
- Net proceeds: $7,490
Capital gain calculation:
- Sale proceeds: $7,490
- Cost basis: $5,010
- Capital gain: $2,480
Tax owed (filing status: single, total income $75,000):
- Taxable income before gain: $59,250 (after standard deduction)
- Add long-term capital gain: $2,480
- New taxable income: $61,730
Since this single filer's income is under $48,350 for the 0% bracket, plus $13,380 more before hitting the 15% threshold:
- First $13,380 of the gain at 0%: $0
- Remaining $1,100 of the gain at 15%: $165
- Capital gains tax: $165
- Effective rate on the gain: 6.6%
If this had been sold after only 11 months (short-term gain), the entire $2,480 would be taxed at the 22% bracket: $545. Waiting one month saved $380 in tax [8].
The Wash Sale Rule: Timing Your Losses
The wash sale rule is a trap many investors fall into: if you sell an asset at a loss and buy substantially identical asset within 30 days (before or after the sale), you can't deduct the loss.
The disallowed loss gets added to the cost basis of the new purchase, deferring the loss recognition [9].
Example: You sell shares at a $1,000 loss on December 15. On January 5, you buy the same stock again:
- You're within the 30-day window
- Your loss is disallowed
- The $1,000 loss is added to the cost basis of your new purchase
- You'll recognize the loss later when you eventually sell (and don't buy back)
The wash sale rule is meant to prevent people from claiming losses while maintaining their investment position. If you genuinely want to lock in a loss, you must avoid buying the same or substantially identical security for 30 days [10].
Tax-Loss Harvesting: Offsetting Gains Strategically
Tax-loss harvesting is the intentional practice of selling losing investments to offset capital gains or reduce ordinary income. It's legal and smart.
Example: You have:
- $5,000 long-term capital gain from selling your first stock
- $3,000 loss in your second investment
- Sell the second one and use the loss to offset the gain
- Net capital gain: $2,000 (taxed instead of $5,000)
- Tax saved: ~$450 (15% bracket, $3,000 × 15%)
If losses exceed gains, you can deduct up to $3,000 of losses against ordinary income. Excess losses carry forward to future years [11].
Example: You have $5,000 in losses and no gains:
- Deduct $3,000 against ordinary income: ~$660 tax savings (22% bracket)
- Carry forward $2,000 loss to next year [12]
Tax-loss harvesting is especially powerful because you can maintain your market exposure by buying a similar (but not substantially identical) investment. You lock in the loss for tax purposes while staying invested in the same sector [13].
Net Investment Income Tax (NIIT): The 3.8% Surtax
High-income earners face an additional 3.8% tax on investment income called the Net Investment Income Tax (NIIT). It applies to:
- Capital gains (long-term and short-term)
- Dividends
- Interest
- Rental income (if you're a passive investor, not a real estate professional)
The NIIT is triggered when your modified adjusted gross income exceeds [14]:
- $200,000 (single)
- $250,000 (married filing jointly)
- $125,000 (married filing separately)
Example: A married couple with $300,000 in wages and $50,000 in long-term capital gains:
- Modified AGI: $350,000
- NIIT threshold: $250,000
- NIIT applies to: $100,000 of investment income
- NIIT tax: $100,000 × 3.8% = $3,800
On top of the 20% long-term capital gains tax, the 3.8% surtax means high earners effectively pay 23.8% on long-term gains [15].
Inherited Assets: Stepped-Up Basis
This is a significant tax advantage for heirs. When you inherit an asset, your cost basis is "stepped up" to the asset's fair market value on the date of the owner's death — not the original purchase price.
Example: Your parent bought 100 shares of a stock at $10/share (cost basis: $1,000). When they die, the stock is worth $100/share. You inherit it:
- Your cost basis: $10,000 (the value on death date)
- If you sell immediately: $0 capital gain
- If the stock had gone up another $20/share and you sold: $2,000 gain, not $9,000
This stepped-up basis is a massive benefit. It effectively wipes out all unrealized gains at the time of inheritance, allowing the next generation to essentially restart the cost basis at current market value [16].
This benefit is also the reason politicians debate "tax reform" — it allows wealthy families to pass appreciated assets to heirs with no capital gains tax [17].
Strategic Tips: Timing and Planning
Time your sales to hit the long-term threshold. If you're holding a winner, the tax difference between selling at month 11 vs. month 13 is often significant. Patience pays.
Coordinate gains with a low-income year. If you're retiring mid-year or taking a sabbatical, you might have a year with lower total income, allowing you to recognize gains at 0% or 15% rates instead of higher brackets. Intentionally selling appreciated assets in a low-income year is powerful tax planning [18].
Donate appreciated stock instead of cash. If you're charitably inclined, donating appreciated stock to a charity is often more tax-efficient than selling it yourself. You avoid the capital gains tax entirely and deduct the full fair market value as a charitable contribution [19].
Use losses to offset gains. If you have a portfolio with winners and losers, consider harvesting losses from the losers to offset gains from the winners. This is not "locking in losses" — it's locking in losses for tax purposes while potentially repositioning your portfolio [20].
Understand the state capital gains tax. Some states have additional capital gains taxes. Washington, for example, has a 7% capital gains tax on long-term gains above $250,000. Factor this into your planning [21].
References
- Internal Revenue Service. (2025). Capital Gains and Losses Publication 544.
- Internal Revenue Service. (2025). Long-Term Capital Gains Rates 2025.
- Internal Revenue Service. (2025). Net Capital Gains By Filing Status.
- Internal Revenue Service. (2025). Short-Term Capital Gains Taxation.
- Internal Revenue Service. (2025). Qualified Dividends and Capital Gains Worksheet.
- Tax Foundation. (2025). 2025 Long-Term Capital Gains Rates by Income.
- Internal Revenue Service. (2025). Basis of Assets Publication 551.
- Internal Revenue Service. (2025). Holding Period for Capital Assets.
- Internal Revenue Service. (2025). Wash Sale Rule Publication 550.
- Internal Revenue Service. (2025). Wash Sales Explained.
- Internal Revenue Service. (2025). Capital Loss Deduction Limitations.
- Internal Revenue Service. (2025). Carrying Forward Capital Losses.
- Morningstar. (2025). Tax-Loss Harvesting Strategies.
- Internal Revenue Service. (2025). Net Investment Income Tax (NIIT).
- Internal Revenue Service. (2025). Additional Medicare Tax on Investment Income.
- Internal Revenue Service. (2025). Stepped-Up Basis for Inherited Property.
- Congressional Research Service. (2025). Step-Up in Basis and Tax Reform Proposals.
- Tax Foundation. (2025). Income Timing Strategies for Capital Gains.
- Internal Revenue Service. (2025). Donating Appreciated Securities.
- Fidelity. (2025). Tax-Loss Harvesting Best Practices.
- Washington Department of Revenue. (2025). Capital Gains Tax.
This calculator is for educational purposes only and does not constitute financial advice. Capital gains tax rules are complex and interact with many other tax provisions. State and local taxes also apply. Consult a qualified tax professional or CPA for guidance on your specific situation.