Generally speaking, stocks have outperformed other asset classes like bonds and real estate over the long term, and equities have proven to be much less volatile than cryptocurrencies. That makes the stock market one of the best tools you can use to build your wealth, and diversified index funds are a particularly attractive option for many investors.

Of course, buying individual growth stocks can be far more rewarding, but that strategy is also much more risky. A broadly diversified index fund reduces your risk by spreading your investment dollars across a large number of companies in multiple different industries. That said, index funds can still generate big gains over time -- and even, with steady investments, grow into a million-dollar portfolio.

Which index fund is the best?

Index funds come in all shapes and sizes, but Warren Buffett has long been an advocate of low-cost S&P 500 index funds. In his 2013 letter to Berkshire Hathaway shareholders, Buffett explained his logic: "The goal of the non-professional should not be to pick winners -- neither he nor his "helpers" can do that -- but should rather be to own a cross-section of businesses that in aggregate are bound to do well. A low-cost S&P 500 index fund will achieve this goal."

The S&P 500 index tracks 500 of the largest public U.S.  companies. As such, it includes a mix of value stocks and growth stocks, and serves as a good barometer for the broader U.S. stock market. And Buffett, we should note, has advised investors to "never bet against America."

The Vanguard S&P 500 ETF (VOO 1.00%) is one of many good options for investors looking to buy the index. It has an expense ratio of just 0.03%, so investors will pay just $3 per year in fees for every $10,000 worth of the ETF they own.

How much money should you save?

Experts often recommend that people save 15% of their income for retirement. The median weekly income among full-time workers was $1,070 in the third quarter, according to the Bureau of Labor Statistics. That means the median worker should be saving $160.50 per week. That's more than enough to build a million-dollar portfolio provided you follow two important rules.

Rule 1: Make regular contributions to your S&P 500 index fund. Pay no attention to the market's ups and downs. Buying shares whether the S&P 500 is rising or falling helps balance out the impacts of market volatility and ensures that you pay an average price for your shares.

Rule 2: Plan to leave that money invested for decades. Generally speaking, you should only sell these shares to meet important financial goals like purchasing a house or providing the funds you need to cover retirement expenses. Never try to time the stock market.

How long will it take to become a millionaire?

Over the last three decades, the S&P 500 produced a total return of 1,620%, or 9.93% on an annualized basis. At that rate, investing $150 each week would give a person a portfolio worth $1 million after just 28 years. At that point, the power of compound growth, which would have contributed significantly already to your returns, would become even more evident. Assuming the same rate of return, your portfolio would be worth $2 million in 35 years, and $3 million after 39 years.

Of course, the goal of saving $150 a week may be out of reach for some people. That's OK -- you can build a million-dollar portfolio by regularly investing smaller sums, but it will take a little longer. For instance, $50 invested on a weekly basis would grow into $1 million in 39 years, assuming an annual return of 9.93%.