Crossing the $1 million threshold in your 401(k) is a satisfying landmark, even if it is just a round number of no actual importance. I crossed the line last year, and I wasn’t alone. The strong rally in equities in 2017 led to a 45% increase in investors above the $1 million balance line in Fidelity 401(k) accounts. That total of 157,000 at the end of the first quarter of 2018 shows that many can do it.

A recent Twitter discussion about this provoked some people to claim that a person would have had to have taken some wild risks to get there, but I certainly didn’t, and I doubt many of those across the threshold did.

I started my 401(k) in 1990, but really I date it to late 1994 when I was hired by Morningstar. The plan wasn’t perfect, but at the time it had solid low-cost funds and a company match of 100% up to a 7% contribution. Over the years, the fund lineup has gotten better, though the match now stands at 75%. So, it took me about 23 years to hit the mark.

The keys to reaching that level in a 401(k) also mostly apply to investing outside a 401(k) and are largely replicable by any investor. (And this is no promise that everyone in Morningstar’s 401(k) can get to $1 million, of course.)

1) Maximize your match. Getting money from a 401(k) match is as close as you get to free money. Admittedly, it’s a form of comp, so you’ve earned it. My point: If you are eligible for a match, then you’ve got to go get it. You are starting day one with a return for your contribution. And where else are you going to get a return of 50% or 100% on day one?

2) Maximize your savings. You can contribute $18,500 to your 401(k) this year or up to $24,500 if you are 50 or older. While it isn’t as important as reaching your match, the tax-free compounding is still a good way to invest.

3) Invest in low-cost core funds. These are the funds that get you to your goals. The quality of 401(k) lineups has improved substantially since the early ’90s, and many have some good options. Often they offer solid target-date funds that make investing easy. Morningstar was naturally ahead of the curve in terms of quality of offerings, their range, and the numerous fund companies represented. In the mid-1990s, many 401(k)s were from a single fund company and therefore had some weak links. Or they were from a single broker who collected some big fees.

4) Stay patient with your plan. Compounding rates of return are powerful but slow-moving forces. For them to work, you have to hold on through ups and downs. This is something that trips too many people up. Remember the “lost decade”? Investors didn’t make much money in equities between 2000 and 2010. That decade included two horrific bear markets that led some to throw in the towel. However, both bear markets were followed by dramatic rallies that helped investors cut their losses quickly provided that they stayed in the market.

5) Diversify. One thing that can derail a plan is a very aggressive bet on one thing, whether that’s your company’s stock, emerging markets, or a single fund manager. The markets generally go up, but there’s no rule that any particular stock or fund manager will. Most 401(k)s offer a wide variety of funds and asset classes. Make use of that. You don’t need every fund, but you should have diffuse holdings in the major asset classes.

6) Don’t try to market-time. If you plug into the 24-hour news cycle, it can be very tempting to try to time the market. When you are saturated in news, it can seem really obvious that this asset class will be a winner and that one a loser. And how dumb is it to just sit there when the market is plummeting? Avoid all these ideas. As Jack Bogle told me during one sell-off: “Don”t do something, sit there!” Markets are very hard to predict. In 2009, everyone knew that China was going to crush the United States and you should sell U.S. stocks and buy Chinese stocks. Wrong. In 2000, everyone knew that the U.S. was superior and that diversifying into foreign markets was foolish. Wrong again. Just don’t do it.

How Was I Fortunate?

To be sure, some things broke well for me that might not work out so well in the future. I had two great bull markets to invest in. I had access to cheaper, lower-cost, and more-diversified funds than most plans had–especially in the 1990s. I have been on Morning­star’s 401(k) committee for a couple of decades and thus have had the ability to get good funds added to the lineup. Finally, Morningstar has matched 100% or 75% of employee investments up to 7% for most of my time here.

Not everyone gets those advantages. However, the typical 401(k) today is light years ahead of where it was 20 years ago. Costs are much lower. Target-date funds are prevalent, making it much easier to plug into a well-designed lineup of funds, whereas at one time employees were simply handed a list of funds and told to pick the ones they wanted. Finally, portfolio tools make it easier to see your whole portfolio and understand what bets you’ve placed.

A Few Paths to $1 Million in a 401(k)

If you start out saving early, this is a pretty easy thing to achieve. Let’s take a 25-year-old making $75,000 a year who contributes 10% a year (within limits of allowed 401(k) contributions). Say he starts with $1,000 in his 401(k) and has an employer match of 50% on the first 6%. Then, let’s assume a 6% return and 3% annual salary increase. After 40 years, our smart early-saver will be sitting on $2.37 million. Not too shabby.

Now, let’s try a few tweaks to assumptions in order to appreciate the magnitude of these changes.

In each case, I will revert back to the above assumptions except for the one change below.

Bad markets lead to a 4% return: Now the saver is down to $1.54 million.

Awesome markets lead to an 8% return: Our saver is up to $3.78 million.

Our investor manages to save 8% a year: His nest egg is now $2.00 million.

Our investor is a super-saver who puts away 12% a year: Now he is up to $2.71 million.

Our investor’s salary grows by 5% a year: Now he is within a hair of $3 million, with $2.95 million.

Our investor’s salary grows by 1% a year: That nest egg has shrunk to $1.78 million.

Our investor retires at 55: That delivers a big hit, bringing the nest egg to just $1.12 million.

Conclusion: Starting early is so powerful that it over­comes quite a bit of misfortune. None of my scenarios took the nest egg below $1 million. That said, retiring early was the biggest blow to the plan, and as Chris­tine Benz has pointed out in her past columns, many people end up retiring sooner than they expected.

The Late Saver

What if you start late? Let’s model a scenario where everything is the same as before, but we have a 35-year-old saver with just $10,000 in his 401(k) and a starting salary of $100,000. This person would reach a $1.54 million nest egg by 65. That’s still pretty good.

Let’s see how it weathers changes in assumptions:

Returns of 4%: $1.12 million.

Returns of 8%: $2.17 million.

Saving 8% a year: $1.31 million.

Saving 12% a year: $1.75 million.

Salary grows 1% a year: $1.24 million.

Salary grows 5% a year: $1.84 million.

Retire at 55: $659,000.

Retire at 70: $2.25 million.

Match of 25%: $1.40 million.

Match of 75%: $1.71 million.

Conclusion: Wow. Don’t retire early if you start saving late. Retiring at 55 takes you well below $1 million. The swing in final nest egg value is enormous.

The Really Late Saver

Say you don’t start in earnest until age 45. I’ve bumped the annual salary up to $130,000 and a 401(k) balance of $50,000. This person’s nest egg would be $975,000 by age 65. That’s not bad, but obviously it is more vulnerable to turbulence in the drivers of the nest egg’s value.

Returns of 4%: $774,000.

Returns of 8%: $1.24 million.

Saving 8% a year: $849,000.

Saving 12% a year: $1.09 million.

Salary grows by 1% a year: $853,000.

Salary grows by 5% a year: $1.09 million.

Retire at 55: $349,000. Ouch.

Retire at 70: $1.49 million.

Match of 25%: $881,000.

Match of 75%: $1.07 million.

Conclusion: Changing any of our assumptions to the negative side takes the nest egg well under $1 million. On the plus side, working until 70 leads to a nice nest egg of $1.49 million.

Caveats

When you are modeling your retirement, be sure to factor in the tax bill on 401(k) withdrawals. As nice as the $1 million 401(k) sounds, it’s really more like $750,000 after taxes, depending on your tax bracket in retirement.

If you are a high-income person now, you will likely need to save quite a bit outside your 401(k) if you want to maintain your lifestyle.

Inflation is a much milder caveat, because salaries, the 401(k) maximum, and equities all tend to rise along with inflation. The model here didn’t factor in inflation, but your savings ought to grow along with inflation in most scenarios.