It's been all systems go for the S&P 500 index this year. Indeed, with a year-to-date return of 17%, a rebound from last year's dreadful 18% decline is almost complete.

However, there is one underlying issue with the index that has me concerned. In fact, I think it's led some investors to become overly exposed to certain companies but more on that later.

Let's start by examining what's going on within the S&P 500, and why it matters to investors.

One happy face on top of a stack of coins, surrounded by sad faces on top of smaller stacks.

Image source: Getty Images.

What's going on: Apple and Microsoft account for more than 14% of the S&P 500

The S&P 500 is a market cap-weighted index. This means that stocks with large market caps receive greater representation within the index. And the bigger the stock, the higher its relevance to the index.

Take Apple (AAPL -0.35%), for instance. With an immense market cap of $3.0 trillion as of this writing, Apple makes up 7.5% of the S&P 500. Similarly, Microsoft (MSFT 1.82%), which sports a market cap of $2.5 trillion, accounts for 6.7% of the index. 

Chart showing the S&P 500 stocks by weighting.

Data from S&P Global. Chart by Author using Slickcharts.

That means, taken together, the stock price movements of Apple and Microsoft account for 14.2% of the movement in the S&P 500. Bear in mind, 14.2% is the same weighting assigned to the bottom 271 companies.

At any rate, if the S&P 500 were equal-weighted (as some investors mistakenly believe it is), Apple and Microsoft would only represent 0.4% of the index.

Why you should care: Investors who own S&P 500-linked index funds are now highly exposed to Apple and Microsoft 

There's one big reason this matters to investors: diversification. In a nutshell, many investors are highly concentrated in Apple and Microsoft stock -- but they may not know it.

Consider this scenario: An investor has a $100,000 stock portfolio. They have $80,000 invested in an index fund or ETF, such as the SPDR S&P 500 ETF Trust (SPY 0.95%). Of the remainder, $5,000 is in Apple, $5,000 is in Microsoft, and the final $10,000 is distributed across a handful of stocks.

At first blush, it looks like a balanced portfolio. After all, $80,000 is invested into an index fund, and among the individual stocks, no position makes up more than 5% of the overall portfolio. However, since Apple and Microsoft account for such a large percentage of the S&P 500, this investor is actually quite concentrated in Apple and Microsoft, with more than a fifth of their holdings effectively invested in those two companies.

Due to the stocks' heavy weighting within the S&P 500, this investor owns not $5,000 worth of Apple stock but more like $11,000. Similarly, this same investor effectively owns $10,360 worth of Microsoft stock.

What you can do about it: Monitor your portfolio and ensure proper diversification

Now, don't get me wrong, I think Apple and Microsoft are great companies. Apple's dominance shows no sign of weakening, and I think Microsoft could eventually overtake Apple as the largest American company over the next decade.

That said, it's never a good idea to hitch too much of your investing wagon to just one or two stocks.

Why? Well, things happen: New competitors emerge, consumer tastes evolve, management teams come and go, and unforeseen legal matters arise.

In short, no one knows what's coming around the corner. That's why it's best to stay diversified in 20 to 30 stocks. That way, an exogenous event for one company (approximately 3% to 5% of your portfolio) won't decimate a large portion of your holdings. And that's a solid recipe to remaining smarter, happier, and richer.