How the calculator works
This page lists every formula, default and tax rule the sell or rent calculator uses, and what it leaves out. Last reviewed: October 2026.
The comparison
Let N be the number of years you rent the home before selling. The model compares your wealth at the end of year N on two paths. It runs month by month and reports by year. All tax is federal; add a state rate to the rate fields if you want to include it.
Path A: sell now
proceeds = value × (1 − selling cost %)
adjusted basis = purchase price + capital improvements
gain = proceeds − adjusted basis
tax = (gain − Section 121 exclusion) × capital gains rate [+ 3.8% NIIT if selected]
net now = proceeds − mortgage balance − tax
wealth (sell) = net now × (1 + r)^Nr is the after-tax return you set for invested cash. It’s treated as an effective annual rate and compounded monthly at (1 + r)^(1/12) − 1, so 12 months give exactly 1 + r. If you are underwater, “net now” is negative and compounds as money you would have to bring to closing.
Path B: rent, then sell at the end of year N
For each month in year y (counting from 1):
rent collected = rent × (1 + rent growth)^(y−1) × (1 − vacancy)
management = management fee % × rent collected
maintenance = maintenance % × value at start of year y ÷ 12
fixed costs = [(property tax + insurance) ÷ 12 + HOA + other] × (1 + cost growth)^(y−1)
mortgage P&I = from the amortization schedule (split into interest and principal)
pre-tax cash flow = rent collected − management − maintenance − fixed costs − mortgage P&IFor each year:
depreciable basis = min(adjusted basis, value today) × (1 − land share)
depreciation = depreciable basis ÷ 27.5 (stops once the full basis is used)
taxable rental = rent − management − maintenance − fixed costs − mortgage interest − depreciation
rental tax = max(0, taxable rental) × marginal rate [+ 3.8% NIIT if selected]Each month, the after-tax cash flow (pre-tax cash flow minus one twelfth of that year’s rental tax) goes into a cash account that earns r. A negative flow is money you add; it reduces the account and is charged the same return as an opportunity cost.
At the end of year N the home is sold:
sale price = value × (1 + appreciation)^N
proceeds = sale price × (1 − selling cost %)
gain = proceeds − (adjusted basis − depreciation taken)
recapture = min(depreciation taken, gain) ← never excluded
rest = gain − recapture ← eligible for Section 121 if you qualify
tax = recapture × min(marginal rate, 25%) + (rest − exclusion) × capital gains rate
wealth (rent) = proceeds − remaining mortgage − tax + cash accountThe difference is wealth (rent) − wealth (sell). If it is less than 2% of the larger of the two figures, the result is shown as too close to call.
The Section 121 rule, exactly as modeled
To exclude gain on a home sale, you must have owned the home and used it as your main home for at least 2 of the 5 years ending on the date of sale (IRS Publication 523). The cap is $250,000, or $500,000 for married filing jointly. These amounts are set in the tax code and aren’t indexed for inflation.
If you’ve lived in the home for L years up to the day you convert it to a rental, then after renting for N years the qualifying use inside the 5-year window is:
qualifying use = max(0, min(L, 5 − N))
eligible = it is your main home today and qualifying use ≥ 2- With at least 2 years lived there, you stay eligible if you rent for 3 years or fewer.
- Rent for more than 3 years and the exclusion is lost entirely for that sale. The calculator shows the extra tax this causes, computed by running the sale with and without the exclusion.
- Rental time after your last day living there isn’t “nonqualified use”, so selling within the window keeps the full exclusion (Publication 523, Business or Rental Use of Home).
- Depreciation taken after May 6, 1997 is never excluded, so it is taxed even inside the window.
- If you answer “No” to “Is it your main home right now?”, no exclusion is applied.
Simplification: the model counts whole years and assumes the sale closes exactly at the end of year N. The real test counts days (730 of the 1,825 before the sale), so a sale at exactly 3 years is right on the boundary. In practice, close with a margin.
Other tax rules used
- Depreciation: residential rental property, straight-line over 27.5 years. Basis is the lesser of adjusted basis or fair market value at conversion, excluding land (Publication 527).
- Unrecaptured section 1250 gain: taxed at a maximum 25% (Topic 409). The model uses the lower of your marginal rate and 25%.
- Capital gains: one rate you choose (default 15%). 2026 brackets are 0% / 15% / 20%, with 15% starting above $49,450 single or $98,900 married filing jointly and 20% above $545,500 or $613,700 (Rev. Proc. 2025-32).
- NIIT: 3.8% on rental profit and taxable gain, if you tick the box. It applies when modified AGI exceeds $200,000 single or $250,000 married filing jointly; excluded home-sale gain isn’t subject to it (Topic 559).
- Basis: purchase price plus capital improvements (Topic 703). Selling costs reduce the amount realized (Publication 523).
- Mortgage: fixed rate, monthly rate = annual rate ÷ 12, standard amortization. If you enter your own payment, it’s used as-is until the loan is repaid.
Break-even rent and sensitivity
Break-even rent is the starting monthly rent at which the difference is zero, with everything else unchanged. The difference rises steadily with rent, so the calculator finds it by bisection between $0 and a high bound (at least five times your rent or 3% of the home’s value per month), in at most 40 steps. If renting wins even at $0, or selling still wins at the top of the range, it says so instead.
The sensitivity tables rerun the full model with rent at −10%, your figure and +10%, appreciation at 1%, your figure and 5%, and the investment return 2 points either side of yours.
Defaults
Every default is an example you should replace. They describe a typical mid-priced home with a loan taken out a few years ago; they are not national averages.
| Input | Default | Notes |
|---|---|---|
| Current home value | $450,000 | |
| Mortgage balance | $280,000 | Enter 0 if paid off. |
| Mortgage rate | 4% | |
| Years left on mortgage | 25 | |
| Expected monthly rent | $2,800/mo | Look at what similar homes nearby are listed for now. |
| Years you'd rent it before selling | 5 | |
| Years lived in it as main home | 5 | Counted up to the day you move out. |
| Monthly principal and interest (optional) | Calculated | Leave blank to calculate it from balance, rate and term. Exclude escrow for tax and insurance. |
| Original purchase price | $340,000 | Include purchase closing costs you paid, if you know them. |
| Capital improvements to date | $10,000 | Additions and upgrades, not repairs. |
| Home appreciation per year | 3% | |
| Rent growth per year | 3% | |
| Vacancy | 5% | Share of the year the home sits empty. 5% is about 2.5 weeks. |
| Property management fee | 8% | % of rent collected. Use 0 if you manage it yourself. |
| Maintenance and repairs | 1% | % of home value per year. |
| Property tax per year | $5,400 | |
| Insurance per year | $1,800 | A landlord policy usually costs more than a homeowner policy. |
| HOA per month | $0/mo | |
| Other costs per month | $0/mo | Utilities you cover, lawn care, permits. |
| Growth of tax, insurance and fees | 3% | |
| Selling costs | 7% | Agent commission plus closing costs, % of sale price. |
| After-tax return on invested cash | 5% | What the sale money would earn elsewhere, after tax. |
| Marginal income tax rate | 22% | Federal plus state rate on extra income. |
| Long-term capital gains rate | 15% | Federal 0%, 15% or 20%, plus any state tax. |
| Land share of value | 20% | Land can't be depreciated. Your property tax bill may split land and building. |
| Main home today | Yes | Drives the Section 121 test. |
| Filing status | Single | $250,000 cap; married filing jointly is $500,000. |
| Net investment income tax | Off | Turn on if your income is above the thresholds. |
The growth of tax, insurance and fees input isn’t in every calculator: it stops fixed costs staying flat for decades while rent grows, which would flatter renting.
Simplifications
- Rent, value-based maintenance and fixed costs step up once a year rather than every month.
- Depreciation starts in full from the first month; the IRS mid-month convention is ignored.
- Rental tax is paid in 12 equal monthly amounts during the year it’s earned.
- A rental tax loss counts as $0 tax for that year. Losses aren’t carried forward or used against other income.
- A loss on a sale produces no tax and no deduction.
- Capital gains and income tax use flat rates you choose, not the full bracket calculation.
- The investment return is after tax and the same in both paths.
- The home value grows at a constant rate; there’s no market cycle.
- Whole years only for the rental period and the Section 121 test.
What the model does not do
- Passive-activity loss limits, the $25,000 allowance and carryforwards (Publication 925).
- State and local income taxes, transfer taxes, or state rules on rental income.
- 1031 like-kind exchanges.
- Refinancing, cash-out refinancing, HELOCs, or adjustable-rate mortgages.
- Partial or reduced exclusions (for job moves, health or unforeseen circumstances).
- Moving back in, or nonqualified use before the last period you lived there.
- Prior rental use, home office depreciation, or depreciation claimed before the conversion.
- Your housing costs after moving out (they’re the same on both paths, so they cancel out).
- Mortgage insurance, escrow shortfalls, eviction costs, or major one-off repairs.
- Inflation adjustment of the final figures. Both are in future dollars, so the comparison is still fair.
Testing
The engine is a framework-free TypeScript module with unit tests. Expected values come from textbook mortgage figures and a separate implementation written in Python with decimal arithmetic. The tests cover amortization, the exclusion cap, a full year of rental costs, depreciation and recapture, the 3-year cliff, break-even rent, edge cases such as zero rates and a 30-year hold, and share links.
This is a decision aid, not tax, legal or financial advice. Last reviewed: October 2026.