Calcady
Home / Financial / Capital Gains Tax Calculator

Capital Gains Tax Calculator

Calculate your exact tax liability and final net profit when selling stocks, crypto, or real estate.

Asset Value

$
$

Tax Environment

%

Most people pay 15% for Long-Term (0% if low income, 20% if high income).

Long-Term Gain (Preferential Rates)

Final Net Profit

$42,500
Take-home cash after taxes
Gross Capital Gain:+$50,000
Tax Owed to IRS:-$7,500
Email LinkText/SMSWhatsApp

Quick Answer: What is the capital gains tax formula?

Capital Gain = Sale Price − Cost Basis − Selling Costs. Tax owed = Capital Gain × applicable rate. Short-term gains (held < 1 year) are taxed as ordinary income (10–37%). Long-term gains (held ≥ 1 year) are taxed at preferential rates: 0%, 15%, or 20% depending on taxable income. Example: buy 100 shares at $40 ($4,000 basis), sell at $70 ($7,000) after 18 months → gain = $3,000 × 15% = $450 tax owed. Net profit = $3,000 − $450 = $2,550. An equivalent short-term gain at 22% ordinary rate would cost $660 in tax — $210 more for the same $3,000 profit.

2024 Long-Term Capital Gains Tax Rates (Single vs Married Filing Jointly)

Long-term rates apply when the asset is held for more than one year. These rates apply to most capital assets: stocks, bonds, mutual funds, and rental property. Collectibles (art, coins, wine) are taxed at a maximum 28% rate. Depreciation recapture on real estate is taxed at 25%.

Rate Single Filer (Taxable Income) Married Filing Jointly Key Implication
0%Up to $47,025Up to $94,050Tax-free gains — harvest gains aggressively in low-income years
15%$47,026 – $518,900$94,051 – $583,750Rate applies to most middle- and upper-middle-income investors
20%Over $518,900Over $583,750Top rate; add 3.8% NIIT if income exceeds $200K/$250K
Net Investment Income Tax (NIIT): an additional 3.8% applies on the lesser of net investment income or MAGI over $200,000 (single) / $250,000 (MFJ). So the true maximum federal rate is 23.8% for long-term and up to 40.8% for short-term gains at the 37% ordinary bracket. State taxes are additional.

Pro Tips & Common Capital Gains Mistakes

Do This

  • Hold assets more than one year to qualify for long-term rates — the single biggest legal tax reduction available to individual investors. On a $50,000 gain, the difference between a 22% short-term rate ($11,000 tax) and a 15% long-term rate ($7,500 tax) is $3,500 in savings — simply by waiting a few extra weeks past the 12-month mark. The one-year holding period starts the day after you acquire the asset and ends on the day you sell. Use your brokerage’s “lots” view to verify the exact holding period before selling any individual lot.
  • Use tax-loss harvesting to offset gains dollar-for-dollar — selling losing positions at year-end to cancel out taxable gains from other sales. Capital losses offset capital gains with no dollar limit. If losses exceed gains, up to $3,000 per year can offset ordinary income, and any remaining losses carry forward indefinitely to future tax years. Example: realized $20,000 long-term gain + $15,000 loss harvest = only $5,000 net taxable gain. At 15% rate: $750 tax instead of $3,000. Wash-sale rule: you cannot repurchase a “substantially identical” security within 30 days before or after the loss sale — doing so disallows the loss. Workaround: buy a similar (not identical) ETF or fund to maintain exposure during the 30-day window.

Avoid This

  • Don’t forget to include all selling costs in your cost basis — broker commissions, transfer taxes, and real estate closing costs reduce your taxable gain and are fully deductible. For real estate: selling costs typically include agent commissions (5–6%), title insurance, escrow fees, transfer taxes, and attorney fees. On a $400,000 home sale with $24,000 in commissions and $6,000 in closing costs: your recognized gain is reduced by $30,000 before taxes are calculated. Many sellers forget to include all costs and overpay taxes as a result. Keep all receipts and closing disclosure statements from both purchase and sale.
  • Don’t ignore the $250,000 / $500,000 primary residence exclusion — you may owe zero tax on a large home sale gain if you qualify. Under IRC §121, if you owned and lived in your home as your primary residence for at least 2 of the last 5 years, up to $250,000 of capital gains (single) or $500,000 (married filing jointly) are completely excluded from federal tax. This exclusion resets every 2 years. For a couple selling a home with a $450,000 gain: $0 federal tax if they qualify. The calculator does not automatically apply this exclusion — manually reduce your gain by the exclusion amount before entering it.

Frequently Asked Questions

What is the difference between short-term and long-term capital gains?

Short-term capital gains arise from assets sold within 12 months of acquisition. They are taxed as ordinary income — at the same rate as your salary — which can be as high as 37% at the federal level. Long-term capital gains apply to assets held more than 12 months (one year and one day or longer). The preferential rates are 0%, 15%, or 20% depending on your total taxable income. For most investors in the middle-income range, the long-term rate is 15%. This rate differential is one of the most powerful and widely applicable tax incentives in the U.S. tax code — holding an investment just a few extra weeks past the one-year mark can save thousands of dollars on a large gain.

What counts as my cost basis?

Your cost basis is what you paid for the asset, plus any acquisition costs, and adjusted for subsequent events. For stocks: basis = purchase price + brokerage commissions. For real estate: basis = purchase price + closing costs + capital improvements (not repairs) − any depreciation claimed. Cost basis can also be stepped-up: inherited assets use the fair market value at the date of the decedent’s death as the new basis — meaning large unrealized gains accumulated over a lifetime can pass to heirs completely tax-free. For assets received as gifts: the basis is generally the donor’s original basis (carry-over basis). The IRS requires you to track your basis for every lot separately — your broker’s 1099-B form reports proceeds, but you are responsible for confirming basis accuracy.

How are cryptocurrency capital gains taxed?

The IRS classifies cryptocurrency as property, not currency, so every sale, exchange, or use of crypto to purchase goods is a taxable event subject to capital gains tax. Short-term crypto gains (held < 1 year) are taxed as ordinary income; long-term gains (held ≥ 1 year) get the preferential 0%/15%/20% rates. Unlike stocks, crypto has no wash-sale rule (as of 2024) — you can sell at a loss, immediately rebuy, and still claim the loss. Swapping one crypto for another (e.g., Bitcoin to Ethereum) is also a taxable event at the time of the swap, with gain or loss based on the fair market value of the asset received minus your original basis. Cost basis methods for crypto: FIFO (default), specific identification, or HIFO (Highest In, First Out — often minimizes taxes by recognizing highest-cost lots first).

What is the Net Investment Income Tax (NIIT) and does it apply to me?

The Net Investment Income Tax (NIIT), enacted under the Affordable Care Act, imposes an additional 3.8% Medicare surtax on the lesser of: (1) your net investment income, or (2) the amount by which your Modified Adjusted Gross Income (MAGI) exceeds the threshold. Thresholds: $200,000 (single), $250,000 (married filing jointly), $125,000 (married filing separately). Net investment income includes capital gains, dividends, interest, rental income, and annuities — but not wages or self-employment income. Example: married couple with $260,000 MAGI including $40,000 long-term capital gains. MAGI exceeds threshold by $10,000. NIIT applies to the lesser of $40,000 (NII) or $10,000 (excess) = $10,000 × 3.8% = $380 additional tax. The calculator does not automatically apply NIIT — add it manually if you expect to cross the income threshold.

Related Calculators