Retirement is a scary prospect given the financial unknowns involved. You might think you're saving enough for your senior years, only to realize that healthcare costs more than anticipated, or that despite having paid off your mortgage, you're looking at thousands of dollars each year in property taxes, maintenance, and home repairs.

It's for this reason that workers are encouraged to save diligently for the future. You'll often hear you should be socking away 15% to 20% of your earnings in a 401(k) or IRA, and that's good advice.

But here's the problem with setting funds aside for retirement and calling it day: If you don't invest that money in a manner that generates decent growth, the value of your savings will erode over time. We can thank inflation for that.

Stacks of gold coins increasing in height from left to right underneath an upward arrow

IMAGE SOURCE: GETTY IMAGES.

In fact, an estimated 65% of pre-retirees worry that the value of their savings won't keep up with inflation, according to a recent survey by the Society of Actuaries. If that's a concern of yours, the solution could boil down to investing aggressively.

Load up on stocks for maximum growth

It's no secret that Social Security does a poor job of keeping up with inflation, so if you want to enjoy a comfortable retirement lifestyle, you'll need to rely on your savings. And to that end, you'll need to get on board with the idea of investing aggressively -- namely, by loading up on stocks in your 401(k) or IRA rather than playing it safe by focusing mostly on bonds.

Imagine you set aside $500 a month in a retirement plan over a 30-year period, but you invest heavily in bonds so that during that time, your 401(k) or IRA delivers an average yearly 4% return on investment. All told, you'll have about $336,500, representing about a $156,500 gain.

But watch what happens if you go heavy on stocks instead. Assuming that same monthly contribution and time frame, you'll be sitting on close to $567,000 after 30 years if your retirement plan investments generate an average annual 7% return. That's a few percentage points below the stock market's average, so it's a reasonable assumption to work with for a portfolio consisting mostly of stocks. That $567,000 also represents a $387,000 gain.

Don't play it too safe with your retirement account

It's not easy to put your lifetime savings into stocks and watch your account balance swing rapidly when the market goes through a period of volatility. In fact, it's the horror and stress of seeing those losses on paper or on screen that drive so many people to stick to safer long-term investments. But while the idea of losing money in stocks may seem scary, here's an equally frightening notion: not having enough money in retirement because inflation zaps your buying power. To avoid that fate, have faith in the stock market and its ability to recover from downturns, and pledge to put a large chunk of your money there. If you don't, you may wind up cash-strapped -- and miserable -- during your senior years.