A taxpayer can exclude up to $250,000 of the gain on the sale of the taxpayer's main home if all of the following are true:
The ownership test is met. (owned the property for 2 of the last 5 years.)
The use test is met. (used the home as the primary residence for 2 of last 5 years)
During the 2-year period ending on the date of the sale, the taxpayer did not exclude gain from the sale of another home.
A taxpayer can exclude up to $500,000 of the gain on the sale of taxpayer's main home if all of the following are true.
He is married and files a joint return for the year.
Either the taxpayer or his spouse meets the ownership test.
Both the taxpayer and spouse meet the use test.
During the 2-year period ending on the date of the sale, neither the taxpayer nor the spouse excluded gain from the sale of another home.
The gain is taxed as a long term gain. The tax is computed on the amount of the sale after deduction the $250K or $500K.
You really should let a professional tax preparer work this out for you. There may be other considertions.