Whether you are selling the home right away or someone will remain in it, the key tax issue is proper planning to avoid unnecessary capital gains taxes when the home is sold.

If You Sell While Still Married
If you sell your primary residence and are still married at the end of that year, you may be able to shelter up to $500,000 of profit from any federal capital gains taxes. There are two ways to qualify for the full $500,000 federal gain exclusion.

First, you can file a joint return. In this case, the home must have been:

· owned by one or both of you for at least two of the five years preceding the sale, and
· used by both of you as the principal residence for at least two out of the five years preceding the sale.

When the home is jointly owned or community property, you can also file separate returns and each exclude up to $250,000 of your respective shares of the gain, provided you both pass the two-out-of-five-years ownership and use tests. This allows you to convert your home equity into tax-free cash and go your separate ways.

Gains that exceed the exclusion will generally be taxed at capital gains rates (15% maximum; 25% to the extent of any gains from depreciation deductions from periods after May 6, 1997).

Note that even though you may not owe any federal capital gains taxes, you might still owe state and local taxes.

If Your Home Will Be Sold After the Divorce
The federal gain exclusion rule can help here too.

Say ex-spouse A winds up owning a residence formerly owned by ex-spouse B. No problem. A gets to count B's period of ownership if necessary to meet the two-out-of-five-years test when A eventually sells the property. Of course, A's maximum gain exclusion is only $250,000, because he or she is now single.

However, if A remarries and lives in the home with the new spouse for at least two years before selling, A can qualify for the larger $500,000 exclusion by filing a joint return with the new spouse. The same would be true if A owned the home before the divorce.

Nonresident Ex Still Has Ownership After Divorce
In many cases, the ex-spouses will continue to co-own the residence after they split, but obviously only one will continue to live there. After three years of being out of the house, the nonresident ex will fail the two-out-of-five-years test. That means when the home is finally sold, his or her share of the gain will be fully taxable. Unless?

If you will be the nonresident ex, you can prevent this from happening to you. Here's how. Your divorce papers should specify that, as a condition of the divorce, you allow your ex to continue to occupy the home for as long as he or she wants. Or you can stipulate that the home must be sold or your share bought out after, say, the youngest child reaches age 19. Or after seven years. Or whatever. This arrangement allows you to get "credit" for your ex's continued use of the property as his or her primary residence. Now when the home is finally sold, you can still take advantage of the $250,000 gain exclusion to shelter all or part of your share of the profit.

Follow the same procedure if you will have complete ownership of the home but no longer live there. Once again, this ensures that you will still qualify for the $250,000 gain exclusion when the home is eventually sold.

Vacation Home
If you sell a vacation home for a profit, you will owe capital gains taxes. But consider this. Say you would like to use the home as your main residence after the divorce. Arrange to keep it as part of your side of the property settlement. Now if you live there for at least two years, you can sell the property and take advantage of the $250,000 gain exclusion. The only catch is you cannot have already taken advantage of the gain exclusion privilege within the previous two years (for example when you sold your share of your former primary residence). If you remarry, you and your new spouse can live in the former vacation home for two years and exclude up to $500,000. Heckuva deal.