Wealthy Habitat

Library · Home · Published 10/10/2026 · Read again by the automated checks 10/6/2026

Selling a home and the gain exclusion

When you sell your main home, you may exclude a large portion of your profit from taxes if you owned and lived in it for at least two of the past five years.

In short

A friend of mine sold his little house last spring and worried for weeks about a tax bill that never came. If you are selling the home you live in, the tax law may let you keep a large part of your profit tax free. That break is called the home sale gain exclusion, and it lives in Section 121 of the Internal Revenue Code. The ownership test asks whether you owned the home for at least two of the five years before the sale. The use test asks whether you lived in it as your main home for at least two of those years. Your gain is your sale price, minus your selling costs, minus your basis, which is what you paid plus certain improvements. Keep your closing papers and improvement receipts, because they are the proof the IRS may ask to see.

The whole of it

What it is

I once watched a neighbor pack up thirty years of memories and then lose sleep over one question. Would the government take a big bite of what he made? For many people selling a family home, the answer is kinder than they fear. Congress wrote a rule that lets homeowners leave out a set amount of profit from their income when they sell a main home.

You have probably heard the word "gain" used loosely. Here it means your profit on paper. It is what you sold for, less what it cost you to sell, less what the home cost you to own. The exclusion wipes out some or all of that profit for tax purposes. If your gain is under the limit, you may owe no tax on it. If it is over, only the extra is taxed.

If this sounds too good to be true, I understand the worry. The rule is not a loophole. It is meant for people who use a house as a home, not as a business. That is why it comes with tests about how long you owned the place and how long you lived there. Meet the tests, and the law is on your side. Miss them, and you may still qualify for a smaller break. More on that below.

How it works

If you are holding the keys to a home you plan to sell, start with two clocks. The first is the ownership test. The law asks whether you owned the home for at least two years during the five years that end on the sale date. The second is the use test. The law asks whether you lived in it as your main home for at least two years during that same five year window. The two years do not have to be in a row. They do not have to be the same two years for both tests.

A friend of mine once asked whether her husband's name on the deed changed her limit. The amount you can exclude depends on how you file. A single filer gets one limit. A married couple filing jointly gets a larger one. Under the law, both spouses must meet the use test, and at least one must meet the ownership test. Those dollar limits are set by statute. The current figures are this year's official home sale exclusion single, published on its official page for a single filer and this year's official home sale exclusion married joint, published on its official page for a married couple filing jointly.

You might think you can use this break every time you move. There is also a spacing rule. The exclusion generally does not apply if you used it on another home sale within the two years before this one. So it is not a break that stacks back to back.

What if life got in the way? A job move, a health problem, or certain unforeseen events can allow a reduced exclusion even when you fall short of two years. The reduced amount is based on the share of the two years you did meet. It is worth asking about if your plans changed fast.

Now for the math. Your gain equals the amount realized minus your adjusted basis. The amount realized is the sale price less your selling costs, such as agent fees and certain closing costs. Your adjusted basis is what you paid for the home, plus the cost of real improvements, minus any depreciation you were required to take. Depreciation is a tax deduction for wear on a rental or business space. A new roof or a finished basement counts as an improvement. Routine repairs, like patching a fence, generally do not.

The numbers, and where to find yours

If you have ever tried to plan a sale, you know two kinds of numbers matter here. The first kind is set by law, and it can change. The exclusion limits are one example. Check the current figures on the IRS website and in Publication 523, titled Selling Your Home. Do not trust a number you saw in an old article or heard at a barbecue.

The second kind is your own. Your purchase price and your closing costs from when you bought are on the settlement statement you signed at closing. Look for it in your files or your email. You can also ask the title company or your lender. Your improvement costs come from receipts, invoices, and bank records. If you have lost some, old contractor statements and card records can help you rebuild the story.

When you sell, you will receive a closing statement. You may also get a Form 1099 S, which reports the sale to the IRS. If you get one, what you report must match it. Whether you must report the sale at all depends on your case. Publication 523 explains when reporting is required and when it is not.

One more source is worth naming. The IRS topic page on selling your home explains the basics in plain language, and it points to the forms. Read it before you file.

A worked example

Let me tell you about Ruth and Daniel, a couple in their fifties who file a joint return. They bought their house years ago for $210,000. Along the way they paid $15,000 to finish the basement and $9,000 for a new roof. Those are real improvements, so together they add $24,000 to the basis.

Their adjusted basis is $210,000 plus $24,000, which is $234,000. They sell the house for $520,000. They pay $31,000 in agent fees and closing costs. Their amount realized is $520,000 minus $31,000, which is $489,000.

Now the gain. It is the amount realized minus the adjusted basis, so $489,000 minus $234,000. That is $255,000 of gain.

Ruth and Daniel both lived in the home as their main home for the past eleven years, and they own it together. They meet the ownership test and the use test. They have not used the exclusion in the last two years. So the joint limit applies to them, and that limit is this year's official home sale exclusion married joint, published on its official page.

Here is how the check works. If the joint limit is larger than their $255,000 gain, the whole gain is excluded, and they owe no federal income tax on it. If the limit is smaller than their gain, only the amount above the limit is taxed. To test your own case, take your gain, subtract the limit, and see whether anything is left over.

That is the whole calculation. Sale price, less costs, less basis, less the limit. Simple.

Where it goes wrong

I have seen good people trip over small things, and none of them were fools. I have watched a careful man lose money to a missing folder. If you cannot show what you spent on improvements, your basis looks lower, and your gain looks bigger. A shoebox of receipts works fine.

I once knew a man who tripped over timing. He moved out for a job, rented the house for several years, and then sold. By then the use test may fail, since they did not live there for two of the last five years. Renting also raises another issue. Depreciation you took on a rental portion is taxed when you sell, even if the rest of the gain is excluded.

A woman I know ran her whole business from a spare room. If you claimed depreciation on a home office or business space, the depreciation you took may be taxed when you sell, even if the rest of your gain is excluded. Publication 523 covers this. Read it before you list the house.

A fourth trap is assuming the rule covers everything. It does not cover a second home or a pure investment property. It also does not settle your state taxes, since states set their own rules. Your own state's tax agency can tell you how it treats a home sale.

Divorce, the death of a spouse, and military service each carry their own special rules. If any of those touch your sale, read the fine print in Publication 523. A qualified tax preparer can also walk through it with you.

Questions to answer before you leave this page

If you are standing at the edge of a sale, you have probably wondered where you stand. Have you owned the home for at least two of the last five years, and have you lived in it as your main home for at least two of those years? Did you use this exclusion on another home sale within the past two years? Do you know your basis, including the price you paid and the cost of each real improvement? Can you find your closing statement and your receipts if someone asks? Did any part of the house serve as a rental or a business space, and did you claim depreciation on it? Are you filing single or jointly, and have you looked up the current limit for your situation on the IRS site? Have you read IRS Publication 523, and does your state tax agency treat the sale the same way the federal rules do?

Now work it with your own numbers. Mortgage payment and total cost, the payment, and what the loan costs over its life · Rent or buy, the two paths side by side, with every cost named. Each shows the formula it used.

Learn it in steps. The course called Your money, understood begins with Money you can lose, money you cannot: two short paragraphs, one number of your own, and a check, about five minutes on the page. No account needed.

Sources

irs.gov · read 10/10/2026

Each source below is an official page that was fetched on the date shown, and the sentence quoted from it was found there. Figures from the table of yearly figures carry their own source and date. When a quoted sentence can no longer be found, the guide goes back to the writer.

Related

Maintenance budgets
Private mortgage insurance
Pre approval versus pre qualification

See something wrong on this page? Write to admin@wealthyhabitat.com and say which sentence.

Was this useful? Counted, never signed.

Ask about this guide

A model reads this page and answers from it. It will say when the answer is not on the page. Education, not personalized advice.

Written by the site's growth engine and checked by its gates: voice, law and ethics, facts, arithmetic, and sources. Not yet read by a human editor, and a correction goes to the address above. Rules and dollar limits change every year; figures come from the table of yearly figures with their source and date.