If you have access to a 401(k) at work, it can help you save for retirement. And this savings tool has many benefits, like reducing your taxable income.

But did you know that using this same simple investment account could make you a millionaire by the time you retire? Here's how. 

Mature man sitting at a desk and using a calculator.

Image Source: Getty Images

You can put up to $19,500 into your 401(k) in the year 2021, but hitting this maximum amount might seem like a lofty goal for you. Investing your contributions can help you grow your accounts by more than the contribution amount alone. And the higher your average rate of return, the less you could need in contributions annually.

Between 1926 and 2020, you could've earned an average of 10% annually if you invested 100% in stocks, or 8% with 40% in stocks and 60% in bonds, and 6% with a portfolio of all bonds. The table below shows how much $7,200 -- which is $600 monthly and roughly $150 weekly -- would grow at different rates of return over different time spans.  . 

  20 years 25 years 30 years
6% on average $280,748 $418,726 $603,372
8% on average $355,845 $568,472 $880,890
10% on average $453,618  $778,909  $1,302,793

Calculations by author.

If you can't contribute $600 a month on your salary, this is when a  401(k) company match can play a major role in helping you come up with the difference. Under this program, your employer will match every dollar that you put in up to a maximum. For example, if you make $75,000 a year and have a 4% match, your company will contribute up to $3,000 as long as you do the same. This would bring the amount that you personally had to contribute down from $7,200 to $4,200 each year.

Risk versus return

A higher rate of return is great, but comes with some extra risk and bigger potential losses during bear markets. The table below shows how you would've fared in 2008 with these three different portfolios.

  2008 Gain (Decline) 
100% stocks (37%)
40% stocks/60% bonds (20.1%)
100% bonds  5.24%

Calculations by author.

That's why finding your perfect mix of stocks and bonds shouldn't be done by choosing the rate of return you want. Instead, carefully examine things like how long you have before you need your money and how comfortable or uncomfortable you are with fluctuations in your account.

If seeing a stock market correction of 10% does nothing to your nerves, you can probably withstand an aggressive account made up mostly or entirely of stocks. But if it makes you nervous, adding a bigger proportion of safer investments like bonds can help you even out the volatility. 

No matter how losses affect you, as you get older and closer to needing your money, decreasing your stock exposure could be advisable. If you have 20 years until you need it, you'll have time to regain any losses you've suffered. But if you only have a year or two, that may not be enough -- a substantial loss could prevent you from reaching an important milestone like retirement. 

Time in the markets matters 

While it would be great if you could perfectly time when the stock market would lose money so that you could avoid it, it's probably impossible. Any such attempt could result in even more losses. You might sell out of your investments anticipating a stock market crash that never comes -- or not reinvest your money soon enough and miss out on crucial recovery days.

For example, between Jan. 2, 2000, and Dec. 31, 2020, investing 100% into the S&P 500 would've earned you an average annual rate of return of 7.47%. The table below shows how much missing some of the best stock market performance days during these 20 years would've cost you if you invested $10,000 at the start of this time period. 

  Average Annual Rate of Return (Decline)  Ending Balance
Fully invested 7.47% $42,231
Missed 10 best days 3.35% $19,347
Missed 20 best days 0.69% $11,474
Missed 30 best days (1.49%) $7,400
Missed 40 best days  (3.44%) $4,969
Missed 50 best days  (5.21%) $3,430
Missed 60 best days  (6.81%) $2,441

Source: JPMorgan.

Saving enough for retirement won't take a fortune, but it requires that you invest your money. And the earlier you can start, the more you should see your funds grow from compounding. But it will also take consistency on your part. And staying consistently invested can help increase your odds of meeting your goals.