Bowlers dream about scoring a perfect 300. Marathoners aim for 26.2 miles. But for legions of workers aiming to eventually retire, the aspirational number to save each year is now $19,000 -- the yearly maximum you can put into a 401(k). And there's a good reason to shoot for that.

Actually, there are 1.4 million reasons. I studied historical market returns to find out what a 401(k) would be worth if you contributed the maximum amount for 30 years. I used the S&P 500's total return including dividends to represent stock results and total returns on 10-year Treasuries as a proxy for bond performance. The result is remarkable: Starting out at age 35 with an initial investment of $7,313 in 1988, the maximum allowed for a 401(k) that year, a maxed-out 401(k) would be worth $1.4 million 30 years later in 2018. This doesn't even include any employer matches.

I did add in catch-up contributions, though, which allow investors aged 50 and older to contribute a few thousand dollars more each year. I also adjusted the portfolio to be more conservative, including more bonds, as retirement neared. The portfolio started off with 80% stocks and 20% bonds for the first 10 years, moving to 70% stocks and 30% bonds in the second 10 years, and 60% stocks and 40% bonds in the final decade.

Glass jar with money spilled over.

Image source: Getty Images.

Even accounting for the tumultuous past three decades, which were in many ways a perfect stress test for a maxed-out 401(k), this portfolio would have grown to $1.4 million. Two major stock market meltdowns -- the dot-com bust of 2000 and the financial crisis of 2008 -- challenged investors' courage. Those disappointments were followed by the long-running bull market we're now in. 

To be sure, maxing out a 401(k) is no easy feat. The Internal Revenue Service raised the maximum elective 401(k) contribution to $19,000 in 2019, which would be a major sacrifice for most workers, if not an outright impossibility. Average pre-tax household income was roughly $74,000 as of 2017, meaning most people would need to sock away over a quarter of their income to hit the max. Putting this into perspective, that level of saving is comparable to the amount most households spend on housing, and it's more than double the typical allowance for food. Maxing out a 401(k) may also not make sense if your employer's plan charges high fees, or if making such large contributions prevents you from paying off debt with high interest rates. 

But it's still hard to argue with the results, which remind investors that these vehicles can be serious wealth-generating machines. And even if you can't quite max out your 401(k) yet, the process of crunching the numbers reveals a few lessons that can help all 401(k) investors. Here are a few of them.

Stay on the glide path

Most 401(k) plans offer target-date funds that automatically and gradually shift part of your portfolio from riskier asset classes like stocks into less volatile ones like bonds. This strategy -- known as a "glide path" -- helps safeguard your portfolio from a major hit as you get closer to retirement and are less able to withstand a financial shock. 

If you're looking to maximize your 401(k)'s growth, it might be tempting to try to amp up your returns and skip the glide path. After all, the long-term 9% return of U.S. stocks is roughly twice the return of global bonds. But history shows that the additional risk of U.S. stocks can be hazardous to your plan and reinforces the value of the glide path.

The best example of the glide path's importance occurred in 2008, when the S&P 500 dropped 37%. Our hypothetical investor was 55 years old at that point, with a 401(k) worth $512,000. A 100% exposure to stock in 2008 would have been a major setback, wiping away $189,000. But instead, our investor's portfolio at that point was 60% stocks and 40% bonds. In 2008, 10-year Treasuries posted a total return of 20%, so the portfolio's loss that year was just 14%, knocking a "mere" $52,000 from the balance.

Another example of the role of the glide path came in 2018 -- a potentially dangerous year, as our investor's 401(k) balance was large. While the S&P 500 posted a loss of 4.4%, with just 60% in stocks at that point, the hypothetical portfolio's actual loss was tempered to just 2.6% due to bonds' relative stability. 

The final countdown

Here's what the final years of our saver's 30-year plan to max out their 401(k) look like, assuming an asset allocation of 60% in stocks and 40% in bonds:

Year Age Funding Limit Catch-Up Contribution S&P 500 Total Return 10-Year Treasury Return Ending Balance Growth in Balance 
2018 65 $18,500 $6,000 -4.38% -0.02% $1,414,942 -0.5%
2017 64 $18,000 $6,000 21.83% 2.80% $1,421,752 16.2%
2016 63 $18,000 $6,000 11.96% 0.69% $1,223,748 9.6%
2015 62 $18,000 $6,000 1.38% 1.28% $1,116,543 3.6%
2014 61 $17,500 $5,500 13.69% 10.75% $1,078,072 15%
2013 60 $17,500 $5,500 32.39% -9.10% $937,733 18.7%
2012 59 $17,000 $5,500 16.00% 2.97% $789,973 14%
2011 58 $16,500 $5,500 2.11% 16.04% $692,727 11.2%
2010 57 $16,500 $5,500 15.06% 8.46% $622,872 16.5%

Be patient 

It's easy to question the wealth-building power of the 401(k) when you start out. Had you begun maxing out your portfolio 30 years ago at age 35, it would have taken years to see real progress. By the time our maxed-out investor turned 40, five years into the plan, the 401(k) was worth just $63,000. The magic of the 401(k) kicks in later, though. It cracked the $100,000 barrier in eight years, and it topped $1 million in 27. That's more than $700,000 in 401(k) wealth added to the portfolio during the last seven years, exceeding the $685,000 gained in the previous 23.

Know that it's not all yours 

Seeing a 401(k) balloon to $1.4 million after 30 years of maxing it out might make your eyes pop -- until you realize a big piece of that belongs to Uncle Sam, not you. A 401(k) plan is tax-deferred, not tax-free. You'll likely need to pay income tax on every withdrawal from the plan. And income from traditional retirement plans like 401(k)s is taxed at your ordinary income tax rate. 

So what are you waiting for? Maxing out your 401(k) can be a lucrative goal, and even if you can't quite reach it, trying to will leave you in a much better place.

The Motley Fool has a disclosure policy.