Capital Gains Tax Calculator

Uncle Sam called. He wants his cut. See exactly how much you'll owe — and how timing could save you.

Trade Details

$
$

Holding Period

months

Over 12 months qualifies as long-term, which typically means a lower tax rate.

Tax Details

Frequently Asked Questions

Capital Gains Tax: The Complete Guide

Everything you need to know about how capital gains are taxed, how timing affects your rate, and strategies to keep more of your profits.

Capital gains tax is the federal tax you owe on the profit from selling an investment asset like stocks, bonds, real estate, or cryptocurrency. You only owe tax on the gain — the difference between your sale price and your purchase price (also called your cost basis). If you sell at a loss, you don't owe capital gains tax on that transaction.

How it works step by step:

  • Determine your cost basis — This is your original purchase price per share multiplied by the number of shares, including any commissions or fees paid at the time of purchase.
  • Calculate your gain or loss — Subtract your cost basis from your total sale proceeds. If the number is positive, you have a capital gain. If negative, you have a capital loss.
  • Classify as short-term or long-term — Assets held for more than 12 months qualify for long-term rates, which are significantly lower than short-term rates for most taxpayers.
  • Apply the correct rate — Short-term gains are taxed at your ordinary income rate. Long-term gains are taxed at 0%, 15%, or 20% depending on your income and filing status.

Capital gains tax only applies when you realize the gain — meaning you actually sell the asset. If your stock doubles in value but you don't sell, you have an unrealized gain and owe nothing until you do. This is why you'll sometimes hear investors talk about "holding to defer taxes."

The distinction between short-term and long-term capital gains is one of the most impactful tax concepts for investors. The holding period — how long you owned the asset before selling — determines which set of rates applies.

Short-term capital gains (held 12 months or less):

  • Taxed at your ordinary income tax rate, which can range from 10% to 37% depending on your total taxable income and filing status.
  • This is the same rate you pay on your salary, wages, and other earned income. There is no preferential treatment for short-term gains.
  • Day traders and frequent traders almost always pay short-term rates, which is one reason active trading can be less tax-efficient than buy-and-hold strategies.

Long-term capital gains (held more than 12 months):

  • Taxed at preferential rates of 0%, 15%, or 20%, which are almost always lower than your ordinary income rate.
  • 0% rate (2024) — Single filers with taxable income up to $47,025, married filing jointly up to $94,050, head of household up to $63,000.
  • 15% rate (2024) — Single filers from $47,026 to $518,900, married filing jointly from $94,051 to $583,750, head of household from $63,001 to $551,350.
  • 20% rate (2024) — Income above those thresholds.

The practical impact is enormous. Consider a $50,000 gain: at the 22% ordinary income rate (short-term), you'd owe $11,000. At the 15% long-term rate, you'd owe $7,500 — a $3,500 savings just by holding for one extra day past the 12-month mark. This is why tax-aware investors carefully track their holding periods before deciding to sell.

Your holding period is counted from the day after you purchase the asset to the day you sell it, inclusive. The IRS uses a "more than 12 months" rule — to qualify for long-term rates, you must hold the asset for at least one year and one day.

Practical examples:

  • Bought January 15, 2024 and sold January 15, 2025 = exactly 12 months = short-term
  • Bought January 15, 2024 and sold January 16, 2025 = 12 months + 1 day = long-term
  • Bought March 1, 2024 and sold December 1, 2024 = 9 months = short-term

Why this matters for timing your sales:

If you're sitting on a gain and you're within a few weeks or months of crossing the 12-month threshold, it may be worth waiting. The difference between a 37% short-term rate and a 15% long-term rate on a $100,000 gain is $22,000 in tax savings. Of course, you also face the risk that the stock price drops while you wait, so it's a judgment call that depends on your conviction in the position and your overall tax situation.

This calculator includes a "timing tip" that automatically tells you how many more months you'd need to hold and how much you could save by converting a short-term gain into a long-term one.

The Net Investment Income Tax (NIIT) is an additional 3.8% surtax on investment income that applies to high-income taxpayers. It was introduced as part of the Affordable Care Act and sometimes goes by the name "Medicare surtax" or "Obamacare tax."

NIIT applies when your modified AGI exceeds:

  • $200,000 for single filers and head of household
  • $250,000 for married filing jointly

What counts as net investment income:

  • Capital gains (both short-term and long-term)
  • Dividends and interest income
  • Rental and royalty income
  • Passive business income

The 3.8% NIIT is applied to the lesser of your net investment income or the amount by which your AGI exceeds the threshold. This means the tax is calculated on a sliding basis — it doesn't suddenly apply to all your investment income once you cross the line.

Practical impact: If you're subject to NIIT, your effective long-term capital gains rate becomes 18.8% (15% + 3.8%) or 23.8% (20% + 3.8%) rather than 15% or 20%. For short-term gains at the top bracket, the combined rate could reach 40.8% (37% + 3.8%). This calculator automatically estimates NIIT when your gain exceeds the applicable threshold.

Tax-loss harvesting is a strategy where you intentionally sell investments that are at a loss to offset capital gains from your winners. By "harvesting" losses, you reduce your net taxable gain and therefore your tax bill.

How it works:

  • Offset gains with losses — If you have $20,000 in capital gains and $8,000 in capital losses, you only pay tax on $12,000 of net gains.
  • Short-term losses offset short-term gains first, then long-term. Since short-term gains are taxed at higher rates, offsetting them first provides the most benefit.
  • Excess losses offset ordinary income — If your losses exceed your gains, you can deduct up to $3,000 of net capital losses against ordinary income per year ($1,500 if married filing separately).
  • Carry forward indefinitely — Any remaining unused losses carry forward to future tax years, so they never expire.

Important considerations: Tax-loss harvesting doesn't eliminate the tax — it defers it. If you reinvest the proceeds into a similar (but not "substantially identical") asset, your new cost basis is lower, meaning you'll owe more tax when you eventually sell that replacement asset. It's essentially a tax deferral strategy, which still has real value because a dollar of tax saved today can be invested and earn returns in the meantime.

The wash sale rule is an IRS regulation that prevents you from claiming a tax loss on a security if you buy a "substantially identical" security within 30 days before or after the sale. The rule exists to prevent taxpayers from selling a stock just to book a loss and immediately buying it back.

The 61-day window:

  • The wash sale period spans 30 days before and 30 days after the sale date, plus the sale date itself — a total of 61 days.
  • If you purchase substantially identical securities during this window, the loss is disallowed for tax purposes.
  • The disallowed loss gets added to the cost basis of the replacement shares, so it's not permanently lost — it just defers the tax benefit.

What counts as "substantially identical":

  • Buying the exact same stock or security is clearly a wash sale.
  • Buying an option or contract to acquire the same stock also triggers the rule.
  • Buying a different ETF or mutual fund that tracks the same index is a gray area — the IRS has not provided clear guidance, but many tax professionals consider it risky.
  • Buying stock in a different company in the same sector is generally fine — selling Apple and buying Microsoft is not a wash sale.

Workaround strategies: Wait the full 31 days before repurchasing the same security, or immediately reinvest in a similar but not substantially identical security (e.g., swap one S&P 500 ETF for a total market ETF) to stay invested while avoiding the wash sale rule.

Capital gains and losses are reported to the IRS using Schedule D of your Form 1040, along with Form 8949 which provides the transaction-level detail. Your brokerage will typically send you a Form 1099-B after the tax year ends, which lists every sale and the associated proceeds.

The reporting process:

  • Form 1099-B — Your broker sends this by mid-February. It lists each sale, the proceeds, the cost basis (if reported), and the holding period. Review it carefully — brokers sometimes have incorrect cost basis information, especially for shares transferred from another account.
  • Form 8949 — You list each transaction with the date acquired, date sold, proceeds, cost basis, and gain or loss. Transactions are separated into short-term (Part I) and long-term (Part II).
  • Schedule D — Summarizes the totals from Form 8949 and calculates your net short-term and long-term gains or losses. The net amounts then flow to your Form 1040.

Cost basis methods: If you bought shares at different times and prices, the method you use to determine which shares you sold matters. Common methods include FIFO (First In, First Out), which assumes you sold the oldest shares first, and specific identification, which lets you choose exactly which shares to sell. Specific identification can be advantageous for tax planning because you can choose to sell higher-cost-basis shares first to minimize your gain.

Yes — most U.S. states tax capital gains as ordinary income, and some states have no income tax at all. This calculator estimates federal taxes only, so your total liability may be higher depending on where you live.

States with no income tax (and therefore no state capital gains tax):

  • Alaska, Florida, Nevada, New Hampshire (no tax on earned income; taxes dividends and interest), South Dakota, Tennessee (no tax on earned income), Texas, Washington (though it has a 7% capital gains excise tax on gains over $270,000), Wyoming

States with the highest combined rates:

  • California — Up to 13.3% state tax on capital gains (no distinction between short-term and long-term at the state level)
  • New York + NYC — Combined state and city rates can exceed 12%
  • Hawaii — Up to 11% on capital gains
  • New Jersey — Up to 10.75%

Unlike the federal system, most states do not offer preferential rates for long-term capital gains. California, for example, taxes all capital gains at ordinary income rates regardless of holding period. This means a California resident in the top bracket could face a combined federal + state rate exceeding 33% on long-term gains and over 50% on short-term gains.

Factor in your state rate when making sell decisions. The federal estimate from this calculator is a starting point, but your actual bill will likely be higher if you live in a state with an income tax.

While you can't avoid capital gains tax entirely (at least not legally), there are several well-established strategies to reduce or defer it. The key principle is that timing and structure matter as much as the actual gains.

Common strategies:

  • Hold for over 12 months — The simplest and most impactful move. Converting a short-term gain into a long-term gain can cut your tax rate in half or more.
  • Tax-loss harvesting — Sell losing positions to offset gains. You can deduct up to $3,000 in net losses against ordinary income per year and carry forward the rest.
  • Use tax-advantaged accounts — Gains within IRAs, 401(k)s, and Roth accounts are tax-deferred or tax-free. Holding appreciating assets in a Roth IRA means you'll never pay capital gains tax on those profits.
  • Gift appreciated stock — Donating appreciated shares to charity lets you deduct the full market value without paying capital gains tax on the appreciation.
  • Step-up in basis at death — Under current tax law, inherited assets receive a "step-up" in cost basis to their fair market value at the date of death, eliminating any unrealized capital gains.
  • Manage your income in the sale year — If you're near a long-term rate threshold, deferring other income (like a bonus or IRA distribution) to the following year could keep you in a lower capital gains bracket.
  • Specific share identification — When selling partial positions, specifically identify the highest-cost shares to minimize your gain.

One common mistake: Letting tax considerations completely drive investment decisions. A stock that's fundamentally overvalued shouldn't be held just to avoid short-term gains tax — the potential loss from a price decline could far exceed the tax savings. Use tax strategy as a tiebreaker, not the primary decision driver.

Know your after-tax return. Now figure out what a stock is actually worth.