Question
Can we move into our rental property, live there as our main home for two years, and sell it without having to pay capital gains tax?
Answer

Under section 121 of the Internal Revenue Code, you may be able to exclude much of the gain from the sale of your main home that you also used for business or to produce rental income, if you meet the ownership and use tests. However, you may not exclude gain from the sale or exchange of your main home if it's allocable to periods of nonqualified use; refer to Publication 523, Selling Your Home.

If you were entitled to take depreciation deductions because you used your home for business purposes or as rental property, you may not exclude the part of your gain equal to any depreciation allowed (actually deducted) or allowable (legally expected to be deducted) as a deduction for periods after May 6, 1997. If you can show by adequate records or other evidence that the depreciation deduction allowed was less than the amount of depreciation allowable, you may limit the recognized gain attributable to depreciation to the amount of the depreciation allowed. A simplified method of computing the deduction for the business use of a home that sets depreciation to zero may apply. Refer to Simplified Option for Home Office Deduction for details.

Reporting the Sale of Your Home
If Then
You meet the ownership and use tests and there's no business or rental use in or before the year of the sale You should report the section 121 exclusion, any gain in excess of the section 121 exclusion, and the depreciation-related gain you can't exclude on Form 8949, Sales and other Dispositions of Capital Assets and Schedule D (Form 1040), Capital Gains and Losses. For more information, refer to Publication 523.
You meet the ownership and use tests but there's business or rental use in or before the year of sale You should report the sale of the business or rental part on Form 4797, Sales of Business Property. Form 4797 takes into account the business or rental part of the gain, the section 121 exclusion and depreciation-related gain you can't exclude.
The part of your property used for business or rental use is within your home, such as a home office for a business You don't need to allocate gain on the sale of the property between the business or rental part of the property and the part used as a home. In addition, you don't need to report the sale of the business or rental part on Form 4797. This is true whether or not you were entitled to claim any depreciation. However, you can't exclude the part of any gain equal to any depreciation allowed or allowable after May 6, 1997.