ES EN FR PT DE IT

Capital Gains Tax Calculator

Capital Gains Tax Calculator. Free online calculator with formula, examples and step-by-step guide.

The Capital Gains Tax Calculator is a free financial calculator. Capital Gains Tax Calculator. Free online calculator with formula, examples and step-by-step guide. Plan your finances accurately and make better economic decisions.
Inputs
Financial Data
Technical Parameters
Result
Enter values and press Calculate

Capital Gains Tax Calculator: Estimate Your Investment Tax Liability

The Capital Gains Tax calculator estimates the tax you owe when selling investments such as stocks, bonds, real estate, or other capital assets. Whether you are a casual investor or a seasoned trader, understanding your potential tax burden before you sell is essential for effective portfolio management and tax planning.

Capital Gains Tax Formula

Capital Gain = Sale Price − Purchase Price − Cost Basis Adjustments

The capital gain is the difference between what you paid for an asset and what you sold it for, adjusted for any commissions, legal fees, or improvements that form part of your cost basis. The holding period determines whether the gain is short-term (held one year or less) or long-term (held more than one year). Short-term gains are taxed at ordinary income rates. Long-term gains benefit from preferential rates of 0%, 15%, or 20% based on your taxable income bracket.

After calculating your net capital gain (total gains minus total losses), you apply the appropriate tax rate based on your filing status and income level. An additional 3.8% net investment income tax may apply to high earners above $200,000 ($250,000 for married couples).

Worked Examples

Example 1: Long-Term Stock Sale

An investor purchased 100 shares of a technology company at $100 per share in January 2024 and sold them in March 2025 at $150 per share. The total purchase price was $10,000 plus a $10 commission, for a cost basis of $10,010. The sale proceeds were $15,000 minus a $10 commission, netting $14,990.

Calculation: Capital Gain = $14,990 − $10,010 = $4,980

Since the shares were held for over one year, this is a long-term gain. For a single filer with taxable income of $80,000, the long-term capital gains rate is 15%. The tax owed is $4,980 × 15% = $747.

Example 2: Real Estate Sale After Improvements

A homeowner sold a rental property for $350,000. They originally purchased it for $200,000 and invested $30,000 in capital improvements (new roof, HVAC system) and paid $15,000 in closing costs on the sale. The adjusted cost basis is $200,000 + $30,000 + $15,000 = $245,000.

Calculation: Capital Gain = $350,000 − $245,000 = $105,000

For a married couple filing jointly with total income of $120,000, the gain is taxed at 0% long-term rate, so no federal capital gains tax is owed. However, state capital gains taxes and depreciation recapture may still apply.

Common Uses

  • Estimating tax liability before selling stocks, ETFs, or mutual funds to plan the timing of your sale
  • Calculating the tax impact of real estate transactions including primary residences, rental properties, and land sales
  • Planning tax-loss harvesting strategies by identifying which losing positions to sell to offset gains
  • Comparing the after-tax return of short-term versus long-term holding strategies for portfolio optimization
  • Budgeting for estimated tax payments when selling large positions outside of tax-advantaged accounts
  • Evaluating the tax consequences of gifting appreciated assets versus selling and donating cash

Common Mistakes

  • Forgetting to include commissions, legal fees, and improvement costs in the cost basis — these reduce your taxable gain but must be properly documented
  • Confusing short-term and long-term holding periods — the one-year mark is exact; holding for 365 days qualifies as long-term, but 364 days does not
  • Ignoring state capital gains taxes — many states tax capital gains as ordinary income even when federal rates are 0%
  • Failing to account for the wash-sale rule — you cannot claim a loss on a security if you buy a substantially identical security within 30 days before or after the sale

Pro Tip

Harvest losses strategically by pairing them with gains in the same tax year. If you have a highly appreciated position you want to sell, look through your portfolio for underperforming assets you can sell at a loss to offset the gain. This is most effective when you have short-term gains, which would otherwise be taxed at your full ordinary income rate. Remember the wash-sale rule applies strictly to loss positions, so wait 31 days before repurchasing any sold asset.

Frequently Asked Questions

Short-term capital gains apply to assets held for one year or less and are taxed at your ordinary income tax rate, which ranges from 10% to 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.

Yes, you can use capital losses to offset capital gains through tax-loss harvesting. If losses exceed gains, you can deduct up to $3,000 per year ($1,500 if married filing separately) against ordinary income. Excess losses carry forward indefinitely to future tax years.

Single filers can exclude up to $250,000 of gain on the sale of their primary residence, and married couples filing jointly can exclude up to $500,000. To qualify, you must have owned and lived in the home for at least two of the five years before the sale.

The net investment income tax is an additional 3.8% surtax that applies to the lesser of your net investment income or the amount by which your modified adjusted gross income exceeds $200,000 ($250,000 for married couples filing jointly). This applies on top of your regular capital gains tax.

Written and reviewed by the CalcToWork editorial team. Last updated: 2026-04-29.

Frequently Asked Questions

Using the French amortisation formula: C = P × [r(1+r)ⁿ] / [(1+r)ⁿ − 1], where P is principal, r the monthly rate and n the number of payments.
Simple interest is calculated only on the principal: I = P×r×t. Compound interest is calculated on the principal plus accumulated interest: A = P(1+r/f)^(f×t).
VAT = price excl. tax × (percentage / 100). Price incl. VAT = price × (1 + percentage/100).
The break-even point is the number of units that must be sold to cover all costs: BE = Fixed costs / (Selling price − Variable cost per unit).