Microsoft (MSFT 1.82%), perhaps more than any other company, encapsulates the impact that big tech is having on the stock market and major indices.

For years now, Microsoft has loomed large in Apple's (AAPL -0.35%) shadow as the second-most-valuable U.S.-based stock. But that could change, as Microsoft's $2.77 trillion market cap is within striking distance of Apple's $2.97 trillion market cap.

But it's not just about passing Apple in market cap that could make Microsoft the undisputed heavyweight champ of the stock market. Here's a look at how Microsoft could become the most important company in each major index and whether or not the tech stock is worth buying now.

A person working in a data center.

Image source: Getty Images.

Microsoft is moving markets

The S&P 500 and Nasdaq Composite are both market-cap-weighted indexes, meaning companies with higher values make up a larger share of the index. According to Slickcharts, Microsoft stock accounts for 7.24% of the S&P 500 and 10.32% of the Nasdaq Composite.

To put these numbers into context, Microsoft's 55.6% year-to-date stock price gain essentially accounted for 4 percentage points of the S&P 500's 18.4% gains this year and 5.7 percentage points of the Nasdaq Composite's 35.9% gains. This illustrates the impact a big gain from a heavily weighted stock can have on the broader market.

The Dow Jones Industrial Average is a little more complicated. Unlike the S&P 500 and Nasdaq, the Dow is a price-weighted index, meaning stocks with higher share prices have higher weightings. So while Apple may have a slightly heavier weighing in the S&P 500 and Nasdaq, it has a mere 3.59% weighing in the Dow, compared to Microsoft's 7.08% weighting. Similarly, stock splits don't affect a stock's weighting in the S&P 500 and Nasdaq, but they do in the Dow.

So how important has Microsoft been to the Dow this year? Well, the Dow is up 5.86% this year. Without Microsoft, it would have been up just 2.6%.

There's also just one stock that is heavier weighted in the Dow than Microsoft, and that's UnitedHealth Group (UNH 0.30%). UnitedHealth trades at around $540 a share, compared to around $375 a share for Microsoft stock. So Microsoft still has a ways to go before it is the heaviest weight in the Dow.

UnitedHealth isn't exactly the typical stodgy, low-growth healthcare company. The stock has more than doubled over the last five years. However, Microsoft definitely has what it takes to outperform UnitedHealth over time and eventually become the most valuable stock in all three major indices.

Blending the proven with the paradigm-shifting

Microsoft has been around for decades. Its consumer-focused and enterprise software solutions are nothing new. Its cloud business has blossomed into a high-growth cash cow. Its video conferencing solution is one of the leaders in the industry. And of course, Microsoft has emerged as a leader in artificial intelligence (AI) -- which undoubtedly contributed the bulk of the stock's gains this year.

The simplest reason to be optimistic about Microsoft's future is that it generates gobs of free cash flow, which it can use to support its legacy businesses and invest in long-term growth projects. The blueprint for a top growth company is that it embraces change, funds future projects with cash, not debt, and has the ability to transform its business. Microsoft has already done that to an extent with its cloud business. And AI is providing yet another transformation leap for the company.

Microsoft's deep pockets and free cash flow give it the wiggle room needed to take risks and absorb failures. Its most recent quarter (Q1 fiscal 2024) produced record-high free cash flow (FCF) of $20.7 billion. Here's a look at Microsoft's annual FCF over the last 10 years.

MSFT Free Cash Flow (Annual) Chart

MSFT Free Cash Flow (Annual) data by YCharts

Notice how Microsoft earned positive FCF every single year over the last decade. Over the last five fiscal years, Microsoft earned a staggering $264.24 billion in FCF. FCF can be used to buy back stock, pay dividends, make acquisitions, or reinvest in the business.

The beauty of Microsoft is that it can fund a ton of buybacks and its dividend and still have FCF left over to accelerate its growth. For example, Microsoft spent $20.4 billion on buybacks in fiscal 2023 and $19.8 billion on dividends compared to $59.48 billion in FCF. It's worth mentioning that FCF already accounts for expenses like research and development, which Microsoft spent $27.2 billion on in fiscal 2023 -- which illustrates the sheer amount of cash that Microsoft is generating.

Microsoft needs to deliver on its promises

The biggest question for Microsoft investors is how the company will be able to monetize AI and what kind of premium the market may be willing to pay for Microsoft stock. After all, Microsoft trades at a hefty 36.1 price-to-earnings (P/E) ratio, which is far above its 10-year median P/E of 29. That means that the market already expects the company's growth to accelerate, and therefore is willing to give the stock a higher valuation for that future growth.

Investors shouldn't expect Microsoft to regularly trade at a 40 or 50 P/E ratio. Microsoft already got the valuation expansion this year, with the stock price far outpacing the growth rate of its earnings. Instead, the stock is going to have to be driven higher by earnings.

The long-tail trends will take time to play out. And for that reason, a bet on Microsoft at its all-time high is a bet that earnings will grow and the company will able to support its higher valuation -- which remains to be seen.

In this sense, Microsoft stock may have a hard time running higher in the short term. But the company checks all the boxes for a worthwhile long-term investment.

Five years from now, assuming it doesn't split its stock, Microsoft stands an excellent chance at being the most important stock in the S&P 500 and Nasdaq, and surpassing UnitedHealth in the Dow.