Topic hub
Selling Your Home: The Section 121 Exclusion Explained
For anyone selling a home they live in, or used to: will the gain be taxed, how to figure it, and what to file, in plain words with the law behind each answer.
Pick your situation
Pick your situation
I'm selling my main homeThe six steps, start to finish
I have to sell before I've lived there long enoughThe partial exclusion
I rented it out, or ran a business from itRental and office examples
- I moved out and rented the house before selling. Can I still exclude the gain?
- I rented the house for years before I moved in. How is that taxed?
- Does depreciation on a rental or home office affect my exclusion?
- I used a room as a home office. Do I lose the exclusion?
- What if part of my property is a rental or business apart from my living space?
- Are there exceptions to the nonqualified use rule?
Divorce, a death in the family, or military serviceWho gets which cap
- How does divorce affect the tests?
- My spouse died. Can I still claim the larger exclusion?
- I'm in the military or Foreign Service. How does that change things?
- I moved into a nursing home. Can I still get the exclusion?
- Worked example: Divorce, and the ex keeps living there
- Worked example: Selling after a spouse dies
I need to figure my gainBasis, improvements and selling costs
I got a Form 1099-S, or I'm not sure what to fileWhat to file, line by line
In 60 seconds
- If you owned the home and lived in it as your main home for 2 of the last 5 years, you can leave up to $250,000 of gain out of your income, or $500,000 on a joint return when both of you pass the use test.
- The cap is about gain, not price: the sale price, minus selling costs, minus what you paid and put into the house.
- Have to sell sooner because of a job change, your health or an unexpected event? You may still get part of the cap.
2 more points
- Rental time and depreciation can make part of the gain taxable even when you pass the tests. Divorce, a spouse's death and military service have their own rules, usually in your favor.
- Got a Form 1099-S? Report the sale on Form 8949 even if all the gain is excluded. Section 121 itself did not change for 2026.
Or answer a few questions to get your steps
Step 1 of 6
In the years before the closing, did you own the home and live in it as your main home long enough?
Learn it9Numbers · Pictures · Basics · Steps · Examples · Mistakes
Key numbers
- Most gain you can leave out, single
- $250,000Also married filing separately. Fixed in the law, so it doesn't rise with inflation.26 U.S.C. sec. 121(b)
- Most gain you can leave out, married filing jointly
- $500,000When either spouse passes the ownership test, both pass the use test, and neither used the exclusion in the last 2 years.26 U.S.C. sec. 121(b)
- Years you need to have owned the home and lived in it
- 2Inside the last 5 years: 24 months or 730 days of each. They don't have to be in a row, or the same years.IRC 121(a)Checked
- Years to wait between excluded sales
- 2Counted back from the closing date. A reduced exclusion can still apply.IRC 121(b)(3)Checked
- Miles farther your new job must be to qualify for a partial exclusion
- 50A shorter distance can still count if the job was the main reason for the sale.Treas. Reg. 1.121-3(c)(2)(ii)Checked
- Top tax rate on the slice of gain from depreciation
- 25%Other taxable gain on a home owned more than 12 months: 0%, 15% or 20%.26 U.S.C. sec. 1(h)
Figures checked against the source unless a card says otherwise.
The short explainer
If you sell your main home, you can leave up to $250,000 of gain out of your income, or up to $500,000 on a joint return if one of you meets the ownership test and both of you meet the use test. For most sellers that means no tax and no reporting.
You qualify if you owned the home and lived in it as your main home for 2 years or more during the 5 years before the sale. The years don't have to be consecutive, and owning and living there don't have to be the same 2 years.
The tests are where people trip. A job move, health problem or unforeseen event can still earn a partial exclusion. Time as a rental on or after January 1, 2009, and depreciation after May 6, 1997, can make part of the gain taxable even when you pass the tests.
Divorce, a spouse's death and military service each have their own rules, usually in your favor. Your basis (what you paid plus improvements) decides how big the gain is, so keep the records.
A Form 1099-S means you report the sale on Form 8949, even if the whole gain is excluded. No form doesn't mean no duty if part of the gain is taxable.
As of Dec 1, 2026. Editorial review: Carry Forward Learning (AI-assisted) Oct 21, 2026.
In pictures
Describe this diagram
This flowchart asks four questions to show whether you can leave your home sale gain out of income. Flowchart: can I leave my home sale gain out of my income? Four gate cards asked about the day of the sale: did you own the home for two of the last five years; did you live in it as your main home for two of the last five years, which need not be in a row; did neither you nor your spouse use the exclusion on another home sale in the last two years; and is any of the gain from depreciation, rental time or a separate unit. Passing the first three leads to you qualifying, up to the cap for single or joint filers. A no to the first two, or a yes to using the exclusion recently, leads to a shared box asking whether you sold mainly because of a job change, health or an unforeseen event; if yes you can get a reduced exclusion, figured as the cap times the shortest of months owned, months lived there and months since the last excluded sale, as a share of the full qualifying period, and if no you get none. On the last question, only time after the nonqualified-use start date when the home was not your main home before you moved in or between stretches of use counts, renting after you move out does not, and depreciation taken after the 1997 cutoff is taxed; that slice is taxable and the rest fits under the cap. A footnote covers Form 1099-S and Form 8949, and says a loss is not deductible.
Describe this diagram
Timeline titled the look-back window: five year columns ending at a closing-date marker. An owned bar runs across all five years, and two years is enough. The lived-there bar is drawn as two separate year blocks with a note that two years in pieces works and one stretch works too. A look-back bracket spans the five years. A dashed extended-duty band with a left arrow shows that members of the uniformed services, Foreign Service, intelligence community and Peace Corps can stretch the window by up to ten years with an election. Notes cover the repeat-sale rule and say a surviving spouse who has not remarried gets two years after the death to use the joint cap, if the joint tests were met right before the death.
Describe this diagram
These cards compare home sale situations and the exclusion each one gets. Five stacked cards compare home sale situations: single or married filing separately, joint with both spouses passing the tests, joint with one spouse failing the use test (up to the single cap plus an add-on line), a surviving spouse selling in time, and a reduced exclusion. Each shows a big cap number and one set of row labels for who must own the home, who must live in it and other limits, with a legend for a check needed, a wave for depends and a bar for a limit; the reduced card says the exclusion can be based on less than two years.
The basics
What makes it special
Who's allowed
What it doesn't cover
Step by step
Pin down your dates
Find your closing date (the date of sale) and work back 5 years. Count how many months you owned the home and how many you lived in it as your main home.Where it goes: Closing disclosure; Form 1099-S, box 1 shows the closing date
Check the tests
You need 2 years of each, and no other excluded sale in the last 2 years. If a test fails, look at the partial exclusion.Figure your gain
Amount realized (price minus selling costs) minus adjusted basis (cost plus closing costs plus improvements, minus depreciation and credits).Where it goes: Pub. 523, Worksheet 2
Take out depreciation and rental time
Gain up to depreciation after May 6, 1997 isn't excludable, and gain tied to nonqualified use on or after January 1, 2009 isn't either.Where it goes: Pub. 523, Worksheet 3
Apply the cap
Exclude up to $250,000 (or $500,000 on a joint return that qualifies). Anything over is taxable.Where it goes: Pub. 523, Worksheet 1
Report if you need to
If you got a Form 1099-S, or part of the gain is taxable, report the sale on Form 8949 and Schedule D. Business or rental portions go on Form 4797.Where it goes: Forms 8949, Schedule D, 4797
Worked examples
- A single seller with a big gain
- A couple, and a spouse who just moved in
- A job change after 18 months
- Rented for two years, then moved in for three
- Lived there four years, rented the fifth
- A duplex where one unit was always a rental
- Selling after a spouse dies
- Divorce, and the ex keeps living there
- Seven years of extended duty away from home
- Reporting an excluded sale after a Form 1099-S
Mistakes and traps
- Treating the sale price as the test
- Forgetting the use test for the second spouse
- Ignoring depreciation you were allowed to take
- Renting before moving in
- Skipping the report because there is no tax
- Counting on a partial exclusion with no time in the home
- Selling two homes close together
- Splitting a duplex or separate rental unit wrong
- Moving into a rental you got through a 1031 exchange
- Missing the subsidy recapture
Compare
Side by side has its own page, so this one stays quick to load.
Rules in depth
Quick recap
Quick recap has its own page, so this one stays quick to load.
Do it6Walk me through · Scenarios · Timeline · Playbook · Checklist · Dates
Walk me through it: will my home sale gain be taxed?
Answer up to 6 quick questions and get the steps for your situation. Nothing is sent anywhere.
Start to finish, with numbers
Start to finish, with numbers has its own page, so this one stays quick to load.
Timeline
Timeline has its own page, so this one stays quick to load.
The playbook, start to finish
The playbook, start to finish has its own page, so this one stays quick to load.
Do this next
- Write down your closing date and count back 5 years. Mark the months you owned the home and the months you lived in it as your main home.
- Married? Do the same count for each spouse, and note any sale of another home in the last 2 years.
- Pull your basis records: the closing statement from when you bought, and receipts for improvements.
- List any rental time, home office years or a separate rental unit, with the depreciation you took.
- Work out the gain: price, minus selling costs, minus adjusted basis (Pub. 523, Worksheet 2).
- Compare the gain with your cap, then carve out depreciation and rental time.
- Got or expecting a Form 1099-S? Plan to report the sale on Form 8949.
- Keep the closing statement, basis records and the 1099-S in one folder.
Notices and key dates
Notices and key dates has its own page, so this one stays quick to load.
Questions3Q&A · Quiz · Words
Questions and answers
70 questions, each answered in a few sentences with the authority behind it. Pick a group, or search.
The basics (10)
Who qualifies and which home counts (9)
Partial exclusions and tax on the gain (8)
Basis and your gain (9)
Rentals, home offices and depreciation (9)
Divorce, death, military and other cases (7)
Forms and filing (8)
Common questions from real situations (10)
Test yourself
- 13 questions, each with the answer and the rule behind it.
Words used here
Words used here has its own page, so this one stays quick to load.
The law3The law · Authority · Forms
The law
The law, section by section has its own page, so this one stays quick to load.
Authority stack
38 sources, ranked by weight: the Code first, then session laws and regulations, IRS guidance, cases, then publications and forms. The Code, session laws and regulations are here; the rest, with what each one says paragraph by paragraph, is on the full authority page.
- Code I.R.C. § 1(h)(1)(E), (h)(6) Unrecaptured section 1250 gain
- Code I.R.C. § 1001(a)-(c) Determination of amount of and recognition of gain or loss
- Code I.R.C. § 1012(a) Basis of property: cost
- Code I.R.C. § 1014(a), (b)(6) Basis of property acquired from a decedent
- Code I.R.C. § 1015(a) Basis of property acquired by gift
- Code I.R.C. § 1016(a)(1), (a)(2) Adjustments to basis
- Code I.R.C. § 1041 Transfers of property between spouses or incident to divorce
- Code I.R.C. § 108(a)(1)(E) Qualified principal residence indebtedness
- Code I.R.C. § 121 Exclusion of gain from sale of principal residence
- Code I.R.C. § 1411(a), (b), (c)(1)(A)(iii) Net investment income tax
- Code I.R.C. § 143(m) Recapture of federal mortgage subsidy
- Code I.R.C. § 164(b)(6), (b)(7) Taxes: real property taxes and the state and local tax limit
- Code I.R.C. § 217(k) Moving expenses: suspension
- Code I.R.C. § 25C(g), (i) Energy efficient home improvement credit
- Code I.R.C. § 25D(f), (h) Residential clean energy credit
- Code I.R.C. § 6045(e) Information returns for real estate transactions
- Session law Pub. L. 119-21 § 70113 Moving expense suspension made permanent; intelligence community exception
- Session law Pub. L. 119-21 § 70120 State and local tax limit for 2025 through 2029
- Session law Pub. L. 119-21 § 70505 Energy efficient home improvement credit terminated
- Session law Pub. L. 119-21 § 70506 Residential clean energy credit terminated
- Regulation Treas. Reg. § 1.121-1 Exclusion of gain from sale or exchange of a principal residence
- Regulation Treas. Reg. § 1.121-2 Limitations
- Regulation Treas. Reg. § 1.121-3 Reduced maximum exclusion for taxpayers failing to meet certain requirements
- Regulation Treas. Reg. § 1.121-4 Special rules
- Regulation Treas. Reg. § 1.121-5 Suspension of 5-year period for certain members of the uniformed services and Foreign Service
IRS forms and publications
IRS forms and publications has its own page, so this one stays quick to load.
More2Read · Changes
Read more
What changed in the law
Where the numbers come from
Checked
Every figure above comes from the source listed here, with the date we checked it and the date it is due for a re-check.
- Capital gains: long term holding more than monthsIRC 1222(3) checked 2026-10-19, review by 2027-01-19
cf-2026:capital_gains.long_term_holding_more_than_months - Home sale: depreciation cutoff dateIRC 121(d)(6) checked 2026-10-19, review by 2027-01-19
cf-2026:home_sale_121.depreciation_cutoff_date - Home sale: employment safe harbor milesTreas. Reg. 1.121-3(c)(2)(ii) checked 2026-10-19, review by 2027-01-19
cf-2026:home_sale_121.employment_safe_harbor_miles - Home sale: nonqualified use start dateIRC 121(b)(5)(C)(i) checked 2026-10-19, review by 2027-01-19
cf-2026:home_sale_121.nonqualified_use_start_date - Home sale: ownership use test daysTreas. Reg. 1.121-1(c)(1) checked 2026-10-19, review by 2027-01-19
cf-2026:home_sale_121.ownership_use_test_days - Home sale: ownership use test yearsIRC 121(a) checked 2026-10-19, review by 2027-01-19
cf-2026:home_sale_121.ownership_use_test_years - Home sale: repeat sale lookback yearsIRC 121(b)(3) checked 2026-10-19, review by 2027-01-19
cf-2026:home_sale_121.repeat_sale_lookback_years - Capital gains: rates26 U.S.C. sec. 1(h) checked 2026-09-24, review by 2027-01-22
federal-2026:capital_gains.rates - Home sale exclusion: maximum gain excluded26 U.S.C. sec. 121(b) checked 2026-09-24, review by 2027-01-22
federal-2026:home_sale_exclusion.max_gain_excluded