Publication 523 Summarized — Selling Your Home
Publication 523 Selling Your Home: Main points
- Section 121 allows individuals to exclude up to $250,000 of gain ($500,000 for married filing jointly) on the sale of a main home, but only if the ownership and use tests are met.
- The exclusion is not automatic — it depends on how long the seller owned and lived in the home, and whether the exclusion was used on a prior sale within the last two years.
- Gain is calculated as the difference between the amount realized and the adjusted basis, which means home improvements and certain settlement costs directly affect the tax result.
- Special situations — including divorce, death of a spouse, military service, and prior home office use — can modify eligibility, the exclusion amount, or the gain calculation itself.
Common Mistakes to Avoid
- Assuming no gain exists because the sale price is close to the original purchase price, without accounting for depreciation previously claimed on a home office or rental portion.
- Failing to track home improvements that increase basis, which directly reduces taxable gain.
- Believing the exclusion applies to any property the taxpayer owns rather than only to the main home where the ownership and use tests are satisfied.
- Not realizing that a partial exclusion may be available when a taxpayer sells before meeting the full two-year requirement due to a qualifying change in employment, health, or unforeseen circumstances.
Section-by-Section Summary
How the section 121 exclusion works for home sellers
The section 121 exclusion is the primary tax benefit available to homeowners who sell their main residence at a gain. The publication explains that a single filer can exclude up to $250,000 of gain and a married couple filing jointly can exclude up to $500,000, provided both spouses meet the use test and at least one meets the ownership test. The exclusion is available each time a main home is sold, but generally no more frequently than once every two years. Understanding this framework is the first step before calculating whether any gain is taxable. For how this fits into the broader return, see our guide to how Form 1040 tax returns work.
Why the ownership and use tests are central to eligibility
To qualify for the full exclusion, the taxpayer must have owned the home for at least two of the five years before the sale (the ownership test) and must have used it as their main home for at least two of those five years (the use test). These two years do not need to be consecutive. For Publication 523 Selling Your Home, the publication walks through how periods of ownership and use are counted, and explains that both tests must be met independently. Failing either test typically disqualifies the taxpayer from the full exclusion, although a partial exclusion may still be available in certain circumstances.
How gain is calculated on a home sale
Gain on a home sale equals the amount realized (sale price minus selling expenses) minus the adjusted basis. The adjusted basis starts with the original purchase price plus certain settlement and closing costs, then increases for capital improvements (additions and major systems replacements) and decreases for any depreciation allowed or allowable (such as from a home office deduction or rental use). The publication emphasizes that recordkeeping for improvements is essential because these adjustments directly reduce the taxable gain. Many taxpayers lose basis simply because they cannot document improvements made years earlier.
What partial exclusions are and when they apply
If a taxpayer sells their main home before meeting the full two-year ownership and use requirements, a partial exclusion may still be available if the sale was due to a change in place of employment, a health condition, or certain unforeseen circumstances (such as divorce, death, or natural disaster). The partial exclusion is calculated as a proportion of the full exclusion based on how much of the two-year period was actually completed. The publication lists specific qualifying events and explains how to compute the reduced exclusion amount.
How special situations like divorce and military service affect the rules
Publication 523 devotes significant attention to how the exclusion rules are modified in special circumstances. When a spouse dies, the surviving spouse may be able to use the $500,000 exclusion if the sale occurs within two years of death and other conditions are met. In divorce situations, the publication explains how ownership and use periods can be attributed between former spouses depending on the terms of the decree. For military and certain government personnel, the five-year lookback period can be extended up to ten years, providing more flexibility in meeting the use test after extended absences.
Why basis adjustments and home improvements matter
The difference between a taxable gain and a fully excluded gain often comes down to basis. Capital improvements — not routine maintenance or repairs — increase the home’s adjusted basis and which reduce the gain. The publication helps taxpayers distinguish between improvements (which add basis) and repairs (which do not). It also explains how casualty losses, insurance reimbursements, and energy credits can affect basis. Keeping organized records of all improvement expenditures throughout the period of ownership is one of the most practical pieces of advice the publication offers.
How Publication 523 works with capital gains reporting on Schedule D
If the gain on the sale exceeds the exclusion amount, or if the taxpayer does not qualify for the exclusion, the gain must be reported on Schedule D and may also require Form 8949. The publication explains when reporting is required even if the entire gain is excluded (generally, it is not required if the full gain is excluded and Form 1099-S was not received). When depreciation recapture applies — for example, from a home office deduction taken under the actual method — that portion of the gain cannot be excluded and must be reported separately. Understanding how tax brackets apply to the taxable portion helps in planning.
How readers should use the publication before or after selling a home
The publication is most valuable when read before the sale closes, because decisions about timing and documentation can affect the tax result. After the sale, the publication helps determine whether the exclusion applies, how much gain is taxable, and what forms need to be filed. In practice, taxpayers who read Publication 523 after the fact often discover that they missed basis-increasing improvements or did not properly track their use periods. Proactive reading prevents the most common and expensive mistakes.
How to Use This Publication
Begin with the eligibility sections to determine whether you meet the ownership and use tests. If you do, move to the gain calculation sections to understand how your basis is determined and what your actual gain is. If your gain exceeds the exclusion, review the reporting requirements on Schedule D. If you sold before meeting the full two-year tests, check whether a partial exclusion applies.
In practice, Publication 523 is one of the most frequently consulted IRS publications because home sales are common and the dollar amounts involved are large. Practitioners use it to verify exclusion eligibility, compute adjusted basis, and determine whether any reporting is required even when the full gain is excluded.
For related context, see our guides on how Form 1040 tax returns work and how tax brackets work.
Last updated: April 2026. This is a general summary. The official IRS publication contains complete rules, examples and exceptions. Readers should review it directly and seek professional advice where facts are complex.
Related Services from The Reed Corporation
Helpful Guides You Might Also Like
Sources & References
Frequently Asked Questions
What does IRS Publication 523 cover, and who needs it?
Publication 523, Selling Your Home, walks you through the tax treatment of selling your main home. The heart of it is the home sale exclusion, a rule that lets most people sell their primary residence and pay zero federal tax on a big chunk of the profit. If you sold the place you live in this year, or you are about to, this is the document that tells you whether you owe anything and what to report.
The short version: a single filer can exclude up to 250,000 dollars of gain from the sale of a main home, and a married couple filing jointly can exclude up to 500,000 dollars. Gain is not the same as the sale price. It is your sale price minus selling costs minus what the IRS calls your adjusted basis, which we break down in another answer below. So a number that looks scary on the closing statement often shrinks to a small taxable figure, or to nothing at all, once the exclusion runs.
To qualify you have to clear two hurdles the IRS calls the ownership test and the use test. You must have owned the home and lived in it as your main home for at least 2 of the 5 years before the sale. Those two years do not have to be one continuous stretch. You can add up months of living there across the five year window. For a married couple, both spouses must meet the use test, but only one needs to meet the ownership test. There is also a frequency limit: you generally get the full exclusion only once every 2 years, so you cannot flip houses every spring and exclude each one.
The publication also explains the situations that trip people up. If you used part of the home as a rental or for business, the depreciation you took complicates things, because that portion does not get the same break. If you sold early because of a job move or a health problem, you may still get a partial exclusion rather than losing it outright. And it covers the reporting question that confuses a lot of sellers: when you actually have to put the sale on your tax return versus when you can leave it off. People assume every sale gets reported, and that is not how it works.
Basis is the other big theme. The publication spends real time on how to figure your adjusted basis, because that single number drives the size of your gain. It ties directly to Publication 551, Basis of Assets, which is the companion document for tracking what you paid and what you added in improvements. The two pubs work as a pair, and reading one without the other tends to leave gaps.
Who needs Publication 523? Anyone selling a primary residence with real appreciation, anyone who lived in the home less than two years, anyone who rented it out at some point, and anyone who got a Form 1099-S from the closing agent. If your gain is small and you have lived there a long time, the rules usually work in your favor and the paperwork is light. If you are sitting on a large gain in a hot market, the difference between getting the exclusion right and getting it wrong can be tens of thousands of dollars. New York City sellers feel this especially, because long held apartments and brownstones can carry gains that blow past the limits.
We handle home sale reporting all the time as part of individual tax return preparation. The earlier you loop us in, ideally before you sign the listing agreement, the more room there is to plan around the exclusion limits. Read the publication first, then bring your closing documents and we will tell you exactly where you stand.
How do the ownership and use tests work for the home sale exclusion?
The home sale exclusion in Publication 523 hinges on two tests, and you have to pass both to claim the full amount. The ownership test asks whether you owned the home. The use test asks whether you actually lived in it as your main home. The threshold for each is the same: at least 2 years out of the 5 year period ending on the date of the sale.
Here is the part people miss. The two years do not have to be back to back. The IRS lets you count up nonconsecutive periods. Say you lived in the home for 14 months, moved out and rented it to a tenant for a stretch, then moved back in for 11 months before selling. Those 25 months of personal use can satisfy the use test even though there was a gap in the middle, as long as it all falls inside the five years before the sale. The same flexibility applies to ownership.
For a married couple filing jointly, the rules split. Both spouses have to meet the use test, meaning each of you lived in the home for the required time. But only one spouse needs to meet the ownership test. This matters when one person bought the house before marriage and the other moved in later. As long as both lived there two years and at least one held title for two years, the couple can claim the full 500,000 dollar exclusion. If only one spouse qualifies under the use test, the couple is generally limited to the 250,000 dollar single amount.
There is a separate timing limit layered on top. You generally can claim the full exclusion only once every 2 years. So if you sold a main home last year and excluded the gain, you usually cannot turn around and exclude the gain on a second sale within the two year window. This rule exists to stop people from treating the exclusion like a recurring tax holiday on serial house flips.
What counts as your main home? It is the place you live most of the time. If you own more than one property, the IRS looks at where you spend the most days, where you are registered to vote, where your mail goes, and similar facts. A vacation house you visit a few weeks a year is not your main home, and selling it does not qualify for this exclusion at all. That is one of the most common and most expensive misunderstandings we see.
A few exceptions can bend these rules. Members of the armed forces and certain government workers on qualified official extended duty can suspend the five year test for up to ten years, which helps people who get stationed far from a home they still own. Surviving spouses get a window to claim the full 500,000 dollar exclusion after the death of a spouse, generally if they sell within two years and meet the other conditions. And if you fall short of two years for a reason the IRS accepts, a partial exclusion may apply, which the next answer covers in detail.
One more practical point. The IRS does not ask you to attach proof of the tests to your return, but it can ask later. Keep what shows when you bought, when you moved in, and when you sold, such as deeds, closing statements, and utility bills, so a later question turns into a quick reply.
Running the math on whether you pass these tests is worth doing carefully before you sell, not after. If you are close to the two year line, waiting a few extra months can be the difference between a fully tax free sale and a large bill. We have seen sellers list in month 22 and cost themselves a six figure exclusion they would have had at month 24. This is exactly the kind of timing question we work through in tax strategy consulting before a closing date gets locked in.
How do I calculate my gain, and why does my basis matter so much?
Gain is the number that gets taxed, and a lot of sellers compute it wrong because they focus on the sale price instead of the gain. The formula in Publication 523 is simple to state: gain equals your sale price, minus your selling expenses, minus your adjusted basis. Get the basis right and you often shrink the taxable number to nothing.
Selling expenses are the costs of the sale itself. Real estate agent commissions, legal fees, title costs, transfer taxes, advertising, and similar closing charges all reduce the amount you are treated as receiving. On a typical sale, commissions alone can knock five or six percent off the top before you even get to basis. In a high cost market that one line can be tens of thousands of dollars, so do not skip it.
Basis is where the real money hides. Your starting basis is generally what you paid for the home, the purchase price. Then you add the cost of improvements over the years. A new roof, a kitchen remodel, an addition, a finished basement, new windows, a deck, central air installed where there was none. These capital improvements get added to your basis, which lowers your gain dollar for dollar. Routine repairs and maintenance, like repainting or fixing a leak, do not count, because they keep the home in good shape rather than adding lasting value. The rules for figuring basis live in Publication 551, Basis of Assets, which is the companion document to read alongside 523.
Here is a worked example. A married couple buys a home for 400,000 dollars. Over the years they spend 60,000 dollars on improvements: a renovated kitchen, a new roof, and a back deck. Their adjusted basis is now 460,000 dollars. They later sell for 900,000 dollars. Their gain is 900,000 minus 460,000, which is 440,000 dollars. Because they are married filing jointly and meet the ownership and use tests, their exclusion limit is 500,000 dollars. The entire 440,000 dollar gain fits under the exclusion, so they owe zero federal tax on the sale and, in many cases, do not even have to report it.
Now flip the script to show why records matter. Suppose that same couple lost the receipts for the 60,000 dollars of improvements and used a basis of just 400,000 dollars. Their gain would look like 500,000 dollars, right at the edge of the limit, and any sloppy rounding or a higher sale price could push part of it into taxable territory. The improvements were real, but without proof the basis is understated and the gain is overstated. That is the single most common mistake we see on home sales: people throw away the paper trail and hand the IRS a bigger number than they owe.
Keep a running file from the day you buy. Closing statements, contractor invoices, permits, before and after photos. Drop them in a folder and forget about them until you sell. The improvements that count add up over a decade or two, and almost nobody remembers them all from memory when the closing finally arrives. A roof in year three, a kitchen in year eight, windows in year twelve. Each one is real money against your gain, but only if you can show it.
If you would rather not track it yourself, this is the kind of thing clean bookkeeping captures as you go, so the basis is ready when you need it instead of reconstructed under pressure. One more thing belongs in your basis math: if you ever took a casualty loss deduction or received insurance money for damage, those amounts adjust your basis too, usually downward. The goal is one honest number that reflects everything you put in and everything you got back. Pull your numbers together before closing and the gain calculation becomes a quick confirmation rather than a scramble. Years from now, the receipts you saved this week are what keep a large home sale fully inside the exclusion.
What happens to gain above the exclusion, and how do I report it?
Sometimes the gain runs past the exclusion limit. A single filer with 400,000 dollars of gain, or a couple with 600,000 dollars, has more profit than the 250,000 or 500,000 dollar shield can cover. Publication 523 explains how the leftover gets taxed and where it lands on your return.
The excess is a capital gain. If you owned the home more than a year, which is almost always the case for a main home, it is a long term capital gain, taxed at the favorable long term rates rather than as ordinary income. The exact rate depends on your total taxable income for the year, and it lands at zero, 15, or 20 percent for most filers. High earners may also owe the 3.8 percent net investment income tax on the taxable portion. The point is that the gain above the exclusion does not vanish, but it usually gets the lower capital gain treatment instead of being taxed like wages.
You report the sale on two forms. The transaction itself goes on Form 8949, Sales and Other Dispositions of Capital Assets, where you list the sale price, your basis, and the exclusion as an adjustment. The totals then flow to Schedule D, Capital Gains and Losses, which carries the final taxable gain over to your Form 1040. Publication 523 includes a worksheet that walks the exclusion adjustment through Form 8949 step by step, and it is worth following line by line so the excluded portion shows up correctly.
Now the reporting question that confuses people. Do you even have to put the sale on your return? You report the sale if your gain is more than the exclusion you can claim, or if you received a Form 1099-S from the closing agent, or if you cannot exclude all of the gain for some reason. If the gain is fully excluded and no 1099-S was issued, you generally do not have to report the sale at all. Many sellers leave a fully excluded sale off the return entirely, and that is correct.
The catch is the 1099-S. Closing agents issue this form for many residential sales, and once one exists, the IRS has a record of the transaction. You can sometimes avoid a 1099-S at closing by certifying that the full gain qualifies for the exclusion, but that does not always happen, and you often will not know until the form shows up in January. If you got a 1099-S but leave the sale off your return, the IRS computer sees proceeds it cannot match and may send a notice asking why. So even when your whole gain is excluded, if a 1099-S was issued, report the sale and show the exclusion on Form 8949 so the numbers reconcile. It costs nothing and heads off a letter.
Depreciation adds one more wrinkle. If you ever claimed depreciation on the home, for a rental period or a home office, the depreciation taken after May 6, 1997 cannot be excluded. That piece is recaptured and taxed, generally at a rate up to 25 percent, even if the rest of your gain fits under the exclusion. We cover that in the next answer.
State tax is the piece people forget when they are focused on the federal exclusion. Many states tax capital gains as ordinary income, so a gain that escapes federal tax under the exclusion can still be free at the state level only if the state conforms to the federal rule. New York generally follows the federal exclusion, but a large taxable portion above the limit gets taxed by both New York State and, for city residents, New York City. Run the federal and state numbers together before you assume a sale is tax free.
Getting the forms right is detail work, and an exclusion entered on the wrong line is a common source of IRS mismatch notices. We handle this routinely as part of individual tax return preparation. Bring your 1099-S and your basis records and we will make the reporting match what the IRS already has on file.
What if I rented the home, used it for business, or had to sell early?
The clean version of the home sale exclusion assumes you bought a house, lived in it, and sold it. Real life is messier. People rent out the basement, run a business from a spare room, or get transferred across the country eighteen months after closing. Publication 523 handles each of these, and the rules cut both ways.
Start with depreciation, because it is the rule that surprises people most. If you used part of the home as a rental or claimed a home office deduction, you took depreciation against that space. Any depreciation taken after May 6, 1997 cannot be excluded under the home sale rules. It is recaptured and taxed when you sell, generally at a rate up to 25 percent, no matter how small your overall gain is. So a homeowner who deducted a few thousand dollars of depreciation for a home office over several years will owe tax on that recaptured amount even if the rest of the gain disappears under the exclusion. The exclusion shields appreciation, not the depreciation benefit you already used.
Next, the partial exclusion. The general rule says you need 2 years of ownership and use to claim anything. But if you sold early for a reason the IRS accepts, you can claim a prorated portion of the exclusion instead of losing it entirely. The accepted reasons fall into three buckets: a change in place of employment, a health problem, or other unforeseen circumstances. A job that moves you 60 miles or more, a doctor recommending a move for a medical condition, a divorce, a death in the household, multiple births from one pregnancy, a job loss with unemployment benefits. The proration is based on how much of the two year window you did meet. If a single filer lived in the home 12 months out of the required 24 and sold for a qualifying reason, the partial exclusion is roughly half of 250,000 dollars, or about 125,000 dollars. That is usually enough to wipe out the gain on a short hold.
Now the most expensive misunderstanding we run into: assuming the exclusion covers a rental property or a second home. It does not. The 250,000 and 500,000 dollar exclusion applies only to your main home, the place you actually live. Sell a pure rental or a vacation house and the entire gain is a taxable capital gain, full stop. There is no main home exclusion to soften it. Some sellers try to convert a rental into a main home by moving in for a couple of years before selling, and that can work, but the depreciation recapture still applies and special rules limit the exclusion for periods the property was used as a rental. It is not the clean escape hatch people hope for.
There is a quirk worth knowing for anyone who rented before living in the home. When a property was a rental first and a residence later, the law treats the rental years as nonqualified use, and the exclusion gets allocated only to the period it was your main home. Move into an old rental for two years and you do not automatically shield the whole gain. Part of it stays taxable based on the ratio of nonqualified years to total ownership, plus the depreciation recapture. This is the rule that surprises landlords who think a quick move solves everything.
Figuring basis on a home that was part rental or part residence means tracking the depreciation history, which is exactly what Publication 551 covers. If the records are incomplete, reconstructing them after the fact is painful and often costs you money you did not need to lose.
If your situation has any of these wrinkles, a rental period, a home office, an early sale, do not guess at the result from the headline exclusion number. The mixed use cases are where home sale tax goes wrong. Walk through it with us in tax strategy consulting before you sell, while there is still time to position the sale, rather than after the closing when the outcome is locked.