Skip to content

Investing

Stock Sale Capital Gains Calculator

Calculate your capital gains tax on stock sales for any country

Estimate Your Stock Sale Tax Liability

Calculate potential taxes on your stock sales based on your local tax rates

$
$
$
%

What this calculator does

Capital gains tax is owed on profits from selling investments. Short-term capital gains apply to assets held one year or less and are taxed at ordinary income rates (10-37% federally, depending on income bracket). Long-term capital gains apply to assets held over one year and receive preferential rates (0%, 15%, or 20% federally). Long-term gains are significantly more tax-efficient, often saving thousands in taxes on the same profit. Understanding the difference between short and long-term treatment is critical for investment strategy. Additionally, net investment income tax (3.8%) applies to high-income earners, and many states impose additional capital gains taxes.

How it works

Capital gain is calculated as selling price minus the cost basis (original purchase price plus commissions/fees). If you held the investment one year or less, it's a short-term gain taxed at your marginal income tax rate. If held over one year, it's a long-term gain eligible for preferential rates. You report gains on Schedule D and pay federal income tax at year-end. Long-term rates are 0% (for lowest earners), 15% (for middle earners), or 20% (for high earners). State taxes vary; some have no capital gains tax, while others tax all gains as income.

Formula

Capital Gain = Sale Price - Cost Basis. Short-term Tax = Capital Gain × Marginal Income Tax Rate. Long-term Tax = Capital Gain × Long-term Capital Gains Rate (0%, 15%, or 20%). Total Tax = Federal Tax + State Tax + 3.8% Net Investment Income Tax (if applicable).

Tips for using this calculator

  • Hold investments over one year if possible—long-term rates typically save 15-37% in taxes versus short-term rates
  • Use tax-loss harvesting to offset gains; selling losses can reduce taxable gains dollar-for-dollar
  • Be aware of the wash-sale rule: buying similar securities within 30 days of a loss prevents deducting it
  • Track your cost basis carefully; using specific identification method can minimize taxes on partial sales
  • Consult a tax professional for complex situations like inherited stocks (step-up basis) or covered calls

Frequently asked questions

What's the difference between short-term and long-term capital gains tax rates?

Short-term gains (held ≤1 year) are taxed at ordinary income rates: 10%, 12%, 22%, 24%, 32%, 35%, or 37% federally depending on your income bracket. Long-term gains (held >1 year) receive preferential rates: 0% for low earners, 15% for middle earners, or 20% for high earners. This difference can save you thousands on the same profit—for example, a $10,000 gain taxed at 37% (short-term) costs $3,700, versus $2,000 at 20% (long-term).

How does the wash-sale rule affect my tax-loss harvesting strategy?

The wash-sale rule prohibits deducting a loss if you buy the same or substantially identical security within 30 days before or after the sale. To harvest losses tax-efficiently, you must avoid repurchasing the same security for at least 30 days. You can switch to a similar but not substantially identical security (e.g., different index fund or sector) to maintain market exposure while deducting the loss.

What's the net investment income tax and when do I owe it?

The net investment income tax (NIIT) is an additional 3.8% tax on investment income for high earners. It applies to capital gains, dividends, and other investment income for single filers with modified adjusted gross income over $200,000 ($250,000 if married filing jointly). If you're in this bracket, your long-term capital gains are effectively taxed at 23.8% federally (20% + 3.8%), not just 20%.