Get your taxes done using TurboTax

The sale is standalone, what you do with the profits doesn't matter.

 

If you owned and lived in the home less than 2 years you do not qualify for the automatic capital gains exclusion, and will pay capital gains tax on the entire gain (long term capital gains if you owned the home more than 1 year, short term capital gains if you sell in exactly one year or less).

 

There are some circumstances that might qualify you for a partial capital gains exclusion, if the reason you are selling is due to certain types of unexpected financial hardships or other life circumstances that create a hardship.  These are listed in IRS publication 523 beginning on page 6.

https://www.irs.gov/forms-pubs/about-publication-523

 

For example, if you lived in the home 18 months (75% of 2 years) and you are selling for an unexpected hardship, you can exclude $187,500 of the gain, which is 75% of the normal exclusion (or $375,000 if married filing jointly). You would pay capital gains tax on the rest of your gain if your gain is more than the exclusion. 

 

If you believe you qualify for a partial exclusion, you don't attach proof with your tax return.  Just claim the partial exclusion but keep proof of the hardship with your other important tax papers for at least 3 years.