After a brutal 2022, the S&P 500 (^GSPC 1.02%) has rebounded nicely this year and was up 13% in 2023 at the time of this writing. But according to Slickcharts, only 147 of the 503 S&P 500 stocks are beating the index this year. Possibly more perplexing, half of S&P 500 stocks have a negative year-to-date return. 

Let's break down the disconnect between the index's performance and the performance of individual stocks so we can learn about the dynamics of the S&P 500, the importance of diversification, and why holding through periods of volatility is the best way to smooth out the randomness that can come from a given year.

Confused person staring  at a laptop screen.

Image source: Getty Images.

Big gains from big names

Here's a look at the top 20 S&P 500 components with the highest year-to-date (YTD) gains, as well as their respective market capitalizations.

Company

YTD Gain

Market Cap (as of 10/2/2023)

Nvidia (NVDA 6.18%)

197.7%

$1.106 trillion

Meta Platforms (META 0.43%)

149.5%

$789.9 billion

Tesla (TSLA -1.11%)

103.1%

$798.5 billion

Royal Caribbean Cruises (RCL 2.27%)

86.4%

$23.5 billion

Carnival (CCL -0.66%)

70.2%

$17.8 billion

General Electric (GE 0.68%)

69.1%

$118.3 billion

Palo Alto Networks (PANW 0.91%)

68%

$73.1 billion

PulteGroup (PHM 2.19%)

62.6%

$16.1 billion

Airbnb (ABNB 0.75%)

60.5%

$87.1 billion

West Pharmaceutical Services (WST -2.10%)

59.4%

$27.4 billion

Advanced Micro Devices (AMD 2.37%)

58.8%

$166.8 billion

Booking Holdings (BKNG 0.53%)

53%

$110.4 billion

FedEx (FDX 0.12%)

53%

$66.7 billion

Salesforce (CRM 0.42%)

52.9%

$198.2 billion

Arista Networks (ANET -0.02%)

51.6%

$58.1 billion

Adobe (ADBE 0.87%)

51.5%

$237.3 billion

Amazon (AMZN 3.43%)

51.3%

$1.336 trillion

Lam Research (LRCX 2.65%)

49.1%

$83.5 billion

On Semiconductor (ON 2.53%)

49%

$40.3 billion

Alphabet (GOOG 9.96%) (GOOGL 10.22%)

48.6%

$1.704 trillion

Data sources: Slickcharts

For context, the median market cap of an S&P 500 stock is about $32 billion. But the average market cap of an S&P 500 stock is $71.2 billion. 

Basic statistics indicate that whenever the index's average is much higher than the median, the return of the S&P 500 is heavily skewed toward the performance of the stocks with the largest weightings.

The S&P 500 has a market cap of about $35.8 trillion at the time of this writing. The 10 largest components of the index have a market cap of $12.5 trillion. So, 10 stocks alone make up 35% of the index's performance.

Everything can change in a year

A lot of tech stocks and communications companies with high market caps have had huge years. Referring back to the table of the top 20 best S&P 500 performers so far this year, you'll notice big gains from Nvidia, Meta Platforms, Tesla, Amazon, and Alphabet -- all of which are in the top 10 largest holdings list by market cap.

This dynamic contrasts starkly with what happened last year, where a lot of big tech stocks had down years and the best performers were inflation-resistant stocks or companies contributing to inflation, like oil and gas stocks.

The lesson here is that it's important to be aware of what is driving the market's performance and what that means for your portfolio. If you owned a lot of big tech stocks last year, you probably underperformed the market. If you sold those big tech stocks, you probably underperformed the market again this year. But if you held them, you're probably doing just fine.

On the flip side, if you owned a lot of value stocks and conservative dividend stocks last year, you probably kept pace or even beat the market. But if you held those stocks throughout this year, you're still probably doing fine -- you may just be lagging the market.

Take advantage of market dynamics

The key takeaway is that anything can happen in the short term, and the performance of the S&P 500 can be driven by different sectors. When it's driven by higher-weighted components, as it is this year, there's a good chance that many or even most stocks are underperforming the index. 

Using a three- to five-year timeline or longer allows an investment to play out (or not play out) and reduces the randomness that can come by focusing too much on the short term. If you look back at the last five years, for example, you'll see different sectors leading the market in different years. What often happens is that a hot sector cools off the next year, and the underappreciated sectors pick up steam.

This isn't to suggest you should trade in and out of sectors. Rather, it's meant to showcase that excellent companies can be in and out of favor at a given point in time. Understanding when great companies are out of favor, like big tech was in 2022, or how industrials, consumer staples, energy, materials, financials, healthcare, utilities, and real estate are out of favor this year, can help you gain the confidence needed to take a contrarian approach and buy quality companies on sale.

Having the patience to persevere through volatility and let an investment play out is the best way to achieve your goals in the stock market.