Finance ยท Live
Capital gains tax,
calculated correctly.
Estimate your US federal capital gains tax on stocks, real estate, crypto, or any asset. Covers short-term and long-term rates, all four filing statuses, and the 3.8% NIIT surcharge.
Inputs
Sale details
Try an example
Method
Tax = gain ร preferential rate (0% / 15% / 20%)
Capital gain
$8,000.00
Long-term ยท taxed at preferential rates
Tax breakdown
15% effectiveNet proceeds
$16,800.00
Sale price minus all estimated federal taxes
Sale price
$18,000.00
Tax owed
โ$1,200.00
You keep
$16,800.00
Field guide
How US capital gains tax works.
A capital gain arises when you sell an asset for more than you paid for it. The gain is the difference between your sale price and your cost basis (the original purchase price, adjusted for things like brokerage commissions, improvements, or corporate actions). The US federal government taxes this gain, but the rate depends heavily on how long you held the asset and what your overall income is.
Short-term vs. long-term gains
The IRS draws a sharp line at one year of holding. Sell within 12 months and the gain is short-term: it is stacked on top of your ordinary income and taxed at the same graduated rates as your salary or wages โ up to 37% at the federal level. Hold for more than 12 months and the gain is long-term: it qualifies for preferential rates of 0%, 15%, or 20%, depending on your total income. That difference can be enormous. A $50,000 gain taxed at 22% (short-term, middle income) costs $11,000 in federal tax. The same gain taxed at 15% (long-term) costs $7,500 โ a $3,500 difference simply from waiting a few extra months.
Long-term capital gains rates (2024)
The three long-term rates are applied in a "stacking" order. Your ordinary income fills the lower tiers first. Your long-term gain is then placed on top, and only the portion that extends beyond each threshold pays the higher rate.
For 2024, the thresholds are roughly: 0% for single filers with taxable income under $47,025 (including the gain), 15% up to $518,900, and 20% above that. Married filers filing jointly get roughly double the thresholds. The stacking method means a person with $40,000 of ordinary income selling a $20,000 long-term gain will pay 0% on the first $7,025 of the gain (the amount that fits within the 0% tier) and 15% on the remaining $12,975 โ not 15% on the whole amount.
Short-term rates and bracket stacking
Short-term gains are taxed as ordinary income, using the same graduated brackets from 10% up to 37%. The key insight is that the gain is added on top of your ordinary income. If you have $80,000 of wages and realise a $30,000 short-term gain, your marginal rate on part of that gain will be 22% (the bracket starting at $47,150 for single filers in 2024) and part may be pushed into 24%. This calculator uses the incremental-tax method โ it computes tax on your total income including the gain, then subtracts tax on your income alone โ giving you the true additional tax caused by the gain.
The Net Investment Income Tax (NIIT)
On top of ordinary federal rates, the Affordable Care Act introduced a 3.8% surcharge called the Net Investment Income Tax. It applies to taxpayers whose Modified Adjusted Gross Income (MAGI) exceeds a threshold โ $200,000 for single filers and $250,000 for married filing jointly. The NIIT applies to the lesser of your net investment income or the amount your MAGI exceeds the threshold. Capital gains count as net investment income, so both short-term and long-term gains can trigger NIIT. For a high earner with a large long-term gain, the effective combined rate can reach 23.8% (20% + 3.8%).
State taxes โ not included
This calculator estimates federal tax only. Most US states also tax capital gains, typically at ordinary income rates. California, for example, taxes all capital gains at regular income rates up to 13.3%. A handful of states โ including Florida, Texas, Washington, and Nevada โ have no income tax at all. Always factor in your state rate when estimating your true after-tax proceeds.
Capital losses and the $3,000 deduction
If you sell an asset for less than you paid, you have a capital loss. Losses first offset capital gains of the same type (short against short, long against long), then any remaining loss can offset the other type. If total losses exceed total gains, you can deduct up to $3,000 of the net loss against ordinary income per tax year. Losses beyond $3,000 carry forward to future years indefinitely. This is why tax-loss harvesting โ deliberately selling losing positions โ is a widely used strategy near year-end.
Cost basis and what counts
Your cost basis is more than just the purchase price. For stocks, it typically includes commissions paid to your broker and any stock splits or spinoffs. For real estate, it includes the purchase price, closing costs, improvements made to the property, and depreciation taken on rental property (which reduces basis and must be "recaptured" at a 25% rate on sale). Inherited assets receive a step-up in basis to the fair market value at the date of death, which can eliminate a large embedded gain. Gifted assets carry over the donor's original basis.
Primary residence exclusion
One of the largest tax breaks in the tax code applies to the sale of your main home. If you have owned and lived in the home as your primary residence for at least two of the five years before the sale, you can exclude up to $250,000 of gain (single) or $500,000 (married filing jointly) from your taxable income. Amounts above the exclusion are subject to the standard capital gains rates. This exclusion does not apply to rental or investment properties.
Disclaimer
This calculator provides estimates for informational and educational purposes only. It uses 2024 US federal tax brackets and thresholds. It does not account for state or local taxes, the primary residence exclusion, depreciation recapture, alternative minimum tax (AMT), qualified opportunity zone investments, installment sales, or other deductions and credits that may affect your actual tax liability. Tax laws change regularly. Always consult a qualified tax professional or CPA before making investment or tax decisions.