Under IRC Sec. 121 if as of the date of sale you have owned and used a property as your principal residence for 24 out of the last 60 months, then you can exclude up to $250,000 of gain ($500,000 if married filing joint) if filing a single or MFS return.
If you are in your principal residence for less then 24 months you generally may not use the Sec. 121 exclusion (i.e. $250K/$500K exclusion) unless you qualify for an exception to use a pro-rata exclusion. You may use a pro-rata exclusion if the reason you are selling is related to a job change, for medical reasons or for some other unforeseen circumstance (i.e. death, disability, divorce, job loss, financial hardship, etc.). See below for a more expanded explanation of the allowable exceptions.
The pro-rata portion of the exclusion is calculated by dividing the number of days you both owned and occupied the property as your principal residence by 730 days (i.e. two years). Multiply the resulting percentage by $250K if single or $500K if MFJ.
If you do not meet one of the exceptions, then the gain is taxable. If you own the property for more then one year, then the gain will be treated a long-term and will be taxed at capital gain rates (i.e. a maximum of 15% Federal). To the extent the gain would be taxable in the 10% and 15% brackets, it is taxed at a capital gains rate of 5%. Otherwise the gain is treated as short-term capital gain (STCG) subject to offset by any capital losses. Any STCG remaining after offset by capital losses is treated as ordinary income the same as wages and interest subject to whatever your marginal tax rate is. Don't forget state taxes.
A sale or exchange is due to a change in place of employment if the primary reason for the sale or exchange is a change in the location of a qualified individual's employment. As a safe harbor, the regulations provide that a sale or exchange is deemed due to a change in place of employment if the change occurs during the period of the taxpayer's ownership of the property and its use as the principal residence and the qualified individual's new place of employment is at least 50 miles further from the residence sold or exchanged than was the former place of employment, (or, if there was no former place of employment, the distance between the qualified individual's new place of employment and the residence sold or exchanged is at least 50 miles).
A sale or exchange is due to health if the primary reason is to obtain, provide, or facilitate the diagnosis, cure, mitigation, or treatment of disease, illness, or injury. A safe harbor is provided for a physician recommended change of residence.
A sale or exchange is due to unforeseen circumstances if the primary reason for the sale or exchange is the occurrence of an event that the taxpayer could not reasonably have anticipated before purchasing and occupying the residence. Under the safe harbor rules, a sale or exchange is deemed to due to unforeseen circumstances if any of the following events occur during the period of the taxpayer's ownership and use as principal residence; in the case of a qualified individual, death, the cessation of employment if, as a result, the qualified individual is eligible for unemployment compensation, a change in employment or self-employment status that results in the taxpayer's inability to pay housing costs and reasonable basic living expenses for the taxpayer's household, divorce or legal separation, or multiple births resulting from the same pregnancy.The unforeseen circumstance exception is rather open-ended and is subject to the taxpayers facts and circumstances. If none of the above exceptions applies, give me some more detail about the reasons for the sale and I can then give you my opinion about whether a pro-rata exclusion may be available.