Almost everyone dies with some debt. Some of it may die with you, but if you haven't planned accordingly, your estate could get wiped out by creditors coming to collect their due, leaving your heirs with nothing. Worse yet, they could be held responsible for some of your debt. But this depends on several factors, including where you live, the amount and type of debt you have, and the value of your estate upon your death.

Confused man surrounded by question marks

Image source: Getty Images.

In general, your estate -- that is, everything you own at the time of your death -- is held responsible for any outstanding debt. If there are enough assets to pay off the debt, the estate executor must do so. This may require selling personal property, and it can even include family heirlooms that are still in your name.

If your estate doesn't have enough money to pay back your debts, that's where things can get tricky. Secured debt, which includes auto and home loans, usually falls to the inheritor of the asset. If you had unsecured debt, such as credit card balances and student loans, then your estate will have to repay what it can, but your heirs likely won't be held responsible for any remaining balance.

However, there are exceptions to this.

Community property states

Ten states -- Arizona, California, Idaho, Louisiana, Nevada, New Mexico, Texas, Washington and Wisconsin -- have community property laws, which state that any debt incurred during a marriage belongs equally to both parties unless otherwise specified. That means creditors can come after your spouse for any of your outstanding balances, even on unsecured loans.

Your spouse won't be held responsible for any debts you incurred before you got married or any loans you took out for property that the two of you agreed would be kept separate. For example, if you finance a car that's only under your name, then creditors can't come after your spouse for this debt, even if the car was purchased during your marriage. To avoid leaving your spouse saddled with the debt, you'd have to fill out the appropriate paperwork for your state declaring that the car is not to be considered community property.

Cosigners

If a friend or family member has cosigned a loan for you, your estate will be responsible for paying the balance of the loan if you pass away. If your estate can't cover the outstanding amount, then the debt will fall to the cosigner.

If you cosigned a loan for a friend or relative, then what happens upon your death depends on the terms of the loan. If there is a successor clause, it means your estate will take your place as the cosigner. The primary borrower will continue making payments, and if he or she defaults, your estate will be held responsible. If it is unable to pay, the creditor is usually out of luck.

If a friend or relative cosigned a credit card for you or vice versa, the same rules apply. Authorized users on that credit card are not responsible for paying any debt, though they must cease to use the card unless they want to be charged with identity theft.

Home equity loans

Like most secured debt, home equity loans fall to your estate, the cosigner (if there is one), or the person who is inheriting your home. There's one big difference between regular mortgages and home equity loans when the borrower dies: Creditors can demand that a home equity loan be paid off in full immediately after your death. Failure to do so could result in the repossession of the home. Your cosigner or heir may be able to negotiate with the creditor in order to pay off the debt in installments, but this depends on their creditworthiness and the lender's policies.

Private student loans

Federal student loans are forgiven upon your death, but most private student loan companies are not so generous, and this debt often falls to your estate. There are a few private student loan companies, including Sallie Mae and Wells Fargo, that will forgive your loans if you die, so these are worth looking into if you're considering taking out a private student loan.

How to ensure your estate benefits your heirs

There are a few simple steps you can take to ensure that your heirs aren't left with a bunch of your debt after your death.

First, try to stat out of debt. The less debt you accumulate during your life, the less your estate will have to pay out when you die. If you're already in debt, take steps to pay it off now, giving particular priority to those debts that your spouse or cosigner could be held responsible for.

Second, create a will. If you die without one, the state will write one for you and decide which of your family members gets what. This often leads to administrative and legal fees, all of which must be paid before your estate can be divided up. When you write your own will, you can save your heirs these costly fees.

A will also enables you to make allowances to your family in the form of money or material gifts that are to be paid out before any debts, so you can save any family heirlooms and leave your friends and relatives something to remember you by.

Finally, be sure to invest in life insurance and retirement accounts. So long as you've named a beneficiary who survives you, retirement accounts -- including 401(k)s and IRAs -- cannot be touched by any creditor, with one exception: the federal government. If you owe Uncle Sam some taxes or criminal penalties, then your retirement savings will be up for grabs. But as long as you're not in the government's debt, all that money will pass on to your heirs.

Life insurance policies are totally out of reach of creditors, including the government. A life insurance policy can help your heirs pay back any of your debts that they're found responsible for, so they don't have to reach into their own savings to do so.

The Motley Fool has a disclosure policy.