Selling Your House and Buying a New One: Tax Rules You Should Know
The Myth That Refuses to Die
Before the Taxpayer Relief Act of 1997, there was a provision that let homeowners defer capital gains tax by rolling the proceeds into a new, more expensive home within two years. People over 55 got a one-time $125,000 exclusion. Both rules were scrapped almost three decades ago.
They were replaced by Section 121 of the Internal Revenue Code, which is actually more generous for most people. Under the current law, you can exclude up to $250,000 of gain ($500,000 if married filing jointly) when you sell your primary residence — and you don’t have to buy another home to get the exclusion. You could sell, pocket the cash, rent an apartment, move to another country, or buy a boat. The exclusion applies regardless of what you do with the proceeds.
We still get clients every week who think they need to buy a replacement home to avoid taxes. They don’t. The purchase of your next home is a completely separate transaction for tax purposes.
Section 121: The Rules That Actually Apply
To qualify for the capital gains exclusion on your home sale, you need to meet two tests (per IRS Publication 523):
- Ownership test: You owned the home for at least 2 of the 5 years before the sale
- Use test: You lived in the home as your primary residence for at least 2 of the 5 years before the sale
The two years don’t need to be consecutive, and the ownership and use periods don’t need to overlap perfectly. You could buy a home, rent it out for two years, move in for two years, and sell after four — you’d still qualify.
Married couples filing jointly can exclude up to $500,000 if both spouses meet the use test and at least one meets the ownership test. If only one spouse meets both tests, the exclusion drops to $250,000.
You can use this exclusion repeatedly — just not more than once every two years. There’s no lifetime cap, no age restriction, and no requirement to report the sale if the entire gain is excluded and you didn’t receive a Form 1099-S (though we recommend reporting it anyway).
Calculating the Gain on Your Home Sale
The gain isn’t just sale price minus purchase price. You need to account for selling costs and your adjusted basis. Here’s the formula:
Amount Realized = Sale Price minus selling expenses (broker commissions, transfer taxes, attorney fees)
Adjusted Basis = Original purchase price + acquisition costs + capital improvements – any depreciation claimed
Capital Gain = Amount Realized minus Adjusted Basis
For a detailed walkthrough with numbers, see our capital gains tax calculator guide. The short version: track every capital improvement you make to your home. That $35,000 bathroom renovation, the $12,000 new roof, the $8,000 deck — all of it increases your basis and reduces your taxable gain.
What Happens When You Sell at a Loss
Bad news here. If your home sells for less than you paid (adjusted basis), you can’t deduct the loss. The IRS doesn’t allow losses on the sale of personal-use property per IRC §165(c). It doesn’t matter how much you lost — $10,000 or $200,000 — a loss on your primary residence is not tax-deductible.
This asymmetry frustrates a lot of homeowners. Gains above the exclusion are taxable, but losses aren’t deductible. The tax code treats your home as a consumption asset, not an investment, for loss purposes.
There’s one exception worth knowing: if you converted your primary residence to a rental property before selling, and you sold it as a rental property at a loss, that loss may be deductible. The rules are specific — your basis for the loss calculation is the lower of your original basis or the fair market value on the date of conversion. Talk to a CPA before assuming a converted property loss is deductible, because the math isn’t intuitive.
Partial Exclusion When You Haven’t Met the 2-Year Requirement
Life doesn’t always cooperate with tax timelines. If you need to sell your home before living there for two full years, you might still qualify for a partial exclusion under one of these circumstances (per IRC §121(c)):
- Change in employment: Your new job is at least 50 miles farther from the home than your old job was
- Health reasons: A doctor recommends the move, or you’re moving to care for a family member
- Unforeseen circumstances: Divorce, death, natural disaster, multiple births (twins or more), job loss, inability to pay the mortgage
The partial exclusion is prorated. If you lived in the home for 15 months out of the required 24, you get 15/24 of the full exclusion. For a single filer, that’s $156,250 instead of $250,000. For a married couple, $312,500 instead of $500,000.
You don’t need IRS approval to claim the partial exclusion. Just meet one of the qualifying circumstances and calculate the prorated amount on your return.
Reporting the Sale Even When It’s Fully Excluded
If the closing agent issues a Form 1099-S (which reports the gross proceeds of the sale), you need to report the transaction on your tax return — even if your entire gain is excluded under Section 121. You’ll report it on Form 8949 and Schedule D, show the exclusion as an adjustment, and the net taxable gain will be zero.
Skipping the reporting when you received a 1099-S is a mistake. The IRS will see the 1099-S and, without a matching entry on your return, they’ll assume you failed to report taxable income. That triggers a CP2000 notice, and now you’re spending time responding to an audit that could have been avoided with a few extra lines on your return.
Mortgage Interest Deduction on Your New Home
When you buy your next home, the mortgage interest deduction is one of the tax benefits people think about most. The current rules (under the Tax Cuts and Jobs Act per IRC §163(h), which runs through 2025) allow you to deduct interest on up to $750,000 of mortgage debt used to buy, build, or substantially improve your primary residence or second home. For mortgages originated before December 15, 2017, the limit is $1,000,000.
The deduction only helps if you itemize. Since the standard deduction is $15,000 for single filers and $30,000 for married couples in 2025, many homeowners — especially those with smaller mortgages — don’t have enough itemized deductions to make itemizing worthwhile. A $300,000 mortgage at 7% generates about $21,000 in interest the first year. Add property taxes (capped at $10,000 SALT per IRC §164(b)(6)) and state income taxes, and a married couple might barely clear the $30,000 standard deduction threshold.
If TCJA extended through 2034 by the One Big Beautiful Bill Act, the mortgage interest limit reverts to $1,000,000 and the standard deduction drops. That would change the math for a lot of buyers. Worth watching.
Moving Expenses: No Longer Deductible for Most People
Before 2018, you could deduct moving expenses if your new job was at least 50 miles farther from your old home than your old job was. TCJA suspended this deduction per IRC §217(k) for everyone except active-duty military members. That suspension runs through 2025.
If you’re moving for a job and you’re not military, your moving costs are not deductible. Your employer can reimburse you, but the reimbursement is taxable income (again, except for military). This catches people off guard, especially those relocating for work who remember the old rule.
After 2025, the moving expense deduction might come back if TCJA sunsets. But for now, plan on absorbing those costs without a tax break.
Timing Considerations When Selling and Buying
While buying another home doesn’t affect your capital gains tax, timing still matters for other reasons.
Property Tax Proration
When you sell, property taxes are prorated between buyer and seller at closing. If you close mid-year, you’ll get credit for the portion of the year the buyer owns the home. This isn’t a tax deduction issue — it’s a cash flow issue at closing. But it affects how much property tax you can deduct on your return for that year.
Year-End Sales
Selling in December versus January of the following year can shift a large capital gain into a different tax year. If you had unusually high income this year, waiting until January might land the gain in a lower tax bracket next year. Or vice versa. This is basic tax planning, but people forget about it when they’re focused on the real estate transaction itself.
The 2-Year Clock
If you’re planning to sell your next home eventually, the 2-year clock for Section 121 starts when you move in. Buying a home and renting it out before moving in yourself delays the start of the use test. Living in it immediately starts the clock, giving you maximum flexibility on timing the eventual sale.
1031 Exchanges Don’t Apply to Your Personal Home
A 1031 exchange lets you defer capital gains tax by reinvesting sale proceeds into a like-kind property. But it only works for investment or business property per IRC §1031. Your personal residence doesn’t qualify.
There’s one scenario where Section 121 and 1031 can overlap: if you convert your primary residence to a rental property, rent it for a qualifying period, then sell it through a 1031 exchange. You might be able to exclude the gain attributable to the years you lived there (under Section 121) and defer the remaining gain (under 1031). This is advanced planning that requires precise timing and documentation. Don’t try it without a CPA walking you through the requirements.
What to Do Before You List Your Home
Get your records together before you talk to a real estate agent. You’ll want documentation for your original purchase (closing statement/HUD-1 or Closing Disclosure), every capital improvement you’ve made (receipts, contractor invoices, permits), and any depreciation you’ve claimed if you rented the property or took a home office deduction.
Run the gain calculation early. If your gain is well under the $250,000/$500,000 exclusion, you’re in the clear and there’s not much tax planning to do. If your gain exceeds the exclusion — common in New York, San Francisco, and other high-appreciation markets — talk to a tax advisor before closing. There may be strategies to reduce the taxable portion: timing the sale, making the most of your basis with documented improvements, or structuring the transaction differently.
The worst time to find out you owe $60,000 in capital gains tax is after you’ve already spent the proceeds on your next down payment.
Related Services from The Reed Corporation
Helpful Guides You Might Also Like
Sources & References
Frequently Asked Questions
Do I have to buy a new home to avoid paying capital gains tax on the sale of my house?
No. This is one of the most persistent myths in real estate, and it trips people up every single year. You do not have to buy a new home to avoid capital gains tax on the sale of your primary residence. The tax break you are thinking of is the Section 121 exclusion, which lets you exclude up to $250,000 in profit from the sale if you are single, or up to $500,000 if you are married filing jointly. And there is no requirement to reinvest that money into another property. You can sell your house, pocket the profit, and move into a rental apartment. You can use the money to pay off debt, fund your retirement account, or take a vacation. The IRS does not care what you do with the proceeds as long as you meet the ownership and use tests.
The ownership and use tests require that you owned the home and used it as your primary residence for at least two of the five years before the sale. Those two years do not need to be consecutive. If you bought a house in 2019, lived in it for all of 2019 and 2020, then moved out and rented it from 2021 through 2024, and sold it in 2025, you would still qualify for the exclusion because you lived in it for two of the five years before the sale (2020 and 2021 both fall within the five-year window ending in 2025).
The confusion comes from an old tax rule that was repealed in 1997. Before 1997, the tax code had a provision under Section 1034 that allowed you to defer capital gains tax on a home sale only if you bought a replacement home of equal or greater value within two years. That rollover rule created the widespread belief that you must buy another home to avoid tax. Congress replaced it with the current Section 121 exclusion, which is simpler and more generous. But the old rule is so deeply embedded in public consciousness that real estate agents and even some financial advisors still repeat it as fact decades later.
Let me put some real numbers on this. Say you bought your house in 2015 for $320,000 and sold it in 2025 for $580,000. Your gain is $260,000 ($580,000 minus $320,000, before adjustments). If you are single, you can exclude $250,000, leaving $10,000 subject to capital gains tax. If you are in the 15% long-term capital gains bracket, that is $1,500 in federal tax on a $260,000 gain. If you are married filing jointly, the entire $260,000 gain is excluded because it falls under the $500,000 threshold. Either way, you do not need to buy another house.
The exclusion can be used repeatedly, but not more than once every two years. If you sell your house in January 2025 and claim the exclusion, you cannot claim it again on another home sale until at least January 2027. Some people have used this strategically by buying a fixer-upper, living in it for two years while renovating, selling at a profit, claiming the exclusion, and repeating the process. The IRS is aware of this pattern and does not prohibit it as long as each home genuinely served as your primary residence for the required period.
There are situations where you might qualify for a partial exclusion even if you did not meet the full two-year requirement. If you sold the home due to a change in employment, health reasons, or unforeseen circumstances, you may be eligible for a reduced exclusion based on the fraction of the two-year period you actually met. For example, if you lived in the home for one year (half of the two-year requirement) before relocating for a new job, you could potentially exclude half of the maximum amount, which would be $125,000 for a single filer or $250,000 for married filing jointly.
The 1031 exchange, which does require you to buy a replacement property, applies only to investment properties and business properties, not your primary residence. If you are selling a rental property or commercial building, a 1031 exchange can defer capital gains tax by rolling the proceeds into a like-kind replacement property. But that is a completely different rule from the Section 121 exclusion for your personal home. Do not confuse the two, and be wary of anyone who conflates them.
If your gain exceeds the exclusion amount, only the excess is taxed. A married couple who sells their primary residence for a $650,000 profit would exclude the first $500,000 and pay capital gains tax on the remaining $150,000. At the 15% federal rate, that is $22,500 in tax on a $650,000 gain. And if you live in a state with no income tax like Texas, Florida, or Nevada, there is no state tax on top of that. In California, you would also owe state capital gains tax on the $150,000 at rates up to 13.3%, adding another $12,000 to $20,000 depending on your overall income.
If you are selling a home that was jointly owned by a married couple but one spouse passed away, the surviving spouse gets a special break. The surviving spouse can still claim the $500,000 exclusion (rather than just $250,000) as long as the sale occurs within two years of the spouse’s death and the surviving spouse has not remarried. This provision exists because Congress recognized that a surviving spouse often needs to sell the family home during the grieving process and should not be penalized for doing so.
Another point worth mentioning: the Section 121 exclusion applies per sale, not per year. So if you somehow own and live in two primary residences (which is rare but can happen during transitions), you can only use the exclusion on one sale within any two-year period. The IRS does not allow you to exclude $250,000 on House A and another $250,000 on House B in the same year. The two-year waiting period between exclusion uses prevents this kind of stacking.
Home sellers who used part of their home for business purposes, like a dedicated home office or a rental unit in a duplex, face a more complicated calculation. The portion of the home used for business may not qualify for the Section 121 exclusion, and depreciation claimed on the business portion must be recaptured. If you ran a business from a room that was 15% of your home’s square footage, roughly 15% of the gain might not be excludable. Talk to a tax professional before selling a home with business use to understand how the exclusion applies to your specific situation.
How long do I have to live in my house to avoid capital gains tax?
You need to have owned and lived in the home as your primary residence for at least two out of the five years immediately before the sale. This is the “ownership and use test” under Section 121 of the Internal Revenue Code, and both parts need to be met. You must have owned the property for at least two years, and you must have used it as your main home for at least two years. Those periods can overlap, and they do not need to be consecutive.
Here is what “not consecutive” means in practical terms. Suppose you bought a condo in January 2020 and lived in it until December 2021 (two full years). Then you moved across the country for a job in January 2022 and rented out the condo for three years. You sell it in December 2024. Even though you have not lived there since 2021, you still meet the use test because you lived there for two of the five years before the sale (2020 and 2021 are within the five-year lookback window ending in December 2024). You also meet the ownership test because you have owned it since 2020.
The two-year requirement is measured in months, and the IRS is relatively precise about it. You need at least 24 months of use as your primary residence during the 60-month period ending on the date of sale. Short temporary absences, like a two-week vacation or a month-long business trip, count toward the 24 months. But a sustained absence, like moving out for eight months to renovate a different property, does not count as residence time.
Active duty military members get a special exception. Under the Military Family Tax Relief Act, you can suspend the five-year lookback period for up to ten years while on qualified official extended duty. This means a service member who bought a home, lived in it for two years, and then was deployed for eight years could still qualify for the full exclusion when they sell the home, even though the sale occurs well outside the normal five-year window. The suspension is elected on the tax return for the year of sale, and both the ownership and use tests are subject to the suspension.
People in nursing homes or assisted living facilities also get some flexibility. If you lived in your home for at least one year during the five-year period and spent the remainder of the time in a licensed care facility, the IRS treats you as having met the two-year use test. This provision helps elderly homeowners who had to move to a care facility and could not sell their home right away.
Married couples who file jointly need to be careful about the ownership and use tests when one spouse owned the home before the marriage. For the $500,000 exclusion to apply, both spouses must meet the use test (each must have lived in the home for at least two of the past five years), but only one spouse needs to meet the ownership test. So if one partner owned the home for five years but the other moved in only after the wedding 18 months before the sale, the couple would not qualify for the $500,000 exclusion because the newer spouse did not meet the two-year use test. They could still claim a $250,000 exclusion based on the qualifying spouse’s eligibility.
Partial exclusions are available if you sell before meeting the full two-year requirement due to qualifying circumstances. The IRS recognizes three categories: change in place of employment (you or your spouse got a new job more than 50 miles from the home), health reasons (a doctor recommended the move for medical purposes), or unforeseen circumstances (natural disasters, divorce, death, job loss, or other events the IRS considers unforeseeable). If you qualify, your exclusion is prorated based on how much of the two-year period you actually met.
For example, if you lived in the home for 15 months (out of the 24-month requirement) and sold due to a qualifying job relocation, your exclusion would be 15/24 of the full amount, which is 62.5%. For a single filer, that means a $156,250 exclusion instead of $250,000. For a married couple filing jointly, it would be $312,500 instead of $500,000. The partial exclusion can still save thousands of dollars in tax even though it is less than the full amount.
One point that confuses people: the date you close on the sale is the date that matters for calculating the five-year lookback, not the date you listed the property or accepted an offer. If you listed your home in November and the sale closes in January of the following year, the five-year period is measured back from January. This can work in your favor if you are trying to hit the two-year mark and need a few extra months. Timing your closing date to fall after you reach 24 months of residence could save you a significant amount in capital gains tax.
Divorced homeowners face unique timing challenges. If your divorce decree awards the home to one spouse, and that spouse later sells it, the IRS allows the selling spouse to count the time they owned and lived in the home before the divorce toward the two-year requirement. But if the non-owner spouse lived in the home under a divorce decree requiring the other spouse to allow them to reside there, the non-owner spouse also counts that period as “use” for Section 121 purposes. This prevents divorced individuals from losing the exclusion just because of the timing of their divorce.
Members of the Peace Corps, intelligence community, and certain government employees on foreign assignments also qualify for the extended lookback period, similar to military members. If your government service required you to live abroad, you can suspend the five-year lookback period for up to ten years. This is important for diplomats, foreign service officers, and intelligence operatives who may own a home in the U.S. but spend most of their career overseas.
If you are approaching the two-year mark and thinking about selling, consider the financial consequences of waiting a few extra months versus selling early with a partial exclusion. On a $200,000 gain with a single filer at the 15% capital gains rate, the difference between a full exclusion and no exclusion is $30,000 in federal tax. If waiting three more months to reach the two-year mark means saving $30,000, that is almost certainly worth the wait unless there are pressing financial reasons to sell immediately.
Can I deduct the loss if I sell my house for less than I paid?
No. If you sell your primary residence for less than you paid for it, you cannot deduct that loss on your tax return. This is one of those areas where the tax code feels genuinely unfair. The IRS taxes gains on your home (at least the portion above the exclusion), but it does not let you write off losses. The rule is straightforward: losses on the sale of personal-use property are not deductible. Your primary home is considered personal-use property, so any loss you take on the sale is simply absorbed.
This rule applies regardless of how large the loss is. If you bought your house in 2007 at the peak of the market for $450,000 and sold it in 2012 for $280,000, that $170,000 loss is not deductible. The IRS did not create any special provision for homeowners who lost money during the housing crisis, despite widespread advocacy for such relief. The personal-use property loss rule has been in the code for decades, and Congress has never changed it for primary residences.
The reasoning behind the rule is that the IRS treats your primary home as a consumption asset, similar to a car or furniture. When you sell a car for less than you paid, you do not get a tax deduction for the loss. The IRS views your home the same way, even though most people think of their home as an investment. The Section 121 exclusion, which lets you exclude up to $250,000 or $500,000 of gain, is the flip side of this treatment. The IRS gives you a generous break on gains but does not allow deductions for losses.
There is one important exception: if you converted your primary residence into a rental property before selling it, you may be able to deduct the loss. When a home is used for business or rental purposes, it is no longer personal-use property, and losses on business property are deductible. However, the calculation is complicated. Your loss is measured from the property’s adjusted basis at the time of conversion (which is the lower of your original purchase price or the fair market value when you converted it to rental use), not from your original purchase price.
Here is an example of how the conversion works. You bought a house for $400,000 in 2018. In 2021, when the house was worth $350,000, you moved out and started renting it. Your basis for the rental property is $350,000 (the lower of your $400,000 cost or the $350,000 fair market value at conversion). You depreciated the property for four years, taking $50,909 in depreciation deductions ($350,000 divided by 27.5 years times four years). Your adjusted basis is now $299,091. If you sell in 2025 for $310,000, your gain is $10,909 ($310,000 minus $299,091). If you sell for $280,000, your loss is $19,091 ($280,000 minus $299,091), and that loss is deductible against other income.
But notice something: the $50,000 loss between your original purchase price ($400,000) and the value when you converted ($350,000) is never deductible. That loss occurred while the property was personal-use, so it falls under the non-deductible rule. You only get to deduct losses that occur after the conversion to rental use. This is a subtle but important distinction that catches a lot of people off guard.
Some homeowners facing a potential loss try a different strategy: they rent out the home for a couple of years, claim depreciation deductions along the way, and then sell. This can work if the property generates positive rental income and if the market recovers enough to reduce the eventual loss. But renting out a home creates its own tax obligations, including reporting rental income on Schedule E, tracking expenses, and potentially paying self-employment tax if you provide substantial services to tenants.
If you are thinking about selling a home at a loss, it is worth considering whether waiting for the market to recover is financially viable. Holding costs like property taxes, insurance and mortgage interest add up, and there is no guarantee the market will recover on a specific timeline. A tax professional can help you run the numbers comparing the cost of holding the property versus selling at a loss and moving on. In some cases, the emotional and financial burden of holding onto an underwater property is not worth the theoretical tax benefit of eventually breaking even.
Also be aware that if you bought your home with a down payment assistance program or a subsidized mortgage, selling at a loss might trigger repayment obligations under those programs. Some first-time buyer programs require you to repay the assistance if you sell within a certain number of years, regardless of whether you sell at a gain or loss. Check your loan documents and program agreements before listing the property.
If you are in a situation where you owe more on your mortgage than the home is worth (often called being “underwater”), selling at a loss has additional complications beyond the tax treatment. If the lender forgives the difference between what you owe and what the home sells for in a short sale, the forgiven debt may be treated as taxable income. The Mortgage Forgiveness Debt Relief Act originally provided an exclusion for forgiven mortgage debt on a primary residence, but that provision has expired and been temporarily extended multiple times. Check whether the exclusion is available for the year of your sale, or consult with a tax advisor.
Homeowners who took out home equity lines of credit (HELOCs) and used the funds for non-home purposes face additional issues. If the HELOC was used to buy a car or pay off credit cards, the forgiven debt from a short sale on the HELOC portion may not qualify for any debt forgiveness exclusion, even if one is available. The IRS looks at how the borrowed funds were actually used, not just the fact that the debt was secured by the home. This distinction has caught many homeowners off guard during and after the housing downturn.
Some states do allow deductions for losses on the sale of a primary residence under certain conditions, though this is rare. Most states conform to the federal treatment, which means losses are not deductible. But it is worth checking your state’s tax code or asking your tax preparer, particularly if you live in a state with unique tax provisions. A few states have considered legislation to allow loss deductions on primary residences, though none have passed such measures as of this writing. Selling your primary home at a loss is a financial setback with no federal tax silver lining.
Do I have to pay capital gains tax on the sale if I use all the money for a down payment on a new house?
No, using the money from your home sale as a down payment on a new house does not determine whether you owe capital gains tax. What matters is whether you qualify for the Section 121 exclusion, which depends on how long you owned and lived in the home, not what you do with the sale proceeds. This is another myth that traces back to the pre-1997 tax rules. Under the old Section 1034 rollover provision, you could defer capital gains tax only if you reinvested the proceeds into a replacement home of equal or greater value within two years. That rule was eliminated in 1997, and the current exclusion applies regardless of whether you buy another home.
Here is a real scenario. You bought a townhouse in 2019 for $275,000 and sell it in 2025 for $425,000. Your gain is $150,000. You are single and meet the two-year ownership and use test. The entire $150,000 gain is excluded under Section 121, and you owe zero capital gains tax. It does not matter whether you use the $425,000 in sale proceeds to buy a $500,000 house, put it all in a savings account, or spend it on a boat. The tax treatment is the same regardless of how you spend the money.
Now consider a different scenario where the gain exceeds the exclusion. You are married and sell your home for a $600,000 profit. The first $500,000 is excluded, and you owe capital gains tax on the remaining $100,000. Using the entire sale proceeds as a down payment on a new house does not reduce or defer that $100,000 taxable gain. You will owe approximately $15,000 in federal capital gains tax (at the 15% rate) regardless of what you do with the money. Some people are shocked to learn this at closing, especially in hot real estate markets where gains above $500,000 are not unusual for long-term homeowners.
The only mechanism in current tax law that allows you to defer capital gains by reinvesting in another property is the Section 1031 exchange, and that applies only to investment properties, not personal residences. If you sell a rental property and buy a like-kind replacement property through a properly structured 1031 exchange, you can defer the capital gains tax indefinitely. But you cannot use a 1031 exchange for your primary home. The two provisions, Section 121 for primary residences and Section 1031 for investment properties, are completely separate.
There are scenarios where combining both sections can be beneficial. Suppose you owned a home, lived in it for three years, then converted it to a rental and rented it out for four years before selling. You might qualify for a partial Section 121 exclusion (because you lived there for at least two of the last five years, depending on timing) and also be able to do a 1031 exchange on the investment portion. The interaction between these two code sections is complicated and requires careful planning with a tax advisor. Getting it wrong can cost tens of thousands of dollars in unnecessary tax.
What about state taxes? Most states follow the federal Section 121 exclusion rules. If your gain is fully excluded at the federal level, it is typically excluded at the state level too. But some states have quirks. California conforms to Section 121, so gains under $250,000 (single) or $500,000 (married) are excluded from both federal and state tax. But California taxes any excess gain at its regular income tax rates, which can be as high as 13.3%. On a $100,000 taxable gain after the federal exclusion, a California resident in the top bracket could owe another $13,300 in state tax on top of the $15,000 federal tax.
Closing costs and improvements to the home reduce your taxable gain. Your basis in the home is not just what you paid for it. You can add the cost of permanent improvements like a kitchen remodel, a new roof, an addition, or new windows. You can also add certain closing costs from when you purchased the home, like title insurance, recording fees, and transfer taxes. Keeping receipts for home improvements over the years is extremely important because those costs directly reduce your capital gains when you sell. A $40,000 kitchen renovation and $15,000 roof replacement would reduce your taxable gain by $55,000, which at a 15% tax rate saves you $8,250 in federal tax alone.
Real estate agent commissions also reduce your gain because they are treated as selling expenses. If you pay 5% to 6% in agent commissions on a $500,000 sale, that is $25,000 to $30,000 that comes off the top of your proceeds before calculating your gain. On a sale where the gain is near the exclusion threshold, these selling expenses can push the taxable portion to zero.
Sellers in hot real estate markets sometimes face the opposite problem: their gain is so large that even the $500,000 exclusion does not cover it. In San Francisco, Seattle, or New York, a home purchased 20 years ago for $300,000 might sell for $1.5 million today, resulting in a gain of over $1 million. After the $500,000 exclusion for a married couple, $700,000 is still taxable. At the 20% federal rate plus the 3.8% net investment income tax, the federal tax alone is $166,600. Add California state tax at 13.3%, and another $93,100 is due to the state. The total tax bill approaches $260,000 on a $1.2 million gain. That is money that is not available for a down payment on the next home, regardless of the seller’s intentions.
First-time home buyer programs and FHA loans have their own rules about where your down payment comes from. If you use proceeds from a home sale, you may need to document the source of funds for your mortgage application. This is a lending requirement, not a tax requirement, but it is worth mentioning because sellers who plan to use their profits for a down payment need to keep clean records of the sale proceeds. Bank statements showing the deposit from escrow, the HUD-1 settlement statement, and any wire transfer confirmations should be retained.
If you sell one home and buy another in the same tax year, the two transactions are completely independent for tax purposes. Your gain or loss on the sale is calculated separately from your purchase. There is no provision that links the two transactions, and no tax benefit to buying and selling in the same year versus different years. The only timing consideration is whether you meet the two-year ownership and use test for the Section 121 exclusion on the property you are selling, which has nothing to do with when you buy the replacement home.
If I rent out my home for a few years before selling, do I still get the exclusion?
It depends on the timing. You can still qualify for the Section 121 exclusion even if you rented out your home before selling, as long as you lived in the home as your primary residence for at least two of the five years immediately before the sale. The IRS does not care that you rented it out during part of that five-year window. What matters is whether you hit the 24-month residency requirement within the lookback period.
Here is a common scenario. You bought a house in 2018 and lived in it as your primary residence through 2022, five full years. In January 2023, you moved to a different city for work and started renting out the house. You kept renting it until you sold it in December 2025. The five-year lookback period is January 2021 through December 2025. During that window, you lived in the home from January 2021 through December 2022, which is two full years. You qualify for the exclusion even though the home was a rental for the three years before the sale.
But push the timeline out further and you lose the exclusion. If instead of selling in December 2025, you wait until June 2026, the five-year lookback shifts to July 2021 through June 2026. You lived in the home from July 2021 through December 2022, which is about 18 months. That is less than two years, so you would not qualify for the full exclusion. You might qualify for a partial exclusion if you moved for qualifying reasons, but the full $250,000 or $500,000 exclusion would not be available. The timing of the sale relative to when you moved out is extremely important, and missing the window by even a few months can cost you tens of thousands of dollars in tax.
When you rent out your home and later sell it, there is a wrinkle involving depreciation recapture. While the property is rented, you are required to take depreciation deductions on your tax return (or if you did not take them, the IRS treats you as if you did). When you sell, any depreciation you claimed (or should have claimed) after May 6, 1997 must be “recaptured” and reported as income, taxed at a maximum rate of 25%. The Section 121 exclusion does not cover depreciation recapture.
Let me put numbers on this. You bought a house for $300,000, lived in it for four years, then rented it for three years. During the rental period, you claimed $32,727 in depreciation ($300,000 divided by 27.5 years times 3 years). You sell the house for $450,000. Your gain before the exclusion is $150,000 ($450,000 minus $300,000). But you also need to recapture the $32,727 in depreciation. Under Section 121, you can exclude the $150,000 gain (well under the $250,000 limit for single filers), but you still owe tax on the $32,727 depreciation recapture at 25%, which is about $8,182 in federal tax. Many homeowners who rent their property before selling are blindsided by this depreciation recapture tax because they expected the entire gain to be excluded.
The depreciation recapture issue has led some tax planners to recommend that homeowners who plan to rent their property for a short period before selling consider NOT claiming depreciation. However, the IRS rule states that depreciation must be recaptured whether or not you actually claimed it (the “allowed or allowable” rule). If you were entitled to take $32,727 in depreciation but chose not to, the IRS still recaptures $32,727 when you sell. The only way to avoid this is to not rent the property at all, or to live in it for long enough after the rental period that the depreciation is minimal relative to the gain.
State tax treatment of depreciation recapture varies. California taxes depreciation recapture as ordinary income at rates up to 13.3%. In that case, the $32,727 recapture could generate an additional $4,353 in state tax on top of the $8,182 federal tax. Combined, you are looking at about $12,500 in tax on a gain that most people assumed would be fully excluded. This is why tax planning before converting your primary residence to a rental is so important.
If you rented the home for a significant period and the property has appreciated substantially, you might also consider a 1031 exchange for the rental portion of the gain. Some tax advisors structure a sale to take advantage of both Section 121 (for the portion attributable to personal use) and Section 1031 (for the portion attributable to rental use). This combined approach is complex and requires careful documentation of when the property was used for each purpose. Not all tax professionals are familiar with this strategy, so make sure you work with someone who has experience with mixed-use property sales.
One more thing to be aware of: if you rented the home at below-market rates to a family member, the IRS may not consider those years as rental use for purposes of depreciation. Renting to a relative for less than fair market value is treated as personal use, not rental use. So if you “rented” your house to your adult child for $500 a month when the market rate was $2,000, the IRS would treat those years as personal use, which means no depreciation deductions but also no depreciation recapture when you sell.
The nonqualified use rules, added by the Housing Assistance Tax Act of 2008, add another layer of complexity for homes that were rented before being used as a primary residence. If you bought a home, rented it out for a few years, then moved into it as your primary residence, any gain allocated to the pre-primary-residence rental period is not eligible for the Section 121 exclusion. However, rental use that occurs after you have used the home as your primary residence does not count as nonqualified use. This asymmetry is important for people who buy investment properties with the intention of eventually moving into them.
For example, if you bought a condo in 2018 and rented it for three years (2018-2020), then moved in as your primary residence in 2021 and sold in 2025, the three years of rental use before your primary residence use would be nonqualified use. If your total gain is $200,000 over a seven-year ownership period, roughly 3/7 of the gain ($85,714) would be nonqualified and not eligible for exclusion. The remaining 4/7 ($114,286) would be eligible for the exclusion and would be fully excluded because it falls under the $250,000 limit for single filers.
Sources & References
IRC §121 — Exclusion of Gain from Sale of Principal Residence (Cornell Law)
IRS Publication 523 — Selling Your Home
IRC §1031 — Exchange of Real Property Held for Productive Use or Investment (Cornell Law)
IRC §163(h) — Mortgage Interest Deduction (Cornell Law)
IRC §165(c) — Limitation on Losses for Individuals (Cornell Law)
Taxpayer Relief Act of 1997 (Congress.gov)
IRS Form 8949 — Sales and Other Dispositions of Capital Assets
← Helpful GuidesReed Corporation Home