When you are made bankrupt, all assets that belong to you come under the control of the Trustee whose duty is to make as much money as they can from these to start to pay back your creditors. These assets include your home.
If you own your home, solely or jointly, your interest in the property will form part of your estate, which will be dealt with by your Trustee. If no alternative solution can be found then your property may be sold to help pay off your debts.
To avoid this you may be in a position for your spouse, partner, relative or friend to buy out your interest in the property. They should make an offer to the Trustee who will consider whether it is fair and reasonable before making a decision.
If you have children or other dependants living in your home it is often possible for the sale to be postponed until the end of the first year of bankruptcy to allow you to find alternative accommodation.
If the Trustee is unable to sell the property immediately they will usually obtain a charge, which protects their interest. You cannot then sell the property without the Trustee being made aware. If you do so they will claim the interest that is covered by the charge which includes any increase in the value of the property.
If you rent your home the Trustee will have no interest in the property and therefore he cannot sell this. The Trustee will usually tell your landlord that you are bankrupt however and if you do not comply with the terms of your tenancy then the landlord may take action against you which may result in your losing your right to remain there.