The average American earns about $51,480 a year. That's based on the $990 median wage for the second quarter of 2021, according to the U.S. Bureau of Labor Statistics.

If you're earning an average salary, it may seem impossible to save and invest enough to retire a millionaire, especially with the costs of housing, child care, and groceries soaring. But a Schwab Retirement Plan Services study found that the average 401(k) plan participant believes they'll need just shy of $2 million in retirement.

Think $2 million is out of reach? Here's how to get there on the average American's salary.

A couple holds a smartphone to pose for a selfie.

Image source: Getty Images.

1. Plan to invest for at least 35 years

Most people with an average income can't afford to invest a huge percentage of their salary. So investing over a long time horizon and giving your money plenty of time to compound becomes ultra important.

If you invest $525 a month over 35 years with annual returns of 10%, you'd have just over $2 million in retirement. That's only about 12% of an average salary.

You can still get to $2 million if you don't have a 35-year time horizon, but you'll have to invest more each month. Assuming the same annual returns, you'd need to invest about $875 a month -- just over 20% of the average worker's salary -- to get the same results.

2. Get your full 401(k) match

It's a lot easier to become a multimillionaire on an average salary when all of that money isn't coming out of your pocket. That's why taking full advantage of your company's 401(k) match is a no-brainer.

One common match scenario is 50% of your contributions up to 6% of your pay. If your employer follows this formula, you'd need to contribute about $515 a month, but you'd get over $770 each month to invest. An automatic 50% return on your investment is too good to pass up. If you're getting a late start on investing, searching for a job that offers a 401(k) match can help you make up for lost time.

VTI Total Return Level Chart

VTI Total Return Level data by YCharts

3. Invest aggressively

To achieve 10% returns, you'll need to invest relatively aggressively. That means you'll need to invest primarily in stocks, rather than bonds, especially if you have a couple of decades until retirement. While stocks carry greater risk, the stock market has always recovered from downturns. You can shift to more conservative investments when your retirement is less than five years away.

4. Build a six-month emergency fund

While investing is the only realistic way to get to $2 million on an average salary, having a cash buffer can help protect your future millions. Aim to build a six-month emergency fund so that you can withstand a loss of income or a big expense without touching your investments.

The damage to your net worth can be long-lasting if you have to sell investments at a loss because you need cash. On top of that, if you're withdrawing money early from a retirement account, you'll often owe income taxes and a 10% penalty.

5. Invest your pay raises

You may be earning an average salary now, but that doesn't mean you'll earn an average salary forever. Get in the habit of budgeting and living below your means. Commit to investing extra money every time you get a raise. For example, you could plan to invest 50% of your next pay bump and spend the other 50%.

Consistent investing is only part of the equation in becoming an everyday millionaire. Avoiding lifestyle inflation is just as important on your wealth-building journey.