Skip to content

Capital Gains Tax Calculator

Calculate capital gains tax on stocks, real estate, and other investments. Compare short-term vs. long-term rates, estimate your tax liability, and plan tax-efficient selling strategies.

Loading calculator

Preparing Capital Gains Tax Calculator...

Reviewed & Methodology

Every calculator is built using industry-standard formulas, validated against authoritative sources, and reviewed by a credentialed financial professional. All calculations run privately in your browser - no data is stored or shared.

Last reviewed:

Reviewed by:

Written by:

How to Use the Capital Gains Tax Calculator

  1. 1. Enter your purchase price (cost basis) - input the original price you paid for the asset, including any commissions or fees.
  2. 2. Enter your sale price - input the amount you received (or expect to receive) when selling the asset.
  3. 3. Select the holding period - choose short-term (held 1 year or less) or long-term (held more than 1 year) to apply the correct tax rate.
  4. 4. Enter your taxable income - this determines which capital gains tax bracket applies to your gain.
  5. 5. Review your estimated tax - see the capital gain amount, applicable tax rate, estimated tax owed, and net proceeds after tax.

Capital Gains Tax Calculator

When you sell a stock, piece of real estate, or other investment for more than you paid, the profit is a capital gain — and the IRS taxes it. This calculator estimates your federal capital gains tax by taking your purchase price (cost basis), sale price, holding period, and taxable income. It shows your gain, applicable tax rate, estimated tax owed, and net proceeds after federal tax. Capital gains treatment varies dramatically based on how long you held the asset, so knowing the rate before you sell can change your timing decision.

How Capital Gains Tax Is Calculated

The starting point is always the same: Capital Gain = Sale Price - Cost Basis. What happens next depends on your holding period:

  • Short-term gain (held 1 year or less): taxed as ordinary income at your marginal rate (10%, 12%, 22%, 24%, 32%, 35%, or 37%)
  • Long-term gain (held more than 1 year): taxed at preferential rates of 0%, 15%, or 20% based on taxable income
  • Net Investment Income Tax (NIIT): an additional 3.8% applies to investment income when modified AGI exceeds $200,000 single / $250,000 married filing jointly
  • Depreciation recapture: for rental or business property, depreciation previously deducted is recaptured at a 25% rate, separate from the long-term gain rate

For 2026, the long-term capital gains brackets for single filers are approximately: 0% on income up to $48,350; 15% on income up to $533,400; 20% above that.

Worked Examples

Scenario 1 — Stock held less than a year: An investor bought 100 shares of a tech stock at $85/share ($8,500 total) and sold them 8 months later at $130/share ($13,000 total). Gain = $4,500. Short-term gain taxed at the investor’s 22% ordinary income rate. Federal tax = $990. Net proceeds after federal tax = $12,010. If they had waited four more months past the one-year mark, the same $4,500 gain at a 15% long-term rate would cost only $675 — saving $315.

Scenario 2 — Primary home sale: A couple bought a home for $310,000 in 2019 and sold it for $550,000 in 2026. Gross gain = $240,000. The married filing jointly exclusion is $500,000 under Section 121. Since they lived there as their primary residence for more than 2 of the last 5 years, the full $240,000 gain is excluded. Federal tax = $0.

Scenario 3 — Rental property sale: An investor bought a rental property for $200,000 in 2015, claimed $40,000 in depreciation over 10 years, and sold it for $380,000 in 2026. Adjusted cost basis = $200,000 - $40,000 = $160,000. Total gain = $220,000. Depreciation recapture on $40,000 at 25% = $10,000. Remaining long-term gain of $180,000 at 15% = $27,000. NIIT of 3.8% on $220,000 = $8,360. Total federal tax = $45,360.

Reference Table

ScenarioCost BasisSale PriceGainHoldingRateEst. Federal Tax
Stock — short-term, 22% bracket$8,500$13,000$4,5008 months22%$990
Stock — short-term, 32% bracket$20,000$35,000$15,00011 months32%$4,800
Stock — long-term, 0% bracket$5,000$12,000$7,0003 years0%$0
Stock — long-term, 15% bracket$10,000$15,000$5,0002 years15%$750
Stock — long-term, 20% bracket$50,000$120,000$70,0005 years20%$14,000
Home sale — exclusion applies$310,000$550,000$240,0007 years0%$0
Home sale — partial exclusion$200,000$700,000$500,0008 years15%$37,500
Rental property (+ recapture)$160,000$380,000$220,00010 years15%+25%$45,360
Crypto — short-term, 24%$15,000$28,000$13,0007 months24%$3,120
Crypto — long-term, 15%$15,000$28,000$13,00018 months15%$1,950

When to Use

  • Before selling a stock or investment property, to compare the tax cost of selling now versus waiting past the one-year mark for long-term treatment
  • Planning a year-end tax-loss harvest — quantify how much gain you need to offset before selling losing positions
  • Evaluating whether to use the primary residence exclusion on a home you have lived in, or whether it makes sense to delay a sale to qualify
  • Estimating net proceeds from an investment sale so you know exactly how much you will have left after the IRS takes its share
  • Deciding between FIFO, specific identification, or average cost basis methods for stock sales to minimize the gain recognized

Common Mistakes

  1. Forgetting the holding period down to the exact day. Long-term treatment requires holding more than 365 days — not “about a year.” Selling at 364 days means paying ordinary income rates. For large gains, double-check the exact purchase date before scheduling a sale.
  2. Using the original purchase price as cost basis for inherited assets. Inherited assets typically receive a “stepped-up” basis equal to the fair market value on the date of death. Using the decedent’s original purchase price instead massively overstates your taxable gain.
  3. Ignoring state capital gains tax. This calculator covers federal tax only. California taxes capital gains as ordinary income at up to 13.3%. New York adds up to 10.9% state plus city tax. Your actual after-tax proceeds can be 10-15 percentage points lower than the federal calculation alone.
  4. Overlooking depreciation recapture on rental property. Many landlords are surprised to learn that depreciation they deducted over the years is recaptured at 25% when the property is sold — separate from the standard long-term capital gains rate on the remaining appreciation. Always calculate these two components separately.

Current Context for 2026

Long-term capital gains rates are unchanged from prior years. The 0% bracket threshold has increased modestly with inflation adjustments — single filers with taxable income below approximately $48,350 owe zero federal tax on long-term gains, making this bracket worth targeting for lower-income years. The primary residence exclusion ($250,000 single / $500,000 married) has not been adjusted for inflation since it was set in 1997, meaning it covers a smaller share of appreciation in high-cost markets like San Francisco, New York, and Boston where prices have risen sharply. Cryptocurrency is treated as property by the IRS — each sale or swap is a taxable event, and short-term crypto gains are taxed as ordinary income, which catches many investors off guard. Estate tax exemption is $13.99 million per person in 2026, meaning stepped-up basis on inherited assets remains widely available.

Tips

  1. Hold investments for at least one year and one day from the purchase date — at a 22% income bracket, shifting a $20,000 gain from short-term to long-term saves $1,400 in federal tax
  2. In years when your income is unusually low (career break, major deductions, retirement transition), review your long-term gain exposure against the 0% bracket ceiling and consider realizing gains that year
  3. Use tax-loss harvesting to offset gains dollar-for-dollar, but observe the 30-day wash-sale rule — repurchasing a substantially identical security within 30 days before or after the sale disallows the loss
  4. For donated appreciated assets held more than one year, you avoid capital gains entirely and deduct the full fair market value, making donation often more tax-efficient than selling and donating cash
  5. On rental property sales, get a depreciation schedule from your accountant before listing — knowing the recapture amount upfront prevents surprises in net proceeds
  6. For stocks with lots purchased at different prices, use the specific identification method to sell the highest-cost shares first, minimizing the taxable gain recognized in the current year
  • Tax Calculator — estimate your full federal income tax including how capital gains stack on top of ordinary income
  • Self-Employment Tax Calculator — if you also have business or freelance income, see how SE tax interacts with investment gains
  • Profit Margin Calculator — for business asset sales, understand the margin on the original investment relative to the tax cost of exiting

Frequently Asked Questions

What is the difference between short-term and long-term capital gains tax rates?
Short-term capital gains apply to assets held for one year or less and are taxed as ordinary income at your regular federal tax rate, which can be as high as 37%. Long-term capital gains apply to assets held for more than one year and are taxed at preferential rates of 0%, 15%, or 20% depending on your taxable income. For 2024, single filers pay 0% on long-term gains if taxable income is below $47,025, 15% up to $518,900, and 20% above that. This difference means holding an investment for just one extra day past the one-year mark can save you thousands in taxes.
How do I calculate my cost basis for stocks or real estate?
Cost basis is the original purchase price plus any additional costs like broker commissions, transfer fees, or improvements (for real estate). For stocks, if you reinvested dividends, each reinvestment adds to your basis. For inherited assets, the basis is typically 'stepped up' to the fair market value on the date of the decedent's death. For real estate, add the cost of permanent improvements (new roof, kitchen remodel) but not routine maintenance. Accurate cost basis is critical because it directly reduces your taxable gain.
What is tax-loss harvesting and how can it reduce my capital gains tax?
Tax-loss harvesting is the strategy of selling investments at a loss to offset capital gains from other investments. You can use capital losses to offset gains dollar-for-dollar, and if your losses exceed your gains, you can deduct up to $3,000 of net losses against ordinary income per year, carrying any remaining losses forward to future years. Be aware of the wash-sale rule: if you buy a substantially identical security within 30 days before or after selling at a loss, the IRS disallows the loss deduction.
Are there any exemptions from capital gains tax?
The most significant exemption is the primary residence exclusion under Section 121. If you have owned and lived in your home for at least 2 of the last 5 years, you can exclude up to $250,000 of gain ($500,000 for married couples filing jointly) from capital gains tax. Assets held in tax-advantaged accounts like 401(k)s and IRAs are not subject to capital gains tax when sold inside the account, though distributions are taxed differently. Gifts to charity of appreciated assets can also avoid capital gains entirely while providing a charitable deduction.
How do I report capital gains on my tax return?
Capital gains and losses are reported on Schedule D of Form 1040, with individual transaction details listed on Form 8949. Your brokerage will send you Form 1099-B showing proceeds from each sale. You must match each sale with its cost basis and holding period. Net short-term and long-term gains are calculated separately, then combined on Schedule D. If you have gains from real estate, you may also need Form 4797 for business property or the primary residence exclusion worksheet. Keep all purchase records for at least 3 years after filing.
Calculators