Wall Street began the year cautious about 2024, with the consensus calling for flat annual returns at this time last year.

That turned out to be dead wrong, and the S&P 500 (^GSPC -1.06%) is now on track to deliver one of its best years in modern history. Through Dec. 20, the broad market index is up 23% and recently topped 6,000 for the first time.

On a two-year basis, the index is also on track for a phenomenal bounce, up 52.8% since the start of 2023. That period has coincided with the artificial intelligence (AI) boom, beginning shortly after the launch of OpenAI's ChatGPT on Nov. 30, 2022. Barring an end-of-the-year crash, which seems unlikely, the S&P 500 will finish the two-year period with a gain of more than 50%.

The index has only done that twice over the last 50 years. The first time came in 1975-1976 when the S&P 500 jumped 56.7% over a two-year span driven by an economic rebound following the oil embargo and recession of 1973-1974.

The second example is a little more complicated and covers five years from 1995 to 1999, or the dot-com boom era. Over that five-year period, the broad-market index jumped an impressive 219.9%, climbing nearly steadily over that span. During each of those two-year periods, the S&P 500 jumped at least 50%, but since they're all part of the same bull market and driven by the same factors, it makes sense to group them together.

The silhouette of a bull on a ridge.

Image source: Getty Images.

What history says

The table below shows how the stock market performed in the years following both of those surges.

Years S&P 500 Gains Following Year(s) S&P 500 Performance
1975-76 56.7% 1977: 11.5% drop
1995-99 219.9% 2000-2002: 40.1% drop
2023-24 52.8% (so far) 2025: ???

Data source: Ycharts.

As you can see from the chart, both multiyear surges led to pullbacks once they ended, and based on the two examples, the longer the period of gains was, the sharper the sell-off that followed. This pattern goes back further in history as well.

In other words, the S&P 500 can only sustain abnormally strong gains for so long before a retreat. The dot-com boom of the 1990s was unique. A strong economy, the end of the Cold War, and excitement about the internet drove a record bull market -- though the bear market was also longer and stronger than the average bull market as the S&P 500 fell nearly 50% from peak to trough when the dot-com bubble burst.

What's also notable is that if you combine the results from the gains and the pullback, investors still ended up ahead, and with a performance that approximated the historical average return of the S&P 500 of 9%. From 1975 to 1977, the S&P 500 jumped 38.7%, giving investors a compound annual growth rate (CAGR) of 11.5%. In the eight years spanning 1995-2002, the S&P 500 jumped 91.6%, equal to a CAGR of 8.5%.

What it means for investors

Predicting the performance of the stock market from year to year is generally a fool's errand, as Wall Street's forecast for 2024 shows. But as you can see above, bull markets and bear markets tend to balance each other out over time.

It's impossible to know how the market will perform in 2025. It's rare for two years like the previous ones to lead to more gains, but in many ways, the AI boom resembles the dot-com boom of a generation ago. If software companies and others start to show real growth from AI, 2025 will likely be another positive year.

However, the S&P 500 is also historically expensive, and we're likely to hit a bear market or at least a sustained correction when the current surge ends as the market's valuation has been inflated by bullishness about AI and the incoming Trump administration.

No one knows for sure when the next bear market will come, but for investors, the easiest and best approach is to invest for the long term, knowing that volatility tends to smooth out over time. Yes, the current roaring bull market is likely to lead to a sustained decline, but staying in the market is the best way to capitalize on the long-term growth and wealth accumulation it offers.