Rental Property Capital Gains Tax Calculator: With Recapture, Social Security and Medicare
Short answer: a rental sale is taxed in layers. The depreciation you took (or could have taken) comes back as unrecaptured Section 1250 gain at up to 25%, the rest of the profit is long-term capital gain at 0/15/20%, the 3.8% net investment income tax usually applies, and your state adds its own tax.
Retired landlords have one more layer. The big one-year gain raises the income that taxes your Social Security and sets your Medicare premium two years later. This calculator prices all of it. For depreciation recapture alone, use the recapture calculator.
By Hans Goldstein, EA, Enrolled Agent, enrolled to practice before the IRS. Updated December 2026.
2027 federal brackets (IRS Rev. Proc. 2026-35), SSA Section 86 thresholds, CMS 2027 Medicare premiums and IRMAA tiers, state rates as of December 2026. Estimates, not tax advice.
Worked example
A married couple, both 65, sell a rental house for $900,000. They paid $400,000, spent $50,000 on improvements, took $210,000 of depreciation and pay $54,000 in selling costs, with a $250,000 loan paid off at closing. They collect $44,000 of Social Security and have $60,000 of other income.
| Worked example | Amount |
|---|---|
| Taxable gain | $606,000 |
| Federal tax on the gain | $105,426 |
| Net investment income tax (3.8%) | $17,229 |
| California tax on the gain | $52,741 |
| Tax most calculators show | $175,396 |
| Extra tax on Social Security the sale makes taxable ($0 more taxable) | $0 |
| Medicare Part B + D surcharge two years later | $13,174 |
| Real cost | $188,570 |
The three layers of a rental property sale
- Depreciation recapture (unrecaptured Section 1250 gain). The depreciation you took lowered your basis, so the sale gives it back. It is taxed at your ordinary rate up to a 25% ceiling.
- Long-term capital gain. Profit above the original basis is taxed at 0%, 15% or 20% for 2027.
- Net investment income tax and state tax. 3.8% applies on income over $200,000 single or $250,000 married. States tax the gain as income, with California at up to 13.3%.
You owe the recapture even if you never claimed depreciation: the IRS taxes what you were allowed to take.
What most rental property calculators leave out
For a landlord in or near retirement, the same one-year gain also counts in provisional income, which can make up to 85% of Social Security taxable, and it counts in the Medicare income two-year lookback. The result above breaks those out so you can see the cost of selling this year versus spreading or deferring.
Passive-activity rules can help: any suspended passive losses from the property are deductible in full in the year of a fully taxable sale. Enter them by lowering your other income to model the effect.
Ways landlords reduce or defer the bill
The common tools are a Section 1031 exchange, a Section 453 installment sale, a Delaware statutory trust reinvestment that qualifies as like-kind property, and for some sellers an Opportunity Zone fund for the capital gain portion. Each has trade-offs on control, liquidity and cost. Read about retiring landlord tax options before choosing.
Frequently asked questions
How much is capital gains tax on a rental property?
Federal long-term gain is taxed at 0%, 15% or 20% in 2027. The part of the gain that equals the depreciation you took is taxed at up to 25%. Add 3.8% NIIT for higher incomes and your state tax. The calculator above combines them.
How is depreciation recapture calculated on a rental?
Add up the depreciation allowed (about the building value divided by 27.5 for each year of service for residential rental). That amount of your gain is unrecaptured Section 1250 gain taxed at up to 25%.
Do I pay capital gains if I sell a rental property at a loss?
No capital gains tax. A loss on rental property used in a business can generally offset other income, and passive losses suspended in earlier years are released at sale.
How do I avoid capital gains on a rental property?
You generally cannot avoid it, but you can defer or spread it: a Section 1031 exchange, an installment sale, or a Delaware statutory trust purchase that qualifies as like-kind property. Holding until death gives heirs a stepped-up basis.
Does selling a rental property affect Social Security and Medicare?
A large gain raises provisional income, which can make up to 85% of your Social Security taxable that year, and raises the income Medicare uses two years later for Part B and D surcharges. The calculator prices both.
Does the 3.8% tax apply to rental property sales?
Usually yes, above $200,000 of income for single filers and $250,000 for joint filers, unless you qualify as a real estate professional who materially participates; your CPA should confirm.
Run it on your real return
A free 15-minute call with Hans Goldstein: which levers fit your sale, what the Social Security and Medicare effects look like on your actual numbers, and what to ask your CPA.
Book 15 minutes 213-414-2808Educational estimate, not tax, legal or financial advice. Figures use 2027 federal brackets and thresholds (IRS Rev. Proc. 2026-35), the Social Security benefit-taxation rules in IRC Section 86, CMS 2027 Medicare premiums and IRMAA tiers, and state rates as of December 2026 (California uses the FTB 2026 schedule until the 2027 schedule is published). Later Medicare years hold the 2027 tiers flat. Your CPA should confirm any figure before you act. By Hans Goldstein, EA, Enrolled Agent (enrolled to practice before the IRS), reviewed December 2026.