26 USC 121 - Exclusion of gain from sale of principal residence

(a) Exclusion 
Gross income shall not include gain from the sale or exchange of property if, during the 5-year period ending on the date of the sale or exchange, such property has been owned and used by the taxpayer as the taxpayers principal residence for periods aggregating 2 years or more.
(b) Limitations 

(1) In general 
The amount of gain excluded from gross income under subsection (a) with respect to any sale or exchange shall not exceed $250,000.
(2) Special rules for joint returns 
In the case of a husband and wife who make a joint return for the taxable year of the sale or exchange of the property
(A) $500,000 Limitation for certain joint returns 
Paragraph (1) shall be applied by substituting $500,000 for $250,000 if
(i) either spouse meets the ownership requirements of subsection (a) with respect to such property;
(ii) both spouses meet the use requirements of subsection (a) with respect to such property; and
(iii) neither spouse is ineligible for the benefits of subsection (a) with respect to such property by reason of paragraph (3).
(B) Other joint returns 
If such spouses do not meet the requirements of subparagraph (A), the limitation under paragraph (1) shall be the sum of the limitations under paragraph (1) to which each spouse would be entitled if such spouses had not been married. For purposes of the preceding sentence, each spouse shall be treated as owning the property during the period that either spouse owned the property.
(3) Application to only 1 sale or exchange every 2 years 

(A) In general 
Subsection (a) shall not apply to any sale or exchange by the taxpayer if, during the 2-year period ending on the date of such sale or exchange, there was any other sale or exchange by the taxpayer to which subsection (a) applied.
(B) Pre-May 7, 1997, sales not taken into account 
Subparagraph (A) shall be applied without regard to any sale or exchange before May 7, 1997.
(4) Special rule for certain sales by surviving spouses 
In the case of a sale or exchange of property by an unmarried individual whose spouse is deceased on the date of such sale, paragraph (1) shall be applied by substituting $500,000 for $250,000 if such sale occurs not later than 2 years after the date of death of such spouse and the requirements of paragraph (2)(A) were met immediately before such date of death.
(c) Exclusion for taxpayers failing to meet certain requirements 

(1) In general 
In the case of a sale or exchange to which this subsection applies, the ownership and use requirements of subsection (a), and subsection (b)(3), shall not apply; but the dollar limitation under paragraph (1) or (2) of subsection (b), whichever is applicable, shall be equal to
(A) the amount which bears the same ratio to such limitation (determined without regard to this paragraph) as
(B) 
(i) the shorter of
(I) the aggregate periods, during the 5-year period ending on the date of such sale or exchange, such property has been owned and used by the taxpayer as the taxpayers principal residence; or
(II) the period after the date of the most recent prior sale or exchange by the taxpayer to which subsection (a) applied and before the date of such sale or exchange, bears to
(ii) 2 years.
(2) Sales and exchanges to which subsection applies 
This subsection shall apply to any sale or exchange if
(A) subsection (a) would not (but for this subsection) apply to such sale or exchange by reason of
(i) a failure to meet the ownership and use requirements of subsection (a), or
(ii) subsection (b)(3), and
(B) such sale or exchange is by reason of a change in place of employment, health, or, to the extent provided in regulations, unforeseen circumstances.
(d) Special rules 

(1) Joint returns 
If a husband and wife make a joint return for the taxable year of the sale or exchange of the property, subsections (a) and (c) shall apply if either spouse meets the ownership and use requirements of subsection (a) with respect to such property.
(2) Property of deceased spouse 
For purposes of this section, in the case of an unmarried individual whose spouse is deceased on the date of the sale or exchange of property, the period such unmarried individual owned and used such property shall include the period such deceased spouse owned and used such property before death.
(3) Property owned by spouse or former spouse 
For purposes of this section
(A) Property transferred to individual from spouse or former spouse 
In the case of an individual holding property transferred to such individual in a transaction described in section 1041 (a), the period such individual owns such property shall include the period the transferor owned the property.
(B) Property used by former spouse pursuant to divorce decree, etc. 
Solely for purposes of this section, an individual shall be treated as using property as such individuals principal residence during any period of ownership while such individuals spouse or former spouse is granted use of the property under a divorce or separation instrument (as defined in section 71 (b)(2)).
(4) Tenant-stockholder in cooperative housing corporation 
For purposes of this section, if the taxpayer holds stock as a tenant-stockholder (as defined in section 216) in a cooperative housing corporation (as defined in such section), then
(A) the holding requirements of subsection (a) shall be applied to the holding of such stock, and
(B) the use requirements of subsection (a) shall be applied to the house or apartment which the taxpayer was entitled to occupy as such stockholder.
(5) Involuntary conversions 

(A) In general 
For purposes of this section, the destruction, theft, seizure, requisition, or condemnation of property shall be treated as the sale of such property.
(B) Application of section 1033 
In applying section 1033 (relating to involuntary conversions), the amount realized from the sale or exchange of property shall be treated as being the amount determined without regard to this section, reduced by the amount of gain not included in gross income pursuant to this section.
(C) Property acquired after involuntary conversion 
If the basis of the property sold or exchanged is determined (in whole or in part) under section 1033 (b) (relating to basis of property acquired through involuntary conversion), then the holding and use by the taxpayer of the converted property shall be treated as holding and use by the taxpayer of the property sold or exchanged.
(6) Recognition of gain attributable to depreciation 
Subsection (a) shall not apply to so much of the gain from the sale of any property as does not exceed the portion of the depreciation adjustments (as defined in section 1250 (b)(3)) attributable to periods after May 6, 1997, in respect of such property.
(7) Determination of use during periods of out-of-residence care 
In the case of a taxpayer who
(A) becomes physically or mentally incapable of self-care, and
(B) owns property and uses such property as the taxpayers principal residence during the 5-year period described in subsection (a) for periods aggregating at least 1 year,

then the taxpayer shall be treated as using such property as the taxpayers principal residence during any time during such 5-year period in which the taxpayer owns the property and resides in any facility (including a nursing home) licensed by a State or political subdivision to care for an individual in the taxpayers condition.

(8) Sales of remainder interests 
For purposes of this section
(A) In general 
At the election of the taxpayer, this section shall not fail to apply to the sale or exchange of an interest in a principal residence by reason of such interest being a remainder interest in such residence, but this section shall not apply to any other interest in such residence which is sold or exchanged separately.
(B) Exception for sales to related parties 
Subparagraph (A) shall not apply to any sale to, or exchange with, any person who bears a relationship to the taxpayer which is described in section 267 (b) or 707 (b).
(9) Uniformed services, Foreign Service, and intelligence community 

(A) In general 
At the election of an individual with respect to a property, the running of the 5-year period described in subsections (a) and (c)(1)(B) and paragraph (7) of this subsection with respect to such property shall be suspended during any period that such individual or such individuals spouse is serving on qualified official extended duty
(i) as a member of the uniformed services,
(ii) as a member of the Foreign Service of the United States, or
(iii) as an employee of the intelligence community.
(B) Maximum period of suspension 
The 5-year period described in subsection (a) shall not be extended more than 10 years by reason of subparagraph (A).
(C) Qualified official extended duty 
For purposes of this paragraph
(i) In general The term qualified official extended duty means any extended duty while serving at a duty station which is at least 50 miles from such property or while residing under Government orders in Government quarters.
(ii) Uniformed services The term uniformed services has the meaning given such term by section 101 (a)(5) of title 10, United States Code, as in effect on the date of the enactment of this paragraph.
(iii) Foreign Service of the United States The term member of the Foreign Service of the United States has the meaning given the term member of the Service by paragraph (1), (2), (3), (4), or (5) of section 103 of the Foreign Service Act of 1980, as in effect on the date of the enactment of this paragraph.
(iv) Employee of intelligence community The term employee of the intelligence community means an employee (as defined by section 2105 of title 5, United States Code) of
(I) the Office of the Director of National Intelligence,
(II) the Central Intelligence Agency,
(III) the National Security Agency,
(IV) the Defense Intelligence Agency,
(V) the National Geospatial-Intelligence Agency,
(VI) the National Reconnaissance Office,
(VII) any other office within the Department of Defense for the collection of specialized national intelligence through reconnaissance programs,
(VIII) any of the intelligence elements of the Army, the Navy, the Air Force, the Marine Corps, the Federal Bureau of Investigation, the Department of Treasury, the Department of Energy, and the Coast Guard,
(IX) the Bureau of Intelligence and Research of the Department of State, or
(X) any of the elements of the Department of Homeland Security concerned with the analyses of foreign intelligence information.
(v) Extended duty The term extended duty means any period of active duty pursuant to a call or order to such duty for a period in excess of 90 days or for an indefinite period.
(vi) Special rule relating to intelligence community An employee of the intelligence community shall not be treated as serving on qualified extended duty unless such duty is at a duty station located outside the United States.
(D) Special rules relating to election 

(i) Election limited to 1 property at a time An election under subparagraph (A) with respect to any property may not be made if such an election is in effect with respect to any other property.
(ii) Revocation of election An election under subparagraph (A) may be revoked at any time.
(E) Termination with respect to employees of intelligence community 
Clause (iii) of subparagraph (A) shall not apply with respect to any sale or exchange after December 31, 2010.
(10) Property acquired in like-kind exchange 
If a taxpayer acquires property in an exchange with respect to which gain is not recognized (in whole or in part) to the taxpayer under subsection (a) or (b) of section 1031, subsection (a) shall not apply to the sale or exchange of such property by such taxpayer (or by any person whose basis in such property is determined, in whole or in part, by reference to the basis in the hands of such taxpayer) during the 5-year period beginning with the date of such acquisition.
(e) Denial of exclusion for expatriates 
This section shall not apply to any sale or exchange by an individual if the treatment provided by section 877 (a)(1) applies to such individual.
(f) Election to have section not apply 
This section shall not apply to any sale or exchange with respect to which the taxpayer elects not to have this section apply.
(g) Residences acquired in rollovers under section 1034 
For purposes of this section, in the case of property the acquisition of which by the taxpayer resulted under section 10341 (as in effect on the day before the date of the enactment of this section) in the nonrecognition of any part of the gain realized on the sale or exchange of another residence, in determining the period for which the taxpayer has owned and used such property as the taxpayers principal residence, there shall be included the aggregate periods for which such other residence (and each prior residence taken into account under section 1223 (6) in determining the holding period of such property) had been so owned and used.
[1] See References in Text note below.