You can still use the capital gains exclusion if your home was used as a rental, but two things shrink what you actually keep tax-free: rental time before you moved in reduces the exclusion, and any depreciation you claimed (or were entitled to claim) during the rental years gets taxed separately at up to 25%. The base exclusion is $250,000 of gain for single filers and $500,000 for married couples filing jointly.1Office of the Law Revision Counsel. 26 USC 121 – Exclusion of Gain From Sale of Principal Residence Whether you rented first and then moved in, or lived there first and then rented it out, changes the math significantly.
The Two-of-Five-Year Tests
Before anything else, you have to clear two hurdles in the five-year window ending on the sale date. You must have owned the home for at least two of those five years, and you must have lived in it as your primary residence for at least two of those five years.2Internal Revenue Service. Publication 523 – Selling Your Home The 24 months of residence don’t have to run back-to-back; they can be spread across the five-year period.
For married couples filing jointly, only one spouse needs to meet the ownership test, but both spouses must independently meet the use test to claim the full $500,000. If only one qualifies, the couple is capped at $250,000. You also can’t use the exclusion more than once every two years.1Office of the Law Revision Counsel. 26 USC 121 – Exclusion of Gain From Sale of Principal Residence The $250,000 and $500,000 caps are fixed in the statute, not indexed for inflation, and haven’t changed since 1997.
Why the Order of Renting and Living Matters
Meeting the use test doesn’t guarantee the full exclusion. If part of your ownership involved renting, the IRS may treat that rental time as “nonqualified use,” covering any period after December 31, 2008, when the home was not your principal residence.3Office of the Law Revision Counsel. 26 USC 121 – Exclusion of Gain From Sale of Principal Residence Rental periods before January 1, 2009 are grandfathered and don’t reduce your exclusion at all. Gain allocated to nonqualified-use periods cannot be excluded, even if you otherwise pass both tests.
The statute carves out three exceptions that keep certain non-residence periods from counting against you:1Office of the Law Revision Counsel. 26 USC 121 – Exclusion of Gain From Sale of Principal Residence
- Any rental period that falls after your last day of using the home as a primary residence.
- Up to 10 years of absence while serving on qualified official extended duty in the military, intelligence services, or Peace Corps.
- Up to two years of absence for a job change, health condition, or unforeseen circumstances such as divorce or a natural disaster.
The first exception is where most homeowners get relief, and it’s why the order of events matters so much. Live in the home for three years and then rent it out for two years before selling, and the two rental years fall after your last day of residence, so they’re ignored. You still get the full exclusion (subject to depreciation recapture, discussed below).2Internal Revenue Service. Publication 523 – Selling Your Home Flip the timeline (rent for two years first, then live there for three), and those initial two rental years are nonqualified use that shrinks the exclusion.
Calculating the Reduced Exclusion
When nonqualified use applies, Publication 523’s Worksheet 3 uses a day-counting method.2Internal Revenue Service. Publication 523 – Selling Your Home The steps:
- Count total days after 2008 when neither you nor your spouse used the home as a primary residence, excluding any days that fall after your last day of residence within the five-year lookback.
- Count total days you owned the home (all days, not just post-2008 days).
- Divide the first number by the second. That’s your nonresidence fraction.
- Multiply your total capital gain by that fraction. The result is the portion of gain that cannot be excluded.
Take a single homeowner who bought a property on January 1, 2016, rented it out for four years, moved in on January 1, 2020, and sold on January 1, 2026, with a $200,000 gain. The four rental years came before residence, so they’re nonqualified use. The nonresidence fraction is roughly 4 divided by 10, or 40%. That makes $80,000 of the gain taxable and $120,000 excludable.
Depreciation Recapture Is a Separate Tax
Even if your entire gain fits inside the exclusion, depreciation creates its own bill. The exclusion does not apply to any gain attributable to depreciation taken after May 6, 1997.1Office of the Law Revision Counsel. 26 USC 121 – Exclusion of Gain From Sale of Principal Residence That depreciation is “recaptured” and taxed at up to 25% as unrecaptured Section 1250 gain.4Internal Revenue Service. Topic No. 409 – Capital Gains and Losses
The IRS applies an “allowed or allowable” standard. Even if you never actually claimed depreciation during the rental years, the agency assumes you did and requires recapture on the amount you were entitled to take.5Internal Revenue Service. Depreciation Recapture 3 Skipping the deduction doesn’t spare you from the tax; it just means you lost the deduction and still owe the recapture. If you rented a property and didn’t claim depreciation, ask a tax professional whether amended returns make sense before you sell.
Suppose a homeowner has a $300,000 gain and qualifies to exclude all of it under Section 121, but claimed $40,000 in depreciation during a prior rental period. The exclusion applies only to $260,000. The $40,000 of recaptured depreciation is taxed at up to 25%, producing a bill of up to $10,000 on gain that would otherwise be tax-free.
Tax Rates on the Gain You Cannot Exclude
Any gain that falls outside the exclusion, whether from nonqualified use, exceeding the cap, or both, is taxed at long-term capital gains rates if you owned the property for more than a year. For 2026, federal rates are 0%, 15%, or 20% depending on taxable income. Single filers pay 0% on gains up to $49,450, 15% between $49,450 and $545,500, and 20% above $545,500. Joint filers hit the 15% bracket at $98,900 and the 20% bracket at $613,700.
Higher earners face another layer. The 3.8% Net Investment Income Tax applies to individuals with modified adjusted gross income above $200,000 (single), $250,000 (joint), or $125,000 (married filing separately).6Internal Revenue Service. Topic No. 559 – Net Investment Income Tax Capital gains count as net investment income, so a joint-filing couple with $300,000 in income and a $100,000 non-excluded gain could owe the 3.8% surtax on part of that gain. The NIIT thresholds are not indexed for inflation.
Selling Before You Hit Two Years
If you sell before reaching the two-year residency mark, you may still qualify for a reduced exclusion when the sale was triggered by a job change, a health issue, or certain unforeseen circumstances.2Internal Revenue Service. Publication 523 – Selling Your Home The partial exclusion is a fraction of the full $250,000 or $500,000, based on how much of the two-year requirement you completed.
For a work-related move, your new job location must be at least 50 miles farther from the home than your previous workplace was. Health-related sales qualify when a doctor recommends a move or when the move is necessary for diagnosis, treatment, or recovery. Unforeseen circumstances include natural disasters, divorce, job loss, death, and involuntary conversion of the property. The IRS also allows a facts-and-circumstances argument for genuinely unforeseeable events that arose while you owned the home.
A single homeowner who lived in the property for 15 months before relocating for work could claim 15/24 of the $250,000 exclusion, or roughly $156,250.
If You Got the Home Through a 1031 Exchange
If you acquired the home through a like-kind exchange under Section 1031, the rules are stricter. You cannot claim the Section 121 exclusion at all during the first five years after acquiring the replacement property.1Office of the Law Revision Counsel. 26 USC 121 – Exclusion of Gain From Sale of Principal Residence The five-year clock starts on the acquisition date, regardless of when you move in.
After five years, you still need to meet the ownership and use tests, and the nonqualified use rules still apply to any post-2008 rental periods that came before your residential use. Any depreciation that was deferred in the original 1031 exchange also follows the property. When you sell, that deferred depreciation is recaptured at up to 25%, even if you’ve lived in the home for years.
Reporting the Sale
Expect several forms beyond your standard return. The closing agent will generally issue a Form 1099-S reporting the sale proceeds, though an exception exists when the price is $250,000 or less ($500,000 for married filers) and the seller certifies the full gain is excludable.7Internal Revenue Service. Instructions for Form 1099-S (Rev. December 2026) If any portion of your gain is taxable, you won’t qualify for that exception.
Capital gains from the sale are reported on Form 8949 and flow to Schedule D of Form 1040.8Internal Revenue Service. Instructions for Form 8949 Depreciation recapture on property used for business or rental purposes is reported on Form 4797, Part III, which separates the ordinary-income portion (recaptured depreciation) from the capital gain.9Internal Revenue Service. Instructions for Form 4797 Splitting excluded gain, taxable capital gain, and recaptured depreciation correctly is where most errors happen, and the notices tend to arrive a year later. On a mixed-use property sale, a tax professional’s fee is usually worth it.