If you've recently gone through a foreclosure , you may not realize that you've traded your mortgage debt for a tax debt. The Internal Revenue Service treats foreclosure like any other property sale. If you're personally liable for any part of the mortgage debt that's been forgiven or canceled, you may have to recognize capital gains and pay taxes on it. Just how and whether you'll pay those taxes depends on the type of loan and property involved. 

A house with a foreclosure sign in front of it

Source: Getty Images

You may have to report capital gains

After your home goes through foreclosure, if the property sells for more than you owe, you may have to realize capital gains on the transaction – called a surplus.

Your bank or lender will report this amount on Form 1099-A and mail you a copy. Lenders must send a copy out before Feb. 28, but if you have not received this form yet, you should contact your financial institution. If you have any capital gains to report, the reported amount of those gains will depend on whether or not the loan was a recourse loan or a non-recourse loan.  

A recourse loan is a loan that you are personally liable for. Most mortgage loans, home equity loans, home equity lines of credit (HELOC), or subordinate loans on the property are recourse loans . So are most primary mortgages, except in these 12 states : 

  • Alaska
  • Arizona
  • California
  • Connecticut
  • Idaho
  • Minnesota
  • North Carolina
  • North Dakota
  • Oregon
  • Texas
  • Utah
  • Washington 

With this type of debt, the capital gain is the difference between the sales price and the adjusted basis on the property – typically the cost of the property, plus the value of any improvements you've made to it, minus any loss  it might have suffered from any kind of damage. Since a foreclosure does not have an agreed sales price, you can instead use whichever is smaller:

(1) The amount of money you owed right before the foreclosure (any outstanding loan, liens, or unpaid taxes) minus any amount you're still personally liable for after the sale, or

(2) The fair market value of the property transferred . According to the IRS, that's generally the gross foreclosure bid price. This value is typically used when the bank is making that bid, rather than a third party.

If you owe any remaining balance after the foreclosure proceeding, the lender can potentially sue you and have your wages garnished, bank account levied, or force the sale of another asset.

When it comes to non-recourse loans  – debts for which you're not personally liable – the sale price is the full amount of the debt right before the foreclosure . The capital gain is the sales price minus the adjusted basis in the property. If the sale results in loss – what's known as a deficiency – you're not responsible for any remaining amount due. This is why the loan is known as a non-recourse loan.

To report capital gains, use IRS Form 4797. You also need to report  Schedule D, Capital Gains and Losses .

You may be able to exclude capital gains

If you have capital gains to report, one of the largest tax benefits you can take advantage of is the "principal place of residence" exclusion. If you lived in your home and owned the home for a total of two years during the last five years, you can exclude up to $250,000 of the capital gains, or up to $500,000 if you're married filing jointly . This exclusion may help to rid you any tax liability.

You may have to recognize cancellation of indebtedness income (CODI)

If your home was subject to a recourse loan, you may owe taxes if the lender cancels any part of your debt. The IRS counts whatever now-forgiven amount you used to owe the lender as income – as if it were a payment that got you out of the red, and back to zero. In the IRS's eyes, that sum is an economic benefit  and could result in a tax liability.

You can use the IRS Table 1-1 Worksheet for Foreclosures and Repossessions if you have any CODI. The CODI may result in ordinary income, and you must include it in your gross income . If your forgiven debt totals $600 or more, the lender must issue Form 1099-C, Cancellation of Debt to you .

Suppose that Mr. Simpson purchased a four-bedroom home on Jan. 1, 2010 for $400,000 with a recourse loan from Burns & Smithers Bank. In January 2019, Mr. Simpson took out a $15,000 home equity loan from the same bank to cover some emergency expenses. On Jan. 1, 2020 Mr. Simpson lost his job at the local power plant, leaving him unable to pay both the original mortgage and the home equity loan. D'oh! By May 1, 2021, the home had gone into foreclosure, selling for $320,000, its full market value.

At the time of the sale, Mr. Simpson owed $320,000 on the original loan and $14,000 on the subordinate loan. Burns & Smithers Bank canceled $1,000 of the home equity loan and issued a 1099-C to him on Jan. 31, 2022. Unless some exclusion applies, Mr. Simpson will have to report that $1,000 as part of his income. But before Mr. Simpson tears out what's left of his hair, he may be able to take advantage of a loophole.

You may be able to exclude some of your canceled debt from income 

Under the Mortgage Debt Relief Act of 2007( extended for the years 2021 through 2025) you can exclude any canceled debt from the mortgage you took out to buy, build, or substantially improve your home up to $750,000. This is known as Qualified Principal Residence Indebtedness (QPRI) exclusion. 

If you are able to take advantage of this provision, you must report it to Form 982 and attach the form to your tax return.

You may qualify for additional relief if you are insolvent

If you can't take advantage of the Mortgage Debt Relief Act, you may still qualify for the IRS's insolvency exclusion. If you were insolvent – if what you owe exceeds the value of what you own– right before the foreclosure process canceled your mortgage debt, you can leave part or all of that canceled debt out of the income you have to report to the IRS.. 

If you qualify, start by checking box 1b of IRS Form 982, and report the canceled debt on line 2. Then use the amount of canceled debt to reduce certain tax benefits you'd otherwise get. 

The IRS doesn't want to let you benefit twice over from your misfortune. So if you reported a loss for selling stocks or bonds for less than you paid for them; if you have certain tax credits in your favor; or, among other situations, if property you own has suffered damage or otherwise lost value, your canceled debt amount could also wipe out some or all of the tax break you'd get from those scenarios. This is known as the reduction of tax attributes, and it's captured in Part II of Form 982. 

By reducing your tax benefits, the tax on the canceled debt is partly postponed, but not entirely forgiven. For instance, If you reduce the basis of property, but later sell the property at a gain, the part of the gain you got from this basis reduction gets taxed as ordinary income . 

Use the dollar amount of your forgiven debt to cancel out your tax attributes  in the following order:

  • Net operating loss from any business
  • General business credit carryover
  • Alternative minimum tax credit
  • Capital loss
  • The cost basis of the property
  • Passive activity loss
  • Foreign tax credit carryover

If you are eligible for this provision, the IRS urges you to carefully follow the instructions for Form 982.

There is light at the end of the tunnel

Having your home foreclosed on can be a painful process. Facing the associated taxes can be daunting. But if you receive a 1099-A or 1099-C, you don't need to panic. You may be eligible to exclude all or some of your capital gains or CODI from income by using the strategies outlined above, ending tax season with a little less tax debt and stress.