For the past couple of decades, the tech sector has been the darling of the stock market thanks to its outsized gains. In the last 10 years alone, the tech sector within the S&P 500 (^GSPC 0.24%) is up over 440%, while the S&P 500 itself is only up around 140%.

Their performances in 2023 have mirrored this trend, too. The S&P 500 is up 11%, while the tech sector is up 35% as of this writing. While this is great news for investors with a decent amount of tech holdings in their portfolio, there is a downside to this when it comes to funds and their makeup.

How investments are split within a fund

When funds are put together, the fund manager must decide how investments will be split among the companies within the fund.

The most straightforward way is to make the fund equal-weighted, which means every investment is split equally between the companies within the fund. For example, if you invest $1,000 into an equal-weighted fund with 100 companies, $10 goes to each company.

Another common approach is to make the fund market-cap-weighted, meaning investments are split between the companies based on their market capitalization.

Calculated by multiplying the total number of outstanding shares by the share price, a stock's market cap is one of the most common ways of assessing the company's value.

The effect rising valuations are having on the S&P 500

The most followed and popular index on the stock market is the S&P 500. It tracks 500 of the largest public companies trading on U.S. exchanges. Because the index is market-cap-weighted, any funds tracking the index use the same approach to their holdings.

On one hand, that's a plus because larger companies hold more weight and can make the index more stable since smaller stocks, which are more prone to volatility, make up a smaller piece of the pie. On the other hand, rising valuations for mega-cap stocks are pushing the index arguably too much toward those companies (many of them have market caps over $200 billion).

Eight of the top 10 companies in the popular Vanguard S&P 500 ETF (VOO 0.28%) are tech companies. Here's how much the market caps of the top five holdings have grown year to date:

AAPL Market Cap Chart

Data by YCharts.

As it stands, there are 505 stocks in the S&P 500 with a median market cap of about $183 billion. Despite the hundreds of stocks in the index, Apple and Microsoft alone account for over 13% of the fund. Add in the remaining six tech stocks in the top 10 holdings, and they account for 28% of the entire fund.

The problem with having a concentrated fund

To be fair, having blue chip titans like Apple and Microsoft lead the fund isn't necessarily the worst thing, especially when you look at their success. However, it's a lot easier to say this in retrospect when it works.

When it doesn't work, it reinforces the importance of diversification. If a company like DXN Technology, which makes up 0.01% of the S&P 500, experiences a major sell-off, it won't have a noticeable effect on the index. If Apple or Microsoft see their share prices slump, it'll be much more noticeable in the overall index's performance.

Diversification is one of the main reasons people flock to these kinds of funds, but it's slowly but surely eroding as the top players surge relative to other holdings.

Be mindful of overlapping companies in funds

Many popular indexes own the same companies. Take the three most followed indexes -- the S&P 500, Nasdaq Composite, and Dow Jones Industrial Average -- as examples.

The Dow contains 30 companies, all of which are in the S&P 500. Every tech company in the S&P 500 is included in the Nasdaq Composite. Around 280 or so Nasdaq Composite companies are also in the S&P 500. There's a lot of overlap between them, and this doesn't take into account any positions you may have in the stocks themselves.

With rising valuations and mega-cap stocks accounting for a growing share of many funds, it's important that investors keep track of just how much of their portfolio these massive companies or sectors make up. There's nothing wrong with having a large stake in these indexes, but the key objective behind diversification is mitigating risk. Don't lose sight of that.