A foreclosure can hit you with two separate federal tax bills. The IRS treats the transfer of the home back to the lender as a sale, which can produce a capital gain or loss. Separately, if the lender writes off any leftover balance you owed, that forgiven amount is ordinary income. Understanding the tax consequences of foreclosure comes down to figuring out which of those two events applies to you, and whether an exclusion wipes out the tax on either one.1Internal Revenue Service. Publication 4681 (2025), Canceled Debts, Foreclosures, Repossessions, and Abandonments
The same rules apply whether the lender forecloses through the courts, sells at a trustee’s sale, or you sign the property back over through a deed in lieu of foreclosure. All three are treated as a sale for tax purposes.2Internal Revenue Service. IRS Courseware – Cancellation of Debt – Principal Residence
Recourse or Nonrecourse Debt Changes Everything
Before you can calculate anything, you need to know what kind of mortgage you had. Recourse debt means you were personally liable for the full balance; if the property was worth less than you owed, the lender could pursue you for the shortfall. Nonrecourse debt limits the lender to the property itself. Which one you had depends primarily on state law, and the rules vary. Some states bar deficiency judgments on residential mortgages, effectively making those loans nonrecourse. Others allow them freely, or restrict them only for certain foreclosure procedures. If you don’t know how your state treats your loan, find out before you file, because the answer changes both calculations below.
Recourse Debt
With recourse debt, the “amount realized” from the deemed sale equals the property’s fair market value at the time of foreclosure, not the loan balance. If the debt exceeded that fair market value and the lender forgave the difference, the gap becomes cancellation of debt (COD) income, taxed at your ordinary rate.1Internal Revenue Service. Publication 4681 (2025), Canceled Debts, Foreclosures, Repossessions, and Abandonments
Nonrecourse Debt
With nonrecourse debt, the lender absorbs any shortfall and can’t come after you personally. There is no forgiven balance, so there is no COD income. Instead, the IRS treats the full outstanding loan balance as the amount realized from the sale. That larger number can produce a larger capital gain, but the ordinary-income problem disappears.1Internal Revenue Service. Publication 4681 (2025), Canceled Debts, Foreclosures, Repossessions, and Abandonments
Figuring the Capital Gain or Loss
Your gain or loss equals the amount realized minus your adjusted basis. Adjusted basis is generally what you paid for the home, plus permanent improvements, minus any depreciation you claimed if you rented the property out. Report the figures on Form 8949, with totals flowing to Schedule D.3Internal Revenue Service. About Form 8949, Sales and Other Dispositions of Capital Assets
Take a home with an adjusted basis of $200,000, an outstanding loan of $250,000, and a fair market value at foreclosure of $180,000:
- If the loan was recourse, the amount realized is $180,000 (FMV). That produces a $20,000 capital loss. The $70,000 gap between the debt and FMV becomes COD income if forgiven.
- If the loan was nonrecourse, the amount realized is $250,000 (full balance). That produces a $50,000 capital gain. There is no COD income.
Long-term capital gains (property held more than a year) are taxed at 0%, 15%, or 20% depending on income.4Internal Revenue Service. Topic No. 409, Capital Gains and Losses A capital loss on a personal residence is not deductible; the tax code allows loss deductions only on investment or business property.
The Principal Residence Exclusion
If the foreclosed home was your main residence, Section 121 lets you exclude up to $250,000 of capital gain from income, or $500,000 on a joint return. You must have owned and used the home as your primary residence for at least two of the five years before the foreclosure. For the joint exclusion, at least one spouse must meet the ownership test and both must meet the use test. The exclusion is available only once every two years.5Office of the Law Revision Counsel. 26 USC 121 – Exclusion of Gain From Sale of Principal Residence
Section 121 only reduces the capital gain portion of a foreclosure. It does nothing about COD income.
Cancellation of Debt Income
When a lender forgives recourse debt after foreclosure, the forgiven amount is COD income, taxed as ordinary income at your marginal rate. This is where foreclosures produce the harshest surprises, because you owe tax on money that never passed through your hands.
Say you owed $300,000 on a recourse mortgage and the home’s fair market value at foreclosure was $220,000. The $80,000 difference is potentially taxable COD income if the lender writes it off. That amount gets added to your wages, interest, and other income for the year.6Internal Revenue Service. Home Foreclosure and Debt Cancellation
Several exclusions can eliminate this tax, but each one has to be claimed. If you file nothing, the IRS treats the full amount on Form 1099-C as taxable.7Internal Revenue Service. Instructions for Form 982 – Reduction of Tax Attributes Due to Discharge of Indebtedness
Exclusions That Can Wipe Out COD Tax
You claim any of these exclusions by attaching Form 982 to your return for the year the debt was discharged.
Qualified Principal Residence Indebtedness
The QPRI exclusion covers forgiven mortgage debt on your main home, up to $750,000 ($375,000 if married filing separately). The debt must be acquisition indebtedness, meaning money used to buy, build, or substantially improve the residence.8Internal Revenue Service. Instructions for Form 982
Timing matters. The QPRI exclusion applies to debt discharged before January 1, 2026. If the discharge happens in 2026, you can still use the exclusion only if the arrangement was entered into and evidenced in writing before January 1, 2026.9Office of the Law Revision Counsel. 26 USC 108 – Income From Discharge of Indebtedness If both the written agreement and the discharge fall in 2026, the exclusion is unavailable unless Congress extends it. As of early 2026, no extension has been enacted.
Using QPRI requires you to reduce the tax basis of your principal residence by the excluded amount, even if you no longer own the property. The exclusion also does not apply if the debt was forgiven because of services you performed for the lender or for reasons unrelated to a decline in the home’s value or your finances.9Office of the Law Revision Counsel. 26 USC 108 – Income From Discharge of Indebtedness
Insolvency
If your total liabilities exceeded the fair market value of your total assets immediately before the debt was canceled, you were insolvent, and you can exclude COD income up to the amount of that insolvency.10Internal Revenue Service. What if I Am Insolvent? It applies to any type of debt and has no expiration date.
To use it, build a balance sheet listing everything you own (bank accounts, retirement accounts, vehicles, other property) against everything you owe (mortgages, car loans, credit cards, medical bills, student loans). If you owed $400,000 and your assets were worth $350,000, you were insolvent by $50,000, and up to $50,000 of COD income can be excluded. Anything above the insolvency amount stays taxable. The trade-off: excluded amounts reduce certain tax attributes such as net operating losses, capital loss carryovers, and the basis of your remaining property, which can raise future taxes when that property is sold.9Office of the Law Revision Counsel. 26 USC 108 – Income From Discharge of Indebtedness
Bankruptcy
Debt discharged in a Title 11 bankruptcy case is fully excluded from gross income with no dollar cap.10Internal Revenue Service. What if I Am Insolvent? The discharge must be granted by the court or occur under a court-approved plan. This exclusion takes priority: if you are in bankruptcy, you must use it rather than QPRI or insolvency. Like insolvency, it requires a corresponding reduction in tax attributes and has no expiration.
The HELOC and Cash-Out Refinance Trap
Only the portion of your mortgage that qualifies as acquisition indebtedness is eligible for the QPRI exclusion. A HELOC or cash-out refinance used to pay off credit cards, buy a car, or cover medical bills is not qualified principal residence indebtedness, so forgiveness on that portion cannot be excluded under QPRI.1Internal Revenue Service. Publication 4681 (2025), Canceled Debts, Foreclosures, Repossessions, and Abandonments
An ordering rule tightens the squeeze. Where only part of a loan is qualified, the QPRI exclusion applies only after the nonqualified portion is accounted for. If you refinanced a $740,000 mortgage and added $110,000 for personal expenses, and the lender later forgave $115,000, only $5,000 would qualify for QPRI. The remaining nonqualified COD income might still be excluded under insolvency or bankruptcy if you qualify for those.1Internal Revenue Service. Publication 4681 (2025), Canceled Debts, Foreclosures, Repossessions, and Abandonments
Rental and Investment Property
Foreclosure on a rental gets more complicated because of depreciation recapture. Depreciation you claimed while you owned the property reduced your adjusted basis, which means a larger gain on disposition. The portion of your gain attributable to real property depreciation is unrecaptured Section 1250 gain, taxed at a maximum federal rate of 25%.4Internal Revenue Service. Topic No. 409, Capital Gains and Losses Any gain above the depreciation amount is taxed at regular long-term capital gains rates. If the foreclosure produces a loss, depreciation recapture does not apply because there is no gain to recapture.11Internal Revenue Service. Publication 544 (2025), Sales and Other Dispositions of Assets
Losses on rental and investment property are generally deductible, subject to passive activity loss rules. The Section 121 principal residence exclusion is not available for investment property.
Forms You Will See and File
Two IRS forms drive the reporting:
- Form 1099-A (Acquisition or Abandonment of Secured Property), which the lender issues when it takes the property. It reports the outstanding principal balance and the fair market value at the acquisition date.12Internal Revenue Service. Topic No. 432, Form 1099-A and Form 1099-C
- Form 1099-C (Cancellation of Debt), issued when $600 or more of debt is canceled. It reports the total forgiven.13Internal Revenue Service. Instructions for Forms 1099-A and 1099-C
If both events happen in the same calendar year, the lender may issue only a 1099-C and include the acquisition details on that single form.13Internal Revenue Service. Instructions for Forms 1099-A and 1099-C Use the 1099-A figures for the capital gain or loss calculation and the 1099-C amount as the starting point for COD income.
If you are claiming any COD exclusion, attach Form 982 to your return.7Internal Revenue Service. Instructions for Form 982 – Reduction of Tax Attributes Due to Discharge of Indebtedness Skipping it means the IRS treats the full 1099-C amount as taxable, even when you legitimately qualify.
If Your 1099-C Looks Wrong
Errors on Form 1099-C, especially on the canceled debt amount, happen more often than people expect. Contact the lender and ask for a corrected form. If the lender refuses, report the amount on the 1099-C on your return but attach an explanation of why the figure is incorrect.14Taxpayer Advocate Service. I Have a Cancellation of Debt or Form 1099-C Keep the original loan documents, payoff statements, and correspondence with the lender in case the IRS follows up.