At the time of this writing, the S&P 500 (^GSPC 0.26%) is less than 1% off its all-time high and up 73% since the start of 2023. Artificial intelligence (AI) and investor appetite for risk have contributed to the torrid gains, making the market relatively expensive.

You may have seen headlines saying that the S&P 500 is overvalued compared to its historical averages. Or that red-hot growth stocks have run up too fast. But that doesn't tell the full story.

Three simple valuation metrics -- earnings, trailing price-to-earnings ratio, and forward price-to-earnings ratio -- explain what's going on with the market's valuation. Here's why they matter, why the S&P 500 isn't as expensive as it seems, and what that means for your investment portfolio.

A financial advisor discussing investments with a couple.

Image source: Getty Images.

This growth-driven market commands a premium price

The S&P 500 is an index featuring the 500 largest companies in the U.S. by market cap. The more valuable a company, the greater its influence on the index through its stock price. So a $4.5 trillion-plus company like Nvidia has more than 10 times the influence as a $400 billion company like Home Depot. But that also means Nvidia has 10 times the impact on S&P 500 earnings.

Just like individual companies, the S&P 500 has an earnings per share (EPS) metric. This is just an average of the earnings of each company adjusted for weight in the index. So again, Nvidia's earnings will have 10-plus times the impact as Home Depot's.

Ten particularly influential growth stocks, known as the "Ten Titans," now make up 39% of the S&P 500. But many of these companies are being valued for where they will be several years from now rather than where they are today. Meaning that their price-to-earnings ratios (P/E) and forward P/E ratios are elevated, thereby bloating the valuation of the S&P 500.

According to data from FactSet, the forward P/E of the S&P 500 is 22.5, compared to a five-year average of 19.9 and a 10-year average of 18.6. Based on forward earnings projections for the next year, which tend to favor growth stocks, the S&P 500 is 13.1% pricier than its five-year average and 21% more expensive than its 10-year average. Even if companies live up to expectations, their stock prices may not go up in the near term simply because these results may already be priced in.

Valuation matters less for investors with a long-term time horizon. If the S&P 500 goes nowhere for a year or two but earnings keep growing, the narrative will flip, and the index will look cheap. So the five- or 10-year return could still be solid, reinforcing the importance of approaching the stock market with a long-term time horizon rather than trying to make a quick buck.

S&P 500 gains can be misleading

Using P/E ratios and forward P/E ratios compared to historical averages only tells part of the story. Those two metrics alone may suggest that all stocks are expensive, but that's not the case.

^SPX Chart

Data by YCharts.

As mentioned before, the S&P 500 is up 73% since the start of 2023, but the S&P 500 Equal Weight Index has returned just 33.3% -- a nearly 40 percentage point difference. Instead of weighting by market cap, the S&P 500 equal-weight gives all S&P 500 components the same influence on the index. Nvidia moves the S&P 500 equal-weight index the same as any other company does.

When the S&P 500 outperforms its 500 equal-weighted index, it means that megacap companies are doing better than companies with smaller market caps. When the equal-weighted index outperforms, it means the megacap names are dragging down the index.

Since the start of 2023, megacap companies have drastically outperformed smaller S&P 500 names. Over the last decade, the S&P 500 rose 253.1% while the equal-weight jumped 161.6%. It would have been especially difficult for an individual investor to keep pace or outperform the S&P 500 during this period without significant exposure to megacap growth stocks.

Buying the S&P 500 for the right reasons

The biggest takeaway from these metrics is that the S&P 500 is expensive because a handful of growth stocks are driving its returns. But that doesn't mean that all S&P 500 stocks are pricey. In fact, that's hardly the case.

Many consumer discretionary and consumer staples companies have dirt cheap valuations due to pullbacks in spending. Even pockets of the tech sector are beaten down, namely in the application software industry, due to concerns of AI disruption for software-as-a-service business models.

Investors looking for stocks at a better value may not want to buy the S&P 500 at an all-time high. Or at least have it make up a smaller percentage of their portfolios. Whereas folks who believe that the Ten Titans will keep driving market gains may argue that the S&P 500 can grow into its lofty valuation because these companies are extremely well run, have tons of growth potential, high margins, and exceptional balance sheets.

In sum, the S&P 500 is no longer a balanced index, but rather a growth index. And that means investors should only consider buying it if its composition and valuation suit their risk tolerance.