As you may know, the criteria for excluding gain on the sale of your primary residence is that you owned and occupied the home for two years at any time within the five years prior to the sale date. See Sale of Your Home
So under current law, you can move into the rental property and live there for two years and use the exclusion when you sell that rental. If you do not use all of the property as your primary residence the exclusion of gain will only apply the the portion of the sales price that was primary residence. For example, if you used one half of the former rental as your primary residence when you sold it one half of the sales price would be used for the residence and the other half would be sale of the rental property and not eligible to be excluded.
That would be the only way you can exclude gain on the current rental that you wish to use the proceeds to buy a residence - by using the rental as your primary residence for two years prior to selling.
Please be aware that the law just signed on July 30, 2008 The Housing and Economic Recovery Act of 2008 will make a change and any time that the property is rented after January 1, 2009 will reduce the amount that can be excluded. If possible you should consider moving to the rental before January 1 to avoid "non qualified use".
See CCH's Special Tax Briefing on the Act, click here.
Gain from the sale of a principal residence home will no longer be excluded from gross income under Code Sec. 121 for periods that the home was not used as the principal residence ("non-qualifying use"). This new income inclusion rule applies to home sales after December 31, 2008, and, under a generous transition rule, is based only on nonqualified use periods that begin on or after January 1, 2009.
I hope this helps for knowing that you can exclude gain on the current rental that you wish to sell - by using it as your primary residence for two years prior to selling.
No, you can not exchange a rental into a residence. A residence is not like kind property as a rental.
There could be a partial exchange if the property you buy is part rental and part personal; but it would only be eligible if the part you bought that was rental was of greater value than the rental that was sold. That would only happen if the new property was of significantly greater value than the rental disposed.
That is, a like kind exchange is only effective to not pay any tax on capital gains when you are acquiring property of greater value than the property given up.
I hope this helps to clarify for you.
There is a possibility of such a transaction being an exchange; but there are several difficulties that would have to be overcome.
Under Sec. 1031, if a transaction is not solely an exchange of like-kind properties, any boot received (i.e., cash, loan paid or the FMV of non-like-kind property received) triggers gain (but not loss) recognition. Also, if boot property (i.e., non-like-kind property) is given in the exchange, gain or loss is recognized on the boot property disposed.
So if the acquired property is a single unit you would have to recognize gain to the extent that non-like-kind property is acquired. That is, you would have to be able to separately acquire the like kind property from the personal use property. If there were separate units for rental and personal use that would be easily demonstrated but for renting a portion of one unit it may be difficult, if not impossible, to establish you did not receive non-like-kind in the exchange.
Neither the Code and regulations, nor the cases, set a "bright line" test of how long rental use must continue before property can be converted to personal-use property. A taxpayer's intent to hold property for business or investment use is determined at the time of the exchange.
If you can establish the rental use of the acquired property and then later begin to use the property for personal use it could be possible to treat the replacement property as entirely like kind for the rental unit relinquished.
There are regulations that specifically address the treatment of relinquished property that is part business and part personal; but the situation you describe is not specifically addressed. See the article Sale of a residence and like-kind exchanges for details (in somewhat technical language).
Also you should be aware that the amount that had previously been claimed as depreciation on the relinquished property is included in ordinary income at the time of the exchange to the extent that nonlike kind property (or boot) is received. See I.R.C. §1245 DEPRECIATION RECAPTURE, LIKE-KIND EXCHANGE
Acquiring a non-like kind property in an exchange will cause gain to be recognized. Personal property is not like kind to rental property. Gain that is recognized from a like-kind exchange of property is subject to the same recapture rules as gain recognized from the sale of the property. You should consult your accountant or tax practitioner for the recapture result of exchanging the rental for like kind property to know what will not be eligible for gain deferral.
You would have to properly structure any exchange to not include non-like-property in order to avoid gain recognition and that may not be possible with a single unit mixed use replacement property from a practical perspective even though it is technically allowable. A multi unit acquired property would clearly allow the result you are seeking.
I hope this helps present the general rules for exchange of mixed use property.