Capital Gains Tax Calculator
Calculate the federal and state capital gains tax on the sale of an investment, property, or other asset. Compare short-term and long-term tax rates, factor in the Net Investment Income Tax (NIIT), and see your true after-tax proceeds.
Covers stocks, real estate, business interests, and other capital assets. Add multiple assets to calculate total tax across a portfolio.
Capital Gains Tax Calculator
Long-term gain | --
Total Tax: $0
Short-Term vs. Long-Term Comparison
| Holding Period | Tax Rate Applied | Tax Owed | Net Proceeds | After-Tax Return |
|---|
2024 Federal Capital Gains Rates
| Rate | Single Income Threshold | MFJ Threshold |
|---|
Long-term rates. Short-term gains are taxed as ordinary income at your marginal rate. NIIT (3.8%) applies above $200K (single) / $250K (MFJ).
"It's not what you make on an investment that matters — it's what you keep after taxes."
— Investment Tax Planning Principle
How capital gains tax works
A capital gain is the profit from selling a capital asset — stocks, real estate, a business, collectibles — for more than its cost basis. The tax rate depends on how long you held the asset and your total income.
Short-term gains (assets held one year or less) are taxed as ordinary income at your marginal federal rate — potentially 10% to 37%. Long-term gains (held more than one year) receive preferential rates: 0%, 15%, or 20% depending on your total taxable income. For most middle-income taxpayers the long-term rate is 15%; for higher earners it's 20%.
The Net Investment Income Tax (NIIT) adds 3.8% on top of the federal rate for higher earners — the gain plus other investment income above $200,000 (single) or $250,000 (married filing jointly). Combined with the 20% rate, high earners can face up to 23.8% federal tax on long-term gains.
States vary widely: nine states have no income tax (and therefore no capital gains tax), others tax gains as ordinary income at rates up to 13.3% (California). Some states have special lower rates for long-term gains.
lightbulb Tax-Saving Strategies
Hold for long-term: Waiting just past the one-year mark converts a short-term gain taxed at up to 37% into a long-term gain at 0–20%. On a $100,000 gain for a 32% taxpayer that's a difference of $12,000–$17,000.
Tax-loss harvesting: Selling losing investments to offset gains. Up to $3,000 in net losses can offset ordinary income per year; unlimited losses can offset capital gains. Unused losses carry forward indefinitely.
Qualified Opportunity Zones: Reinvesting gains into a Qualified Opportunity Fund defers tax on the original gain and can eliminate tax on appreciation in the fund after 10 years.
1031 Exchange: Like-kind exchange for investment real estate defers all capital gains tax by rolling proceeds into a new property. Must be completed within 180 days.
Primary home exclusion: Up to $250,000 ($500,000 MFJ) of gain on the sale of a primary residence is excluded if you lived there 2 of the last 5 years.
Capital Gains Tax FAQs
What is cost basis and how do I calculate it?
Cost basis is generally what you paid for the asset plus any commissions, fees, or improvements. For stocks: purchase price + broker commissions. For real estate: purchase price + closing costs + capital improvements. If you inherited the asset, your basis is typically the fair market value on the date of death (stepped-up basis), which can dramatically reduce or eliminate capital gains tax. If received as a gift, you generally take the giver's basis.
What is depreciation recapture?
When you sell rental or investment real estate, the IRS requires you to "recapture" depreciation deductions taken over the holding period. Depreciation recapture is taxed at a maximum federal rate of 25% (Section 1250 unrecaptured depreciation), not the preferential long-term capital gains rate. This often surprises real estate investors — it's separate from and in addition to capital gains tax on the appreciation above original cost.
How are cryptocurrency gains taxed?
The IRS treats cryptocurrency as property, not currency. Every sale, exchange (including crypto-to-crypto trades), and use of crypto to purchase goods or services is a taxable event. Short-term gains are taxed as ordinary income; long-term gains receive the preferential capital gains rates. Record-keeping is critical — each transaction requires tracking the cost basis, proceeds, and holding period.
Can I avoid capital gains tax by gifting assets?
Gifting appreciated assets to charity avoids capital gains tax and generates a charitable deduction equal to fair market value — a double benefit. Gifting to individuals does not avoid the tax — the recipient takes your cost basis (carryover basis) and pays gains when they sell. Gifting to a donor-advised fund or charitable remainder trust are common sophisticated strategies.
Terminology
Cost Basis
The original value of an asset for tax purposes, generally the purchase price plus transaction costs and improvements. Determines the taxable gain (proceeds minus basis). Higher basis = lower taxable gain.
Holding Period
How long you owned the asset before selling. Assets held more than one year qualify for long-term capital gains rates. The one-year threshold is calculated from the day after acquisition to the date of sale.
Net Investment Income Tax (NIIT)
A 3.8% Medicare surtax on net investment income (capital gains, dividends, interest, rents) for taxpayers with modified AGI above $200,000 (single) or $250,000 (MFJ). Not indexed for inflation — more taxpayers reach this threshold each year.
Tax-Loss Harvesting
Strategically selling assets at a loss to offset capital gains. Short-term losses offset short-term gains first; long-term losses offset long-term gains first. Net losses up to $3,000/year can offset ordinary income. Excess losses carry forward to future years indefinitely.
Stepped-Up Basis
When an asset is inherited, the heir's cost basis is "stepped up" to the fair market value at the date of death. This eliminates the capital gains tax on appreciation during the deceased's lifetime — a significant estate planning advantage for highly appreciated assets.
1031 Exchange
A like-kind exchange allowing deferral of capital gains tax on investment real estate by reinvesting proceeds into a new qualifying property. Strict timelines apply: 45 days to identify replacement property, 180 days to close. Does not apply to personal residences or personal property.
Disclaimer: All calculators on this site are provided for informational and educational purposes only. Results are estimates based on the inputs you provide and mathematical formulas — they do not account for taxes, fees, inflation, risk, or other real-world factors that may affect financial outcomes. Past performance does not guarantee future results. Nothing on this site constitutes financial, investment, legal, or tax advice. Always consult a qualified professional before making financial decisions.
About FinanceCalcs.net — FinanceCalcs.net is a free financial calculator directory built and maintained by Ted Grajeda. The site exists to give everyone access to fast, accurate financial math — no subscriptions, no paywalls, no signup required. Every calculator runs entirely in your browser using standard financial formulas.