If you want to retire a millionaire, the key to safely doing so is saving up a lot of money and investing it for as many years as you can. Trying to take shortcuts will only put your money at risk and lead to potentially significant losses -- which can lead to a much more stressful retirement.

If you have at least 20 investing years left before you plan to retire, I'll show you how much you need to invest today to get to the $1 million mark. There are no sky-high returns assumed here, only modest gains that you can expect from safe, long-term investments.

People on a yacht.

Image source: Getty Images.

How much money should you save up to get to $1 million in 20 years?

Over the long term, the S&P 500 has averaged returns of around 10%. And that's the assumption that I make in the following chart, that whatever you invest in today will grow at that rate on average each year. Here's how much various initial investments ranging between $25,000 and $150,000 will grow over two decades at this rate:

Chart by author.

To get to $1 million, you will need to invest roughly $150,000 under this conservative approach.

The sobering reality for investors is that even with decades of investing, there is no substitute for accumulating savings. A $25,000 investment will only grow to less than $170,000 in 20 years. It's only as the accumulated balance becomes larger that the effect of compounding is the greatest. In the 20th year of growth in this model, the original $150,000 investment will increase by nearly $92,000 to finish at $1,009,125. By comparison, the $25,000 investment will rise by just $15,290 during that year.

If you are able to get to the $150,000 in savings, then the next part is relatively easy: Deciding what to invest in.

For conservative gains, investors have plenty of options to choose from

What's great about this strategy is that, since you don't need to plan for extremely high returns, you can just focus on stocks that either closely follow the market or normally outperform it. A great example of that is drugmaker Eli Lilly (LLY -1.00%). In the past 10 years, it has trounced the S&P 500:

Chart showing Eli Lilly's price beating the S&P 500 over the last several years.

LLY data by YCharts

However, the past doesn't predict the future, and investors may be worried about the potential for Eli Lilly to continue to rise at this rate. Although its sales jumped by 15% in 2021 to $28.3 billion, that kind of growth may not be sufficient to justify the stock's current forward price-to-earnings multiple of 36. The average healthcare stock in the Health Care Select Sector SPDR Fund trades at only 17 times future earnings.

The simpler and safer solution is to invest in multiple stocks. An easy way to accomplish that is through an exchange-traded fund (ETF) such as the iShares U.S. Healthcare ETF (IYH -0.69%). Not only does Eli Lilly make up about 4.8% of the fund's holdings, but it's just one of many top healthcare stocks in there. Big names such as UnitedHealth Group and Johnson & Johnson account for 9.2% and 8.6% of the fund's holdings, respectively. And over the past decade, the fund has also outperformed the S&P 500, rising by 284% in value during that time. 

This is just one example, but investors will have many other possibilities to choose from, as there's no shortage of quality ETFs available in the stock market.