If you used and owned the property as your principal residence for 2 years out of the 5-year period ending on the date of sale, you have met the ownership and use tests for the exclusion. This is true even though the property was used as rental property for the 3 years before the date of the sale. In that case, you would qualify to exclude some or all of the gain on the sale of your home if you didn't use the exclusion on the sale of another residence during the 2-year period that ends on the date of sale, or you used the exclusion within the last 2 years but this sale of your home is due to a change in employment, health, or unforeseen circumstances.
For rental property, the law has additional limits on the amount you may exclude. You may not exclude the part of your gain equal to any depreciation deduction allowed or allowable for periods after May 6, 1997.
Generally, the law allows an annual depreciation deduction on your rental property and you must reduce the basis of the property by the amount of your depreciation deductions. If you don't claim some or all of the depreciation deductions allowable under the law, you must still reduce the basis of the property by the amount allowable before determining your gain on the sale of the property.
The gain attributable to the depreciation may be subject to the 25% unrecaptured Section 1250 gain tax rate. Additionally, taxable gain on the sale may be subject to a 3.8% Net Investment Income Tax. For more information, see Questions and Answers on the Net Investment Income Tax. Refer to Publication 523, Selling Your Home and Form 4797, Sales of Business Property for specifics on how to calculate and report the amount of gain.