The capital gains formula for property
The core calculation has two steps:
Step 1 — Calculate adjusted basis:
Adjusted basis = Purchase price + acquisition closing costs + capital improvements − accumulated depreciation
Step 2 — Calculate gain:
Amount realized = Selling price − selling costs
Capital gain = Amount realized − adjusted basis
Step 3 — Allocate gain to tax tiers (rental property):
Unrecaptured §1250 gain = total straight-line depreciation taken (taxed at maximum 25%)
§1231 gain = total gain minus unrecaptured §1250 gain (taxed at 0%/15%/20%)
Each of these tiers is taxed at different rates, so you need to know which bracket you fall into for both the 25%-rate portion and the long-term capital gains portion. The income thresholds for the 0%, 15%, and 20% long-term capital gains rates adjust annually—always check the current-year IRS tables.
Inputs needed for an accurate calculation
To accurately calculate capital gains on a property sale, you need:
1. Selling price: The contract price at which the property sold.
2. Selling costs: Real estate commissions, title fees, transfer taxes, attorney fees, and other seller-paid closing costs. These reduce your amount realized.
3. Original purchase price: The contract price you paid, plus any acquisition closing costs you capitalized at purchase.
4. Capital improvements: The total cost of improvements made during the ownership period that were capitalized (not expensed as repairs). This adds to your basis.
5. Accumulated depreciation: The total depreciation deductions you claimed (or were entitled to claim) over the ownership period. Check your tax returns or depreciation schedule. This reduces your basis.
6. Holding period: Whether you held the property more than one year (long-term) or one year or less (short-term). Short-term gains are taxed as ordinary income.
7. Your taxable income: Determines which long-term capital gains bracket applies (0%, 15%, or 20%). You need your estimated total taxable income for the year of the sale to determine the applicable rate.
Worked example: $450,000 sale with depreciation
An investor purchased a single-family rental in 2019 for $250,000 (land: $50,000; building: $200,000). Over approximately 7.5 years, MACRS depreciation on the building totals $54,545 ($200,000 ÷ 27.5 × 7.5 years). During ownership, the investor made capital improvements totaling $40,000 (new HVAC and kitchen remodel). The property sells in 2026 for $450,000, with selling costs of $27,000.
Step 1 — Adjusted basis:
Original cost: $250,000
+ Capital improvements: $40,000
− Accumulated depreciation: $54,545
= Adjusted basis: $235,455
(Note: the $40,000 of improvements also generate their own depreciation—in this simplified example, we are using only the building's MACRS depreciation. In practice, each improvement may generate additional depreciation deductions that also reduce basis. The total accumulated depreciation across all components would be used.)
For this example, let's use a total accumulated depreciation of $65,700 reflecting all components:
Revised adjusted basis: $250,000 + $40,000 − $65,700 = $224,300.
Step 2 — Gain calculation:
Amount realized: $450,000 − $27,000 selling costs = $423,000
Gain: $423,000 − $224,300 = $198,700
Step 3 — Tier allocation:
Unrecaptured §1250 gain: $65,700 (total depreciation, taxed at max 25%)
§1231 gain: $198,700 − $65,700 = $133,000 (taxed at LT rates)
Step 4 — Approximate federal tax (investor in 15% LT bracket):
Tier 2: $65,700 × 25% = $16,425
Tier 3: $133,000 × 15% = $19,950
NIIT (if applicable): $198,700 × 3.8% = $7,551
Approximate total federal tax: ~$43,926
For the 20% long-term rate: $133,000 × 20% = $26,600 in Tier 3, bringing total to approximately ~$50,576 before NIIT.
Common calculator mistakes to avoid
Using selling price instead of amount realized: Always deduct selling costs before calculating the gain. Many investors accidentally use the gross selling price, which overstates the amount realized and understates the amount by which selling costs benefit them.
Forgetting accumulated depreciation: Depreciation is often the largest adjustment to basis on a long-held rental. Skipping it significantly understates the gain. Pull your prior tax returns or ask your CPA for the accumulated depreciation schedule before running the numbers.
Ignoring the depreciation recapture tier: Many investors assume all of the gain is taxed at the long-term capital gains rate. For a rental property, the depreciation portion is taxed at a higher rate (up to 25%). Using only the long-term rate for all gain understates the tax liability.
Using one rate for all income levels: If your overall income for the year of the sale pushes you into the 20% long-term capital gains bracket, the gain is taxed at 20%—not 15%. Estimate your total taxable income for the year, including the sale, before applying a rate.
Ignoring state taxes: Most states tax capital gains as ordinary income at rates that can be significant—California taxes capital gains at up to 13.3%, for example. Always include state tax in your full estimate.
How to use the Capital Gains Tax Calculator
Our Capital Gains Tax Calculator requires the following inputs:
Purchase price, capital improvements, accumulated depreciation, selling price, selling costs, holding period (check "long-term" for more than one year), your filing status, and your estimated taxable income for the year of sale. The calculator applies the applicable federal rates to each tier of gain and can include an estimate for state taxes.
The calculator output shows: total gain, breakdown of unrecaptured §1250 gain vs. §1231 gain, estimated federal tax on each tier, and estimated total tax. For planning purposes, try different selling prices or different holding periods to see how the tax changes.
Frequently asked questions
What is the formula for capital gains on a property sale?
Capital gain = Amount Realized − Adjusted Basis. Amount Realized = Selling price − selling costs. Adjusted Basis = Purchase price + improvements − accumulated depreciation. For rental property, the gain splits into unrecaptured §1250 gain (equal to prior depreciation, taxed at max 25%) and §1231 gain (appreciation, taxed at long-term 0%/15%/20% rates).
What inputs do I need to calculate capital gains on a property?
You need: original purchase price, capital improvements, accumulated depreciation, selling price, selling costs, holding period, and your taxable income for the year. State taxes require knowing your state of residence and the state where the property is located.
Does the capital gains calculator account for depreciation recapture?
Yes, a complete calculator for real property calculates unrecaptured Section 1250 gain separately. Enter your total accumulated depreciation as an input. The calculator applies the 25% maximum rate to the depreciation portion and the 0%/15%/20% long-term rate to the appreciation portion of the gain.
Can a calculator tell me exactly how much capital gains tax I owe?
A calculator gives a reliable estimate but not a precise final number, because your actual tax depends on your total income picture for the year—other gains and losses, ordinary income, deductions, and state rules. Use the estimate for planning; have a CPA calculate the precise liability for filing purposes.
Educational information and estimates only. Not tax advice. Tax rules change and vary by situation; consult a qualified tax professional before acting.
