Excluding Gain from the Sale of Your Home at a Glance
If you have a gain from the sale of your main home, you may qualify to exclude up to $250,000 of that gain from your income, if you have owned and used your home as your main home for a period aggregating at least two years out of the five years prior to its date of sale. You may qualify to exclude up to $500,000 of that gain if you file a joint return with your spouse. There are several limitations and exceptions to these general rules.
Publication 17, Your Federal Income Tax - Chapter 15, Selling Your Home - See Excluding the Gain for essential guidance
Publication 523, Selling Your Home - Detailed guidance