In case you didn't hear, U.S. credit card debt reached an all-time high last year, with the average indebted household now on the hook for roughly $16,000. And clearly, Gen Xers are no exception. According to a recent Allianz study, Gen Xers -- those primarily in their late 30s and 40s -- are struggling with debt to the point where it's impacting their long-term goals, particularly saving for retirement.

Consider this: Since 2014, credit card and student loan debt have increased 15% among Gen Xers. And almost half of Gen Xers are convinced they can't start saving for the future until they're debt-free.

40-something couple lounging side by side while browsing on a laptop

IMAGE SOURCE: GETTY IMAGES.

So what's their strategy in the meantime? For many late-30- and 40-somethings, the answer is a big fat nothing. Nearly two-thirds of Gen Xers think they'll just "figure things out" when retirement rolls around. At the same time, 59% are actively worried about maintaining their current lifestyle once they stop working.

If all of this sounds like a whopper of a contradiction, you're not alone. It's pretty clear that a large chunk of Gen Xers are in trouble, and if you're one of them, it's time to map out a plan of attack before time runs out on you. Otherwise, you risk compromising the retirement you've been working hard for all these years.

Don't let retirement savings fall by the wayside

It's easy to neglect retirement savings when debt payments loom. And to an extent, it does make sense to pay off costly credit card debt before sticking spare cash into an IRA or 401(k). After all, your investments, if you're lucky, might give you an average annual 9% return, which is comparable to the stock market's historical average. A credit card, meanwhile, might charge as much as 25% interest on the same sum you'd otherwise sock away for retirement. Even student loans can be costly to repay, particularly if you borrowed money from private lenders. Therefore, aiming to eliminate debt and then focus on retirement is a pretty reasonable strategy.

There's just one problem: Most Americans aren't good at paying off debt, and the reason is that so many of us continue living paycheck-to-paycheck. But unless you're willing to cut corners or work a side gig to generate extra cash, you're likely to get stuck in that endless cycle of debt, all the while letting your retirement savings suffer.

A better approach to paying off debt

If you're really intent on eliminating debt before building a nest egg, make certain you can pay it off quickly -- which, incidentally, you can do if you're smart about it. Start by creating a budget, which will give you a better sense of where your money is going. Next, review your expense categories and start immediately reducing your spending in those that are flexible (think leisure, cable, and even groceries). Or, if there are no expenses you're able or willing to cut, get a side hustle and make up the money that way. The key is to pay off your debt rapidly, and you need money to accomplish that goal.

While you're working on saving that cash, devise a solid strategy for knocking out your debt. Figure out where you're spending the most on interest, and pay those balances first. You might also look into a balance transfer offer if your credit is strong, because that will help you consolidate your debts and, ideally, lock in a lower interest rate on them in the process.

But as you're doing all of this, don't neglect your retirement savings completely -- especially if your employer offers a generous 401(k) match. Even if you don't manage to contribute to your plan above that level, be sure to put in enough to snag that match in full. Otherwise, you'll end up forgoing free money, which can really add up over time. Furthermore, don't forget the inherent tax savings that come with retirement plan contributions. When you fund a traditional IRA or 401(k), that money is deductible up front, which, depending on your effective tax rate, can amount to significant savings.

You can't afford to waste more time

Though Gen Xers are hardly at retirement's door, if you're on the older end of that spectrum, it means you probably don't have a ton of time to save for retirement. So if you're really going to wait to fund your savings until you're debt-free, be sure to get there quickly.

If you're 47 years old and want to retire in 20 years, but think it'll take you five years to get out of debt, you'll be left with just a 15-year window to save. And that really puts the pressure on, because if your goal is to retire with, say, $300,000 -- which actually isn't a huge amount -- you'll need to set aside roughly $1,000 a month for that decade-and-a-half-long period. You'll also need your average yearly investment return to come pretty close to the stock market's historical 9% average, which may or may not happen depending on your tolerance for risk.

The point is that while you might think you have plenty of time to pay down debt and save for retirement, that's not actually the case. And the sooner you realize that, the sooner you can take steps to effectively get out of debt and salvage your retirement in the process.

The Motley Fool has a disclosure policy.