Most of us would like to retire as millionaires. Many of us actually need to retire as millionaires, simply to maintain what we might consider a modest and comfortable lifestyle in retirement.

The question is how to amass a million dollars or more by retirement -- or as much as you can, given the years you have before you retire. Many people are aware of index funds, but they might wonder whether an index fund could be sufficient. The answer is a simple yes -- an index fund, such as one that tracks the S&P 500, can be all you need to reach millionaire status.

A person is seated on a sofa, smiling broadly.

Image source: Getty Images.

Simple math

Going from $0 to $1 million is a matter of math. At a low average annual growth rate, it can take a long time. At a steep growth rate, it might just take a couple decades or so. A lot also depends on how many dollars you're investing, and how often you do so. Take a look at the table below to see how much you might amass investing various sums regularly, if your investment grows at an annual average rate of 8%:

Growing at 8% for

$5,000 invested annually

$10,000 invested annually

$15,000 invested annually

5 years

$31,680

$63,359

$95,039

10 years

$78,227

$156,455

$234,682

15 years

$146,621

$293,243

$439,864

20 years

$247,115

$494,229

$741,344

25 years

$394,772

$789,544

$1,184,316

30 years

$611,729

$1,223,459

$1,835,188

35 years

$930,511

$1,861,021

$2,791,532

40 years

$1,398,905

$2,797,810

$4,196,716

Source: Calculations by author.

That 8% isn't guaranteed, though. The stock market's average annual return over long periods is close to 10%, but over your particular investing time frame -- which may be, say, 10 years or 30 years -- the average return could be significantly higher or lower than 8%.

Growth rates matter

Check out the table below, then, to see the difference the growth rate makes for annual investments of $10,000. Any of the scenarios below is reasonably possible if you invest for the long term in an S&P 500 index fund.

Growing for

Growing at 6%

Growing at 8%

Growing at 10%

10 years

$139,716

$156,455

$175,312

15 years

$246,725

$293,243

$349,497

20 years

$389,927

$494,229

$630,025

25 years

$581,564

$789,544

$1.1 million

30 years

$838,017

$1.2 million

$1.8 million

35 years

$1.2 million

$1.9 million

$3.0 million

40 years

$1.6 million

$2.8 million

$4.9 million

Source: Calculations  by author.

Clearly, amassing a million dollars is achievable if you have enough time and/or you can invest hefty sums each year.

Index funds

So consider parking much of your long-term money in one or more low-fee, broad-market index funds, which can have you roughly matching the overall market's performance. Yes, many people want to aim for higher returns by reading deeply about investing, studying gobs of companies, and making buy and sell decisions about various individual stocks. But that takes time and effort.

It's arguably just as effective, or nearly as effective, to simply stick with index funds. Over long periods, they tend to outperform managed mutual funds, and they require very little effort on your part, other than adding money to them regularly.

With a little discipline and time, you may make yourself a millionaire -- or even a multimillionaire.