Last year was one for the books in the stock market. The S&P 500 returned more than 25%, including dividends. That's an excellent gain and marks a strong recovery after 2022's near 20% decline.

But with such a strong year in the books, can investors expect the stock market to go higher in 2024? Let's look at history and see what happened in similar situations.

2023 was a great year, but it was far from out of the ordinary

For all of the historical annual returns, I'll utilize the total return metric, which includes the effects of dividends. While some investors choose to take their dividends in cash and not reinvest them, the market's long-term trend is up, making these withdrawals a mistake (unless you need the dividend income to fund retirement).

Since 1926, the market has had a total return of more than 25%  27 times (including 2023). That means the market delivers returns of this magnitude more than a quarter of the time. So, while this year was truly extraordinary for investors, it wasn't by any means all that unusual.

Part of 2023's success came from the big decline in 2022. Of the years where the market returned 25% or greater, six of the 27 came after a decline of 10% or more, and 11 came after a negative year.

But that brings up an interesting point: 16 of the 27 years where the stock market rose by at least 25% were preceded by a positive year. This is somewhat counterintuitive, but the conclusion here is that just because the market was up substantially in one year doesn't mean it will be down the next.

This is an important mindset focus for most long-term investors, as the historical trend for the stock market is up.

Although nobody knows what next year will bring, it would be nice to get a glimpse of what's possible.

The stock market's return for 2024 will be...

In the years after a gain of 25% or more, the average total return was 10.2% -- a phenomenal average return. The best year was 1927, which had a 44% total return. The worst year following a 25% return was 1936, with a 35% decline.

That's a wide range of results, which speaks to the random and unpredictable nature of the stock market.

This leads me to the following conclusions about what investors should do for 2024:

  1. If you don't have any urgent need for your money for the next three to five years, leave it in the market. Even after great years, the market still posts solid years on average.
  2. If you have a large expense (like building a house or buying a car) or are near retirement, ensure you have enough money to fund those expenses. However, completely going into cash is a mistake because you'll need the long-term returns to continue funding your activities.
  3. If you haven't started investing yet, now is the time. The historical trend of the market is up. While there may be plenty of reasons you can come up with not to invest (overvaluation, presidential elections, global turmoil), these events have been happening throughout the near century-long existence of the S&P 500. Buying an index fund like the Vanguard S&P 500 (VOO 1.00%) or the SPDR S&P 500 (SPY 0.95%) is a great decision to take advantage of this fantastic investment.

While I don't know what the stock market will do in 2024, history tells me it should be another positive year. We'll see what happens during the next 12 months, but I'm staying invested despite a phenomenal 2023.