Tax Matters When Selling a House

The tax rules for home sellers can be very complicated. They are summarized below, but you should also download IRA Publication 523, Selling Your Home, from the IRS web site:

If you sell your primary residence at a profit, you may be able to exclude that profit from your taxable income. Unfortunately, you cannot deduct a loss from the sale of your main home. Worse, if you're contemplating abandoning your home or it is likely to be foreclosed, you need to check with a tax professional to see if you'll owe taxes as a result.

Here are the rules, in brief.

$250,000 or $500,000 exclusion on the sale of a primary residence.

Individuals can exclude up to $250,000 in profit from the sale of a main home (or $500,000 for a married couple) as long as you have owned the home and lived in the home for a minimum of two years. Those two years do not need to be consecutive. In the 5 years prior to the sale of the house, you need to have lived in the house as your principal residence for at least 24 months in that 5-year period.

You can use this 2-out-of-5 year rule to exclude your profits each time you sell or exchange your main home. Generally, you can claim the exclusion only once every two years. Some exceptions do apply.

Exceptions to the 2 out of 5 year rule. If you lived in your home less than 24 months, you may be able to exclude a portion of the gain. Exceptions are allowed if you sold your house because the location of your job changed, because of health concerns, or for some other unforeseen circumstance, like divorce or death.

Partial exclusion. You can exclude a portion of your gain if you are selling your home and lived there less than 2 years and you meet one of the above exceptions. You calculate your partial exclusion based on the amount of time you actually lived in your home. Here's how the exclusion is calculated: Count the number of months you actually lived in your home. Then divide that number by 24. Then multiply this ratio by $250,000 (if unmarried) or by $500,000 (if married). The result is the amount of gain you can exclude from your taxable income.

Calculating your cost basis and capital gain. The formula for calculating your cost basis on your main home is as follows:

Purchase price
Purchase costs (title & escrow fees, real estate agent commissions, etc.)
+ Improvements (replacing the roof, new furnace, etc.)
+ Selling costs (title & escrow fees, real estate agent commissions, etc.)
= Cost Basis
Profit or loss
Selling price - Cost Basis = Gain or Loss
If the resulting number is positive, you made a profit selling your home. If the resulting number is negative, you incurred a loss.
Taxable gain
Gain - Maximum Exclusion ($250,000 if single; $500,000 if married) or Partial Exclusion = Taxable Gain
Reporting the gain on the sale of your home. Gain on the sale of your home is reported on Schedule D of Form 1040 as a capital gain. If you owned your home for one year or less, the gain is reported as a short-term capital gain. If you owned your home for more than one year, the gain is reported as a long-term capital gain.

State capital gain taxes. Depending on your state of residence, you may also need to consider state capital gains taxes. It's entirely possible that you can avoid federal taxes on the gain but still get whacked with state taxes.