For the most part there is no negative tax consequence in filing for bankruptcy. In fact, if there is a impending foreclosure on your house or if you are going to surrender it to the lender, there is a positive tax consequence.
Any foreclosure, surrender, deed in lieu of foreclosure, or short sale, involves the recognition of a certain kind of income if the debt deficiency is waived by the lender. That income is called discharge-of-indebtedness income or sometimes known as cancellation of debt income. It occurs when the house is worth less than the balance due on the loans (the deficiency).
If the lender does not attempt to collect the deficiency, that is to say the lender waives the deficiency, that waiver is treated as income to the debtor. However, Section 108 of the Internal Revenue Code excludes cancellation of debt income. But you must use IRS Form 982 on your 1040 return to tell the IRS that the income is excluded from income, otherwise the IRS will assess a tax based on the income reported by the lender when it files a 1099C with the IRS. (You should get a copy of the 1099C; keep it, and give it to your tax return preparer and tell him or her to use Form 982 to exclude the income. This is important!)
Beyond the cancellation-of-debt income, things can get pretty complicated. Technically speaking, the bankruptcy estate gets the debtor’s tax attributes, such as loss carry forwards, exclusion of gain, etc. The trustee of the estate may have to file income tax form 1041 because the bankruptcy estate is a separate taxpayer. But that’s generally not the debtor’s concern, and in any case most Chapter 7 cases have no income to report. The tax consequences in bankruptcy for debtors are usually pretty simple.