Section 121 relates to the exclusion of certain gain on the sale of a principal residence when ownership and use requirements are met. Section 1031 relates to deferral of gain on qualifying investment or business real property. Under certain circumstances, both can be relevant within the same transaction.
That does not mean renting out a former home for two years automatically produces the outcome people describe at dinner parties. Eligibility depends on actual ownership history, actual use, timing, depreciation taken during the rental period, and the property's overall tax history.
Nonqualified-use considerations can limit the portion of gain eligible for exclusion, and depreciation claimed during the rental period is generally not excluded. Both points are frequently omitted from casual explanations.
This is planning that belongs with your CPA and qualified intermediary before you change how the property is used — not after. Jacob's role is to make sure the real estate side of the plan is sound and properly timed.
Related