Millennials tend to get a bad rap when it comes to being financially responsible, but a large percentage are on the right track. A good 80% of younger workers follow a budget, while more than half have savings set aside for emergencies. And among those contributing to a 401(k), nearly half of millennials are socking away more than 10% of their income.

But if there's one major mistake the majority of millennials are falling victim to, it's not investing in stocks. In fact, 57% of younger workers claim they're unlikely to ever invest in the stock market, according to newly published data from Allianz. And that only means one thing: Millennials risk thwarting their long-term savings efforts, and coming up short in retirement.

Serious younger man

IMAGE SOURCE: GETTY IMAGES.

Why are millennials shunning stocks?

Countless Americans stay away from the start market for one reason alone: fear. And millennials are no exception. Nearly a quarter of younger workers saw their parents suffer major financial setbacks during the 2008-2009 recession, and as such, they don't want to risk a similar fate at some point in their lives. But while we can't discount the possibility of a follow-up recession in our lifetime, one thing investors of all ages ought to know about the stock market is that it has an extremely strong history of rebounding.

Consider this: Over the 50-year period beginning in 1965 and ending in 2015, the S&P 500 underwent 27 corrections where it lost 10% of its value or more. And you know what? It recovered from every single one. What this means is that if you take a long-term approach to investing, you're likely to come out ahead by loading up on stocks. It's mostly those folks who seek to get in and get out quickly who wind up losing money in the market.

Now, older workers -- those within a year or two of retirement -- might hesitate to buy stocks, knowing full well that they'll need that money relatively soon. But if there's one thing millennials have on their side, it's time, which also means there's ample opportunity to ride out the market's ups and downs.

Inflation is your greatest enemy

Investors of all ages are encouraged to invest in stocks for the following reason: You're likely to score a strong return without taking on an undue amount of risk. But there's another reason millennials in particular should go heavy on stocks: They need that growth to outpace inflation.

Remember, a dollar today won't have the same buying power in the future. Its value will erode as the cost of just about everything around you climbs. And the only way to fight back is to invest your money in a manner that keeps up with, or, ideally, outdoes inflation.

Now, if you're wondering what sort of a difference a stock-focused strategy might make, take a look at the following table, which demonstrates how various investment styles can play out over a 40-year window, which is what many millennials are looking at:

Investment Style

Average Annual Investment Return

Total Accumulated Over 40 Years (Assumes a $300 Monthly Investment)

Conservative -- cash and bonds

2%

$217,000

Moderately conservative -- mostly bonds

4%

$342,000

Moderately aggressive -- bonds and stocks

6%

$557,000

Aggressive -- mostly stocks

8%

$932,000

Data source: author.

You can't help noticing the difference between a conservative investment strategy and an aggressive one. Of course, these represent two extreme ends of the spectrum, but even if we compare a moderately aggressive investment style to a more aggressive one, we're still talking about a $375,000 difference at the end of the day. And that's a lot of retirement cash to give up. Oh, and in case you're wondering, that 8% average annual return is actually a bit below the stock market's historical average -- meaning it's a reasonably attainable figure, even when allowing for market corrections along the way.

If you're a younger worker intent on retiring comfortably, do yourself a favor and work on warming up to the idea of stocks. Otherwise, your smart saving habits will only get you so far once inflation rears its ugly head and you're left struggling as a senior.