When we think about consumer debt, we tend to point a finger at folks for whom shopping sprees are a way of life. But the real reason a large number of Americans wind up in financial trouble has nothing to do with self-indulgence or an inability to resist temptation. Rather, it's a matter of medical debt.

According to the Kaiser Family Foundation (KFF), more than a quarter of U.S. adults struggle to pay their medical bills. This includes folks who have insurance, whether independently or through an employer. In fact, medical debt is the No. 1 source of personal bankruptcy filings in the U.S., and in 2014, an estimated 40% of Americans racked up debt resulting from a medical issue.

Medical bill

IMAGE SOURCE: GETTY IMAGES.

Now it's not shocking to learn that countless Americans struggle with medical debt, but what is surprising is the extent to which insured individuals have trouble keeping up. Last year, The New York Times reported that 20% of Americans under 65 with health insurance had trouble paying their medical bills over the past year. Of those, 63% claim to have used up all or most of their savings to tackle their healthcare expenses, while 42% took on an extra job to cover their costs.

Unfortunately, having health insurance in no way guarantees that you won't fall victim to medical debt. But if you take steps to build an emergency fund, you'll be better protected in the face of an unanticipated bill.

Emergency savings can help

A big reason so many people wind up in debt over medical issues is that they don't have adequate savings to cover an unexpected cost. According to a recent GoBankingRates survey, 69% of Americans have less than $1,000 in savings, while 34% have no money in the bank whatsoever. But there's a reason we're all advised to sock away enough savings to cover three to six months' worth of living expenses. Even those of us with insurance are vulnerable in the face of a costly injury or illness, and without ample savings, collectively, we're taking a pretty big risk.

That said, there are things you can do to ramp up your savings, which can help you avoid medical debt that might ultimately result in bankruptcy. For starters, create a budget so you can accurately track your spending and identify ways to cut corners. Next, reduce your spending for all categories that aren't essential living expenses. These include leisure, restaurant meals, and even cable (you can probably downgrade your current package and still enjoy your share of TV).

If that doesn't do the trick, then you'll need to consider more significant changes, such as downsizing your living space, unloading a vehicle, or working a side job to generate extra income. The key is to save up enough money so you're protected at all times.

Bankruptcy is no picnic

Now you may be thinking: "So what if I end up filing for bankruptcy as a result of medical debt?" But here are some things you ought to know about bankruptcy. First, it stays on your record for 10 years, during which time you may have difficulty renting an apartment, getting an auto loan, or even finding a job. That's a long time to be saddled with a glaring financial disadvantage.

Second, one of the most ironic things about bankruptcy is that it costs money -- a lot of money -- to file. Because the bankruptcy code is complex, you'll need to hire a lawyer, and any filing fees you incur will be passed directly to you.

Furthermore, there's no obvious distinction between filing for bankruptcy as a result of medical debt versus reckless spending. A bankruptcy filing on your record is a black mark regardless of why it happened, and when you apply for a new line of credit, your lender won't necessarily care or know the difference.

Tempting as it may be to look at bankruptcy as a fallback option when your medical expenses get out of control, a better bet is to work on building your savings and hope it suffices in helping you cover your costs. Another option? Examine your health insurance plan more closely and see if it makes sense to pay a higher premium for more comprehensive coverage. In some cases, you'll come out way ahead by opting for a costlier plan that offers better benefits and lower copayments and deductibles.

Finally, don't neglect health issues in their early stages, because that's when they're typically the easiest and least expensive to treat. The longer you wait to address a medical problem, the greater your risk of having it escalate into a series of bills you just can't keep up with.