Finance calculators

Capital Gains Calculator

Updated Nov 10, 2026 By Infinity Calculator Formulas Sources
Rate

* Required field. All amounts in U.S. dollars; federal figures use 2026 IRS brackets.

1. Asset Type

Asset type changes which federal rules apply (28% collectibles cap, home-sale exclusion, depreciation recapture).

2. Sale & Cost Basis Information

What you originally paid for the asset.
Upgrades that add value (new roof, addition). Repairs do not count.
Total depreciation claimed over the years you owned it.
Total gross proceeds before any costs.
Commissions, closing costs, legal and agent fees.
Paid off at closing — used for your net cash-in-hand.
Net Adjusted Basis (Purchase + Improvements − Depreciation)
$285,000.00
Gross Capital Gain (Sale − Basis − Selling Expenses)
$205,000.00

3. Ownership & Filing Details

How long did you own it? *
This is the single biggest driver of your tax rate.
The year of the sale. Sets the federal brackets, the 0%, 15% and 20% bands and the standard deduction.
Your ordinary income (wages, business, interest) before this sale. Deductions in the Advanced panel are subtracted from it.
Sets the estimated state rate below — you can edit it.
Auto-filled from your state and holding period. Editing it overrides the lookup.
Some cities (e.g. New York City) add their own tax.

These fields improve the accuracy of your federal tax bracket calculation.


Headline Summary
Total Estimated Capital Gains Tax
$0.00
After-Tax Equity (Net Cash-in-Hand)
$0.00
Sale − selling costs − loan payoff − tax
Gross Capital Gain
$0.00
Before tax
Effective Total Tax Rate
0.00%
Total tax ÷ gross gain
Full Tax Breakdown
Every component of your estimated capital gains tax, with the taxable amount, rate applied and tax due.
Tax Component Taxable Amount Rate Applied Tax Due
Short-Term vs. Long-Term Comparison
Chart data is also listed in the table below, which is the accessible equivalent. Each bar is labelled with its dollar amount.
Side-by-side comparison of tax owed under short-term and long-term holding.
Line Item Short-Term (1 year or less) Long-Term (more than 1 year)
Cost Basis & Equity Waterfall
Step-by-Step Solution

The Start Your Return for Free button opens E-file.com, online software for filing your federal and state tax returns. Federal filing is free if your return qualifies for its Basic software; state returns and larger returns cost extra. We may earn a commission if you file through this link.


Introduction

When you sell something for more than you paid, the profit is called a capital gain. The IRS taxes that gain. This capital gains tax calculator shows you how much tax you may owe and how much cash you keep.

Enter what you paid, what you sold it for, your selling costs, and your income. The calculator then figures your federal tax, state tax, the 3.8% Net Investment Income Tax, and depreciation recapture if you sold a rental.2 It works for stocks, crypto, real estate, collectibles, and business assets.

Time matters a lot. If you held the asset one year or less, your gain is short-term and taxed at your normal income rate. If you held it more than one year, it is long-term and taxed at 0%, 15%, or 20%.1 The tool compares both side by side, so you can see what waiting could save you.

You also get a full tax breakdown, a step-by-step math solution, and a waterfall that tracks your sale price down to net cash in hand. Sold your main home? The calculator applies the Section 121 home sale exclusion. That exclusion is up to $250,000, or $500,000 if you file jointly.3 All numbers use the IRS brackets for the tax year you pick and are estimates, not tax advice. The 2026 brackets come from Revenue Procedure 2025-32.5 The 2027 brackets come from Revenue Procedure 2026-35.6

How to use our Capital Gains Tax Calculator

Enter what you bought, what you sold it for, how long you owned it, and where you live. The calculator shows your estimated capital gains tax, your federal, state, local and recapture tax breakdown, your net cash after the sale, and a short-term vs. long-term comparison.

Asset Type: Pick what you sold, such as stocks, crypto, a rental property, your home, collectibles, or business assets. This choice sets the tax rules used.

Section 121 Home Sale Exclusion: This box shows only for a primary residence. Check it if you owned and lived in the home at least 2 of the last 5 years. It removes up to $250,000 of gain ($500,000 if married filing jointly).3

Original Purchase Price: Type what you first paid for the asset. If you inherited it, enter its fair market value on the date the owner died, which is the general rule.7 If the estate used the alternate valuation date, or sent you a Schedule A (Form 8971) showing the estate tax value, you may need to use that value instead.7

Capital Improvements: Add money spent on upgrades that add value, make the asset last longer or adapt it to new uses, like a new roof or an addition. Do not count repairs such as painting or fixing leaks.8

Depreciation Taken: Enter the total depreciation you wrote off over the years. This matters most for rental property, since it gets taxed back at up to 25%.1

Sale Price: Type the full amount you sold the asset for, before any costs.

Selling Expenses: Add agent commissions, closing costs, and legal fees tied to the sale.

Outstanding Loan / Mortgage Balance: Enter the loan amount paid off at closing. This is used to find your net cash in hand, not your tax.

How long did you own it: Choose one year or less (short-term) or more than one year (long-term).1 This has the biggest effect on your rate. If you inherited the asset, choose more than one year, however long you actually held it.9 If it was a gift and your basis is figured from the giver's basis, the time the giver held it counts toward yours.9

Tax Year: Pick the year of the sale, 2026 or 2027. This sets the federal brackets, the standard deduction and the capital gains rate limits.

Filing Status: Pick single, married filing jointly, married filing separately, head of household, or qualifying widow(er). This sets your brackets and deduction.

Estimated Annual Income (Before Deductions): Enter your other income for the year, like wages or business income, before this sale and before deductions.

State / Location: Choose your state. The calculator fills in a state rate for you.

State Capital Gains Tax Rate: Keep the filled-in rate or type your own if you know it.

Local / City Tax Rate: Add a city rate if your city taxes income, like New York City. Leave it at 0 if not.

401(k) / 403(b) Contributions: In the Advanced panel, enter pre-tax retirement contributions. These lower the income used for your bracket.

IRA Contributions: Enter deductible traditional IRA contributions only.

Itemized Deductions: Enter your itemized total. If it is smaller than the standard deduction, the standard one is used.

Number of Dependents: Enter how many dependents you claim. This does not change capital gains rates and is shown for context.

Click Calculate to see your results, or Reset to start over.

What Is Capital Gains Tax?

A capital gain is the profit you make when you sell something for more than you paid for it. This can be stocks, crypto, a rental house, land, art, or a business. The tax you pay on that profit is called capital gains tax. If you sell for less than you paid, you have a capital loss, and you owe no tax on that sale.

How Your Gain Is Figured

Your gain is not just the sale price minus the purchase price. The IRS uses your adjusted cost basis:

  • Start with what you paid for the asset, or, if you inherited it, generally its fair market value on the date the owner died or the estate tax value the estate reported to you. Gifts follow their own rules.7
  • Add capital improvements, like a new roof or an addition. Normal repairs do not count.8
  • Subtract the depreciation you deducted, or could have deducted, on a rental or business property.7

Then take your sale price, subtract that basis, and subtract selling costs like agent fees and closing costs. What is left is your gain.8 If you bought shares over time at different prices, the Stock Average Calculator is a quick way to find your blended cost.

Short-Term vs. Long-Term

How long you owned the asset matters more than anything else:

  • Short-term (held one year or less): taxed like your paycheck, at ordinary rates from 10% up to 37%.4 The Income Tax Calculator shows how those rates stack.
  • Long-term (held more than one year): taxed at lower rates of 0%, 15%, or 20%, based on your income and filing status.1

Waiting past the one-year mark can save you thousands of dollars on the same profit. Inherited property always counts as long-term.9

Extra Taxes That Can Apply

  • Depreciation recapture: if you claimed depreciation on a rental, that part of your gain is taxed at up to 25%.1
  • Net Investment Income Tax (NIIT): a 3.8% surtax on the smaller of your investment income or the amount your modified adjusted gross income is over $200,000 (single or head of household), $250,000 (married filing jointly or qualifying surviving spouse) or $125,000 (married filing separately).2 Check the threshold with the MAGI Calculator.
  • Collectibles: art, coins, and similar items have a higher long-term cap of 28%.1
  • State and local tax: some states, like Florida and Texas, charge nothing. Others, like California, tax gains as regular income. A few cities add their own tax on top.

The Home Sale Break

If you sell your main home and owned and lived in it at least 2 of the last 5 years, you can exclude up to $250,000 of gain if single, or $500,000 if married filing jointly.3 For the joint amount, either spouse can meet the ownership test, but both of you must have lived in the home for 2 of the last 5 years.3 You generally cannot use the exclusion if you excluded gain from selling another home in the 2 years before this sale.3 This is the Section 121 exclusion. Gain equal to depreciation you claimed, or could have claimed, on the home after May 6, 1997 cannot be excluded.8

Ways to Lower the Tax

  • Hold assets more than one year before selling.
  • Sell in a year when your income is lower, such as an early retirement year.
  • Use losses on other sales to cancel out gains. This is called tax-loss harvesting.
  • Keep receipts for improvements, since they raise your basis and cut your gain.
  • For rentals, ask a tax pro about a 1031 exchange, which can delay the tax.9
  • Shift future growth into tax-sheltered accounts.

Losses that are bigger than your gains can cut up to $3,000 of your regular income each year ($1,500 if married filing separately).1 Anything left over carries into future years. A loss on your home or other personal-use property cannot be deducted.1

These results are estimates for planning only. Tax law is complex, so check with a CPA or tax advisor before you file.


Formulas used

Net Adjusted Basis
\text{Basis} = \text{Purchase Price} + \text{Improvements} - \text{Depreciation}
Gross Capital Gain
\text{Gain} = \text{Sale Price} - \text{Basis} - \text{Selling Expenses}
Income used for bracketing
\text{Adj. Income} = \max\!\left(0,\; \text{Income} - \text{401(k)} - \text{IRA} - \max(\text{Standard},\ \text{Itemized})\right)
Taxable gain after recapture and Section 121 exclusion
\begin{aligned}\text{Recapture} &= \min(\text{Depreciation},\ \text{Gain}) \\ \text{Excluded} &= \min(\text{Excl. Limit},\ \text{Gain} - \text{Recapture}) \\ \text{Taxable Gain} &= \text{Gain} - \text{Recapture} - \text{Excluded}\end{aligned}
Bracket-stacked tax (federal capital gains and depreciation recapture, capped rate)
\text{Tax} = \sum_{i} \text{Slice}_i \times \min(r_i,\ r_{\text{cap}}), \quad \text{Slice}_i = \min\!\left(\text{Remaining},\ \text{Limit}_i - \text{Position}\right)
Net Investment Income Tax (3.8% surtax)
\text{NIIT} = \min\!\left(\text{Recapture} + \text{Taxable Gain},\; \max(0,\ \text{MAGI} - \text{Threshold})\right) \times 3.8\%
State and local capital gains tax
\text{State} = G_{\text{state}} \times \frac{r_{\text{state}}}{100} + 2.9\% \times \max\left(0,\ G_{\text{state}} - \$1{,}000{,}000\right)\ (\text{Washington}), \qquad G_{\text{state}} = \max\left(0,\ \text{Recapture} + \text{Taxable Gain} - \text{State Deduction}\right),\ \text{and}\ G_{\text{state}} = 0\ \text{in Washington for exempt real estate and depreciable business property}, \qquad \text{Local} = (\text{Recapture} + \text{Taxable Gain}) \times \frac{r_{\text{local}}}{100}
Total tax, after-tax equity and effective rate
\begin{aligned}\text{Total Tax} &= \text{Federal} + \text{Recapture Tax} + \text{NIIT} + \text{State} + \text{Local} \\ \text{Net Cash} &= \text{Sale Price} - \text{Selling Expenses} - \text{Loan Balance} - \text{Total Tax} \\ \text{Effective Rate} &= \frac{\text{Total Tax}}{\text{Gain}} \times 100\%\end{aligned}

Frequently asked questions

When do I actually have to pay the capital gains tax?

Tax is due for the year the sale closes. If the buyer pays you over more than one year in an installment sale, you generally include in income each year only the part of the gain you receive.12 This does not apply to stocks and securities traded on an established securities market.12 Any part of the gain that is ordinary income under the depreciation recapture rules is still reported in the year of the sale.12 The IRS also wants tax paid as you earn income. If you owe a large amount, you may need to send an estimated tax payment by the next quarterly due date (April 15, June 15, September 15, or January 15).10 Paying too little by a due date can bring a penalty, even if you are due a refund when you file.10

What income should I enter in the calculator?

Enter your other income for the year before this sale and before deductions. That means wages, self-employment profit, interest, and dividends. Do not include the gain from this sale. The calculator adds it for you. Do not subtract your standard deduction either; the tool does that step.

Why is the loan balance not lowering my tax?

Your loan does not lower your cost basis. Basis is the full price you paid, whether you paid in cash or with borrowed money.7 The IRS taxes your profit, not your equity. Your loan payoff only affects how much cash you walk away with, so it shows up in the After-Tax Equity figure and the waterfall, never in the tax math.

What does the Effective Total Tax Rate mean?

It is your total tax divided by your gross gain. It blends federal, state, local, NIIT, and recapture into one number. It is almost always lower than your top marginal rate, because the first slices of your gain get taxed at lower rates.

Why is my depreciation recapture rate under 25%?

On real estate, 25% is the cap, not a flat rate. Recapture on real estate is taxed at your ordinary income rates, but never above 25%.1 Depreciation on equipment, vehicles and other business property is taxed at your full ordinary rates.9 If you sit in the 22% bracket, part or all of the recapture is taxed at 22%, so the blended rate lands below 25%.

Do I still owe recapture if I never claimed depreciation on my rental?

Usually yes. Your basis goes down by the depreciation you could have deducted, not just what you claimed.7 Talk to a CPA. You may be able to fix past returns. If you enter $0 here, the calculator will show a lower tax than you may actually owe.

Is depreciation recapture taxed separately on a short-term sale?

No. Recapture is a long-term rule. Under short-term treatment, the whole gain, including the depreciation part, is already taxed at your ordinary income rates.

Which state do I pick if I live in one state and sold property in another?

Real estate is normally taxed by the state where the property is located. Pick that state. You may also owe tax in your home state, which may give you a credit for tax paid to the other state. Check with a tax pro for two-state sales.

Why is my federal tax $0 but I still owe state tax?

The federal 0% long-term bracket only applies to federal tax. Most states do not copy it. States like California tax gains as regular income from the first dollar, so you can owe state tax with zero federal tax due.

What counts as a capital improvement versus a repair?

An improvement adds value or extends the life of the asset: a new roof, an added room, a full kitchen remodel, new HVAC.8 A repair just keeps things working: patching a leak, painting, replacing broken hardware.8 Only improvements raise your basis and cut your tax.

Can I owe capital gains tax even if selling a rental leaves me no cash?

Yes. If your loan balance plus selling costs plus tax are more than your sale price, you bring money to closing. This happens most with a rental that has heavy depreciation and a large mortgage. You can owe tax on paper gain while getting little or no cash.

Does the Section 121 exclusion cover my rental depreciation?

No. The exclusion wipes out up to $250,000 or $500,000 of regular gain.3 But gain equal to the depreciation you claimed, or could have claimed, while renting the home after May 6, 1997 cannot be excluded.8 That part is taxed at up to 25%.1 The calculator pulls recapture out first, then applies the exclusion to what is left.

Is crypto really taxed the same as stocks?

Yes. The IRS treats crypto as property, and the general rules for property apply to it.11 So the same 0%, 15%, and 20% long-term rates apply.1 Trading one coin for another, or spending crypto on goods, gives you a capital gain or loss.11 Each of those is a taxable event with its own holding period.


Sources

  1. Topic no. 409, Capital gains and losses. Internal Revenue Service. Accessed September 10, 2026.
  2. Topic no. 559, Net investment income tax. Internal Revenue Service. Accessed September 10, 2026.
  3. Topic no. 701, Sale of your home. Internal Revenue Service. Accessed September 10, 2026.
  4. IRS releases tax inflation adjustments for tax year 2026, including amendments from the One, Big, Beautiful Bill. Internal Revenue Service. 2025;IR-2025-103. Accessed November 2, 2026.
  5. Revenue Procedure 2025-32. Internal Revenue Service. 2025;section 4.01 and 4.03 (2026 tax rate tables and maximum capital gains rate amounts). Accessed November 10, 2026.
  6. Revenue Procedure 2026-35. Internal Revenue Service. 2026;section 3.01 and 3.03 (2027 tax rate tables and maximum capital gains rate amounts). Accessed November 10, 2026.
  7. Publication 551, Basis of Assets. Internal Revenue Service. Cost Basis, Decreases to Basis (Depreciation) and Inherited Property. Accessed November 10, 2026.
  8. Publication 523, Selling Your Home. Internal Revenue Service. Figuring Gain or Loss (Improvements, Worksheet 2) and Business or Rental Use of Home. Accessed November 10, 2026.
  9. Publication 544, Sales and Other Dispositions of Assets. Internal Revenue Service. chapter 1 (Like-Kind Exchanges), chapter 3 (Section 1245 Property) and chapter 4 (Holding period: Inherited property, Gift). Accessed November 10, 2026.
  10. Estimated tax (frequently asked questions). Internal Revenue Service. When to pay estimated tax. Accessed November 10, 2026.
  11. Frequently asked questions on virtual currency transactions. Internal Revenue Service. Q2 and Q16. Accessed November 10, 2026.
  12. Topic no. 705, Installment sales. Internal Revenue Service. Reporting the sale on your tax return. Accessed November 10, 2026.