The only exception to tax regarding real estate is the principal residence.
The principal residence can be any of the following types of housing units:
Also remember that you only half (1/2) of the capital gain is taxable.
Hope that answers your question.
Lawrence