A foreclosure can hit you with two different federal taxes. The IRS treats the transfer of the home back to the lender as a sale, which can produce a capital gain, and if the lender writes off any leftover balance you owed, that forgiven amount is taxed separately as ordinary income. The foreclosure tax consequences you actually face depend on whether your mortgage was recourse or nonrecourse, whether the home was your main residence, and whether you qualify for one of several exclusions you have to claim yourself.1Internal Revenue Service. Publication 4681 (2025), Canceled Debts, Foreclosures, Repossessions, and Abandonments
A deed in lieu of foreclosure is treated the same way as a foreclosure for tax purposes.2Internal Revenue Service. IRS Courseware – Cancellation of Debt – Principal Residence Either way, the two tax events — the deemed sale and the possible cancellation of debt — are calculated separately, and an exclusion that wipes out one does not touch the other.
Recourse or Nonrecourse: The Distinction That Drives Everything
The first thing to figure out is what kind of debt your mortgage was, because that single fact changes both calculations.
With a recourse loan, you are personally liable for the full balance. If the lender ends up with the house and the house is worth less than the loan, the lender can forgive the difference or pursue you for it. For the deemed sale, the amount realized is the property’s fair market value at foreclosure. Any gap between the loan balance and that fair market value, if the lender forgives it, becomes cancellation of debt (COD) income taxed at your ordinary rate.1Internal Revenue Service. Publication 4681 (2025), Canceled Debts, Foreclosures, Repossessions, and Abandonments
With a nonrecourse loan, the lender’s only remedy is the property itself. There is no deficiency the lender can forgive, so there is no COD income. The amount realized on the deemed sale is the full outstanding loan balance, even if that exceeds the home’s value. That can produce a larger capital gain, but it keeps the whole transaction on the capital side of the ledger.1Internal Revenue Service. Publication 4681 (2025), Canceled Debts, Foreclosures, Repossessions, and Abandonments
Whether your mortgage is recourse or nonrecourse depends mostly on state law, and the rules vary significantly. Some states block lenders from pursuing a deficiency judgment on certain residential mortgages, effectively making those loans nonrecourse. Others allow deficiency judgments freely, or only restrict them for specific types of foreclosure. Clarify your state’s rule before you file, because the classification changes the entire calculation.
The Capital Gain or Loss Side
Your capital gain or loss equals the amount realized minus the home’s adjusted basis — generally what you paid for it, plus permanent improvements, minus any depreciation claimed. You report the figures on Form 8949, and the totals flow to Schedule D.3Internal Revenue Service. About Form 8949, Sales and Other Dispositions of Capital Assets
Say your home has an adjusted basis of $200,000, an outstanding loan balance of $250,000, and a fair market value at foreclosure of $180,000. If the loan was recourse, the amount realized is $180,000, giving you a $20,000 capital loss, and the $70,000 shortfall becomes COD income if forgiven. If the loan was nonrecourse, the amount realized is $250,000, giving you a $50,000 capital gain and no COD income.
If you held the property more than one year, any gain qualifies for the long-term capital gains rate rather than your ordinary rate.4Internal Revenue Service. Topic No. 409, Capital Gains and Losses A loss on a personal residence is not deductible — the tax code only allows loss deductions on investment or business property.
Section 121: Up to $250,000 or $500,000 Off a Main-Home Gain
If the foreclosed home was your principal residence, you can usually exclude up to $250,000 of the capital gain, or $500,000 on a joint return. You have to have owned and used the home as your main residence for at least two of the five years before the foreclosure.5Office of the Law Revision Counsel. 26 USC 121 – Exclusion of Gain From Sale of Principal Residence For the $500,000 amount, 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. A surviving spouse who sells within two years of a spouse’s death can claim the full $500,000.
Section 121 only touches the capital gain side. It does nothing for COD income.
Cancellation of Debt Income
When a lender forgives part of your recourse mortgage, the forgiven amount is ordinary income taxed at your marginal rate. This is where foreclosures create the ugliest surprises, because you owe tax on money you never received. If you owed $300,000 on a recourse mortgage and the home’s fair market value at foreclosure was $220,000, the $80,000 gap is potentially taxable if the lender forgives it, added on top of your wages and other income for the year.6Internal Revenue Service. Home Foreclosure and Debt Cancellation
Several exclusions can shield that income, but you have to claim them. File Form 982 with your return for the year the debt was discharged. If you do nothing, the IRS treats the full amount on your 1099-C as taxable.7Internal Revenue Service. Instructions for Form 982 – Reduction of Tax Attributes Due to Discharge of Indebtedness
Qualified Principal Residence Indebtedness (Watch the 2026 Cutoff)
The QPRI exclusion lets you exclude forgiven mortgage debt on your main home, up to $750,000 ($375,000 if married filing separately). It only covers acquisition indebtedness — money borrowed to buy, build, or substantially improve the residence.8Internal Revenue Service. Instructions for Form 982
Timing is critical. The exclusion applies to debt discharged before January 1, 2026. A 2026 discharge can still qualify, but only if the written arrangement was in place before January 1, 2026. If both the written agreement and the discharge happen in 2026, the exclusion is not available unless Congress extends it, and as of early 2026 no extension has been enacted.9Office of the Law Revision Counsel. 26 USC 108 – Income From Discharge of Indebtedness
If you use QPRI, you have to reduce the tax basis of your principal residence by the excluded amount, even if you no longer own the home. The exclusion also will not apply if the debt was forgiven for reasons unrelated to a decline in the home’s value or your financial condition, or in exchange for services you performed for the lender.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? This exclusion has no expiration date and applies to any kind of debt.
You build a balance sheet of 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 can exclude up to $50,000 of COD income. Anything above that remains taxable.
The trade-off: the excluded amount reduces your tax attributes, and for most homeowners the practical hit is a reduction in the basis of property you still own, which means a bigger gain when you eventually sell it.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 has to come from the bankruptcy court or occur under a court-approved plan. This exclusion takes priority over both QPRI and insolvency: if you are in bankruptcy, you have to use this one. The same tax-attribute reduction applies, and the exclusion has no expiration.
The HELOC and Second Mortgage Trap
Only the portion of your mortgage that qualifies as acquisition indebtedness is eligible for the QPRI exclusion. If you took out a HELOC and used it to pay off credit cards, buy a car, or cover medical bills, the forgiven balance on that portion is not qualified principal residence indebtedness.1Internal Revenue Service. Publication 4681 (2025), Canceled Debts, Foreclosures, Repossessions, and Abandonments
An ordering rule compounds the problem. When only part of a loan is QPRI, the exclusion applies only after the nonqualified portion is accounted for. If you refinanced a $740,000 mortgage and added $110,000 for personal expenses, creating an $850,000 loan, and the lender later forgave $115,000, only $5,000 of that forgiveness would qualify for QPRI. The first $110,000 of forgiveness is treated as the nonqualified portion.1Internal Revenue Service. Publication 4681 (2025), Canceled Debts, Foreclosures, Repossessions, and Abandonments The nonqualified COD income might still be excluded under insolvency or bankruptcy if you qualify.
Forms the Lender Sends, and What You File
Two forms drive the paperwork. The lender files them with the IRS and sends you copies.
- Form 1099-A (Acquisition or Abandonment of Secured Property): issued when the lender takes the property, reporting the outstanding principal balance and the fair market value as of the acquisition date.11Internal 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, reporting the total forgiven amount.12Internal Revenue Service. Instructions for Forms 1099-A and 1099-C
If both events happen in the same calendar year, the lender may issue only Form 1099-C and include the acquisition details on that single form.12Internal 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 income exclusion, file Form 982 with your return. Skip it and the IRS will treat the entire 1099-C amount as taxable even if an exclusion legitimately applies.7Internal Revenue Service. Instructions for Form 982 – Reduction of Tax Attributes Due to Discharge of Indebtedness
If Your 1099-C Looks Wrong
Errors on Form 1099-C happen more often than you might expect, especially on the canceled debt amount. If the figure looks wrong, contact the lender and ask for a corrected form. If the lender refuses, report the amount shown on the 1099-C on your return but include an explanation of why it is incorrect.13Taxpayer Advocate Service. I Have a Cancellation of Debt or Form 1099-C Keep the original loan documents, payoff statements, and any correspondence with the lender in case the IRS questions the discrepancy.
If the Property Was a Rental
Rental and investment property changes two things worth knowing. Depreciation you claimed over the years lowered your basis, so the gain on a foreclosure will usually be larger, and the portion attributable to depreciation on real property (unrecaptured Section 1250 gain) faces a maximum federal rate of 25%, higher than the standard long-term capital gains rate.4Internal Revenue Service. Topic No. 409, Capital Gains and Losses If the foreclosure produces a loss rather than a gain, the recapture rules do not apply.14Internal Revenue Service. Publication 544 (2025), Sales and Other Dispositions of Assets Losses on rental property are generally deductible, subject to passive activity loss rules and other limits. The Section 121 principal residence exclusion is not available for investment property.