How Long Do You Have to Buy Another Home to Avoid Capital Gains?

If you’re selling your primary residence, there is no deadline to buy another home, because federal law no longer requires a replacement purchase to avoid capital gains tax. The Section 121 exclusion lets a single filer shield up to $250,000 of gain and a married couple filing jointly up to $500,000, whether you buy another house, rent an apartment, or move in with family.1Office of the Law Revision Counsel. 26 USC 121 – Exclusion of Gain From Sale of Principal Residence The strict timelines people associate with this question, 45 days and 180 days, belong to a different rule entirely: the 1031 like-kind exchange, which applies to investment property and does require you to buy a replacement.

Selling Your Primary Home: No Replacement Required

Before 1997, the tax code did force homeowners to roll their proceeds into a replacement home of equal or greater value to defer capital gains. Congress scrapped that rule when it enacted Section 121. Under current law, you sell, take your gain up to the exclusion cap, and owe no federal capital gains tax on the excluded portion. What you do with the money afterward is your business.

Single filers exclude up to $250,000 of gain. Married couples filing jointly exclude up to $500,000, provided at least one spouse meets the ownership requirement, both spouses meet the use requirement, and neither spouse claimed the exclusion on another home sale within the past two years.1Office of the Law Revision Counsel. 26 USC 121 – Exclusion of Gain From Sale of Principal Residence Anything above the cap is taxable at long-term capital gains rates if you owned the home for more than a year.

What You Actually Have to Do to Qualify

Instead of a purchase deadline, Section 121 imposes ownership and use tests. During the five-year period ending on the sale date, you must have owned the home for at least two years and lived in it as your primary residence for at least two years. The two years do not need to be consecutive, and the ownership and use periods do not need to overlap.2Internal Revenue Service. Topic No. 701, Sale of Your Home The IRS counts a cumulative 730 days for each test within that five-year window.3Internal Revenue Service. Publication 523 (2025), Selling Your Home

You also cannot have used the Section 121 exclusion on a different home sale during the two years before this one.1Office of the Law Revision Counsel. 26 USC 121 – Exclusion of Gain From Sale of Principal Residence Meet the tests, stay under the cap, and the sale is tax-free at the federal level regardless of what you buy next, or whether you buy anything at all.

Partial Exclusion When You Sell Early

If you sell before hitting two years of ownership or use, you may still qualify for a reduced exclusion when the sale is driven by a job change, health issues, divorce, or other circumstances beyond your control. The reduced amount is proportional: divide the months you actually owned and lived in the home by 24, then multiply by the full exclusion. A single filer who lived in the home for 12 months before a qualifying job relocation could exclude up to $125,000 rather than the full $250,000.

Special Situations

Some readers arrive at this question through unusual circumstances. If you received the home from a spouse or former spouse in a divorce-related transfer, you inherit their ownership time toward the two-year test. If your former spouse continues to live in the home under a divorce decree, the IRS treats that as your use as well.1Office of the Law Revision Counsel. 26 USC 121 – Exclusion of Gain From Sale of Principal Residence

A surviving spouse can still claim the full $500,000 exclusion if the home is sold within two years of the other spouse’s death, provided the joint-exclusion requirements were satisfied immediately before the death. After that two-year window, the surviving spouse drops to the $250,000 single-filer cap.1Office of the Law Revision Counsel. 26 USC 121 – Exclusion of Gain From Sale of Principal Residence

Members of the uniformed services, the Foreign Service, and the intelligence community can suspend the five-year lookback for up to 10 years while on qualified official extended duty stationed at least 50 miles from home or living in government housing under orders for more than 90 days or an indefinite period.2Internal Revenue Service. Topic No. 701, Sale of Your Home A service member deployed for eight years can still sell and claim the full exclusion because the clock was paused.

If Your Gain Exceeds the Exclusion

Buying a new house does not shelter the excess. Any gain above the $250,000 or $500,000 cap is simply long-term capital gain if you owned the home for more than a year, taxed at 0%, 15%, or 20% depending on your taxable income. For single filers in 2026, the 15% rate begins above $49,450 of taxable income and 20% above $545,500; for married joint filers, the thresholds are $98,900 and $613,700.4Internal Revenue Service. Topic No. 409, Capital Gains and Losses

Two things reduce the taxable amount, and neither has anything to do with buying another home. Selling expenses come off the sale price: real estate commissions, advertising costs, legal fees, and any loan charges you paid that were normally the buyer’s responsibility. And your adjusted basis increases with every qualifying improvement over the years: a new bathroom, a replaced roof, central air conditioning, a deck, landscaping, a kitchen remodel. Routine repairs generally do not count, but repair work done as part of a larger remodeling project can.3Internal Revenue Service. Publication 523 (2025), Selling Your Home Homeowners who held property for decades in appreciating markets are the ones most likely to exceed the exclusion cap, and documented improvements are what keep the excess manageable.

Investment Property: The 1031 Deadlines

Everything above applies only to a home you actually lived in. Rental property, commercial buildings, and land held for investment get no Section 121 exclusion. The only way to defer capital gains on that type of real estate is a like-kind exchange under Section 1031, and it does require you to acquire a replacement, on a clock.5Office of the Law Revision Counsel. 26 USC 1031 – Exchange of Real Property Held for Productive Use or Investment

A 1031 exchange only covers real property held for use in a trade or business or for investment. It does not cover your personal residence, a vacation home used primarily for personal enjoyment, or property held as inventory (a flipper’s stock).

45 Days to Identify

Starting the day after closing on the sale of your relinquished property, you have exactly 45 calendar days to identify potential replacement properties in writing. That written identification must reach your Qualified Intermediary before midnight on day 45.5Office of the Law Revision Counsel. 26 USC 1031 – Exchange of Real Property Held for Productive Use or Investment Miss it by a day and the exchange fails; the gain becomes immediately taxable. These are calendar days. Weekends and holidays do not extend them.

You can identify replacement properties under one of three rules:

  • Three-property rule: up to three properties regardless of value.
  • 200-percent rule: any number of properties, as long as their combined fair market value does not exceed 200% of the value of the property you sold.
  • 95-percent rule: any number at any value, but you must actually acquire at least 95% of the total value of everything you identified.6eCFR. 26 CFR 1.1031(k)-1 – Treatment of Deferred Exchanges

Most investors use the three-property rule because it avoids value calculations. The 95-percent rule is a fallback when the other two are exceeded, and it is unforgiving: identify $2 million in properties and you must close on at least $1.9 million worth.

180 Days to Close

You must receive the replacement property and close within 180 calendar days of selling the relinquished property. The 180-day clock runs concurrently with the 45-day identification period, not after it. Weekends and holidays do not extend it either.5Office of the Law Revision Counsel. 26 USC 1031 – Exchange of Real Property Held for Productive Use or Investment

One trap catches investors who sell late in the year. If your tax return due date arrives before the 180 days expire, the exchange period ends on the return due date unless you file an extension. Sell in October 2026 and your 180 days would stretch into April 2027, overlapping the April 15 filing deadline. Filing an extension costs nothing and preserves the full 180 days.

You Cannot Touch the Money

A Qualified Intermediary must hold the sale proceeds and facilitate the exchange. This is not optional. If you take possession of the funds at any point, even briefly, the IRS treats it as constructive receipt and the exchange is disqualified. The exchange agreement with the QI must be signed before closing on the relinquished property. Report the completed exchange on IRS Form 8824 with your federal return for the year of sale.7Internal Revenue Service. Instructions for Form 8824 (2025)

One Boundary Worth Knowing

Investors sometimes try to combine both regimes: acquire a property through a 1031 exchange, later move into it, then sell it under the Section 121 exclusion. The tax code allows this, but it imposes a five-year waiting period from the acquisition date before the primary-residence exclusion becomes available, and you still have to meet the standard two-out-of-five-year ownership and use tests.1Office of the Law Revision Counsel. 26 USC 121 – Exclusion of Gain From Sale of Principal Residence It is a long strategy, not a quick way to convert an investment sale into a tax-free home sale.

For an ordinary home sale, the short answer holds: no clock is running against you to buy another home. The clock only starts when the property was investment real estate and you’re using Section 1031 to defer the gain.