Investing when the stock market is trading at or near an all-time high can be scary.

Investors who have been sitting on the sidelines amid the current bull market may feel regret for not having invested earlier. Meanwhile, those with a lot of money in stocks may feel like the bull run is closer to the end than the beginning. After all, every bear market has to start just after stocks reach a new all-time high.

But history suggests now may be a great time to put your money to work in stocks.

A man holding a tablet with his hand on his chin.

Image source: Getty Images.

Stocks tend to keep going up after hitting a new all-time high

Generally speaking, stocks climb higher over the long run. To do that, they have to reach new highs all the time, so one all-time high typically leads to another. For example, the S&P 500 closed at a record high 77 times in 1995, which is approximately 30% of all trading days.

In 2024, the index has closed at an all-time high 22 times already through the first three months of the year. It wouldn't be a surprise to see stocks continue to march higher and set new all-time highs for quite some time.

The S&P 500 has historically gone on to climb an average of 14% higher one year after setting a new all-time high, according to data from Truist Advisory Services. Stocks currently trade about 8.5% above the previous all-time high set in Jan. 2022, so there's a lot more room to grow over the next few months.

Looking at the longer-term picture is also encouraging. The S&P 500 traded more than 50% higher, on average, three years after hitting an all-time high and an average of nearly 80% higher after five years, according to data compiled by JPMorgan. What's more, those numbers are higher than the average returns seen from investing on any given day. In other words, investing when the market hits an all-time high is usually a great time to buy.

The best way to invest when the market hits an all-time high

Individual stock investors may have a harder time finding good value in the market with stocks trading at all-time highs than they do in the bottom of a bear market. Still, there's almost always an opportunity somewhere. Doing your research and learning about great companies trading at a fair price can pay off handsomely over the long run.

But if researching and staying up to date on individual companies and their stocks isn't for you, you can still earn great returns by investing in a simple, broad-based index fund like the Vanguard S&P 500 ETF (VOO 0.35%). The index fund tracks the returns of the S&P 500 very closely and charges a minuscule fee to do so. It's one of the simplest and most effective ways to invest in stocks.

The current composition of the S&P 500 may mean the best opportunities lie with smaller companies. The top 10 companies in the S&P 500 account for over 36% of the entire index. That's a level of concentration investors haven't seen since the 1970s. As such, the next leg up in the stock market could be driven by smaller companies catching up to the megacaps that have driven returns in the past few years.

You can get more even exposure to the other 490 or so members of the S&P 500 by buying the Invesco S&P 500 Equal Weight ETF (RSP 0.70%). The index fund equally weights the stocks in the S&P 500 index, rebalancing once every quarter. That ensures you have just as much exposure to stocks 491 through 500 as the top 10. Historically, the equal-weight index has slightly outperformed the S&P 500 despite the strong performance of the biggest companies over the last decade.

Either way you want to invest, buying stocks when the S&P 500 is trading at an all-time high can still be a great opportunity. And while you might feel regret for having missed out on the bull market so far, history says the market probably isn't done climbing higher.