Many people aim to retire with millions of dollars in savings. And for higher earners, that's generally a reasonable goal.

Average earners, however, might struggle to meet that target. But if you play your cards right, you could actually retire with millions even if you're not bringing home a six-figure salary. In fact, I'm about to show you how you can end up with $2 million even if you're only earning $50,000 a year.

Smiling person holding baby at desk with computer.

Image source: Getty Images.

Step 1: Start saving from a very early age

When it comes to building wealth for retirement, time is perhaps your greatest weapon. The longer a savings window you give yourself, the more opportunity you'll have to take advantage of compounded returns in your IRA or 401(k) plan.

When you invest your savings in an IRA or 401(k), you don't have to pay taxes on investment gains in your account year after year. As such, you can invest those gains on top of your incoming contributions to grow a substantial balance over time. But if you're making an average salary, it's imperative that you begin funding your retirement plan very early on -- ideally, as soon as you collect your first steady paycheck.

Step 2: Contribute to savings consistently

It's easy to let retirement savings fall by the wayside when life's expenses get in the way. In addition to starting early, you'll need to fund your retirement plan consistently. That means socking money away every month, not just when your bills are lighter.

In fact, a good bet is to automate the savings process as much as you can. With a 401(k), that's pretty easy, because your contributions are made as payroll deductions and they're taken out of your paychecks before they hit your bank account. But you can also find an IRA with an automatic savings feature that will let you do the same thing.

Step 3: Invest aggressively

Playing it too safe in your retirement account could mean falling short of your savings goal. If you want to hit millionaire status on an average salary, be prepared to go heavy on stocks.

Though stocks are more volatile than bonds, they've also delivered stronger returns over time. And if you load up on a diverse mix of stocks, you'll put yourself in a great position to weather market downturns and come out ahead.

Tying it all together

So, let's say you're saving for retirement on a $50,000 salary. We'll assume you retain that salary throughout your career, even though your earnings will most likely rise over time.

As a general rule of thumb, it's a good idea to sock away 15% to 20% of your earnings for the future. Since 20% might be a reach, we'll go with 15%. That's an annual contribution of $7,500, or $625 a month.

Let's also assume you start saving for retirement at age 26 and want to leave the workforce at age 67. That's full retirement age for Social Security purposes if you were born in 1960 or later.

Finally, let's go heavy on stocks in your retirement plan and assume you'll score an 8% average annual return. That return is a bit below the stock market's average.

Stick to this plan, and by age 67, you'll have a cool $2.1 million in savings. Really.

Of course, as soon as you stray from this plan, the numbers start to work out less favorably. If you don't start saving for retirement in this scenario until age 40, you only sock away 10% of your earnings, and you invest more conservatively, you'll be looking at a very different total.

The point, however, is that it is possible to grow a lot of wealth for your senior years even as an average earner. So don't let the fact that you're not pulling in six figures discourage you from pursuing the retirement of your dreams.