Microsoft (MSFT 1.82%) briefly surpassed $3 trillion in market cap, joining Apple as the second U.S.-based company to ever achieve that milestone. The tech stock briefly pulled back despite its phenomenal earnings report before moving higher again.

Let's dive into Microsoft's earnings and valuation to see if it can crack the $4 trillion market-cap ceiling.

A business person looking at their phone with an astonished look while sitting in front of their laptop.

Image source: Getty Images.

A reimagined business

Ten years ago, Microsoft Azure was fairly new; the cloud was not a core part of the business; overall growth was sluggish; and Microsoft was doing fine but not great. But over the last decade, Microsoft has completely transformed its business.

Market leaders have a history of losing pole position over time. Microsoft's history is chock-full of moments when it was beginning to look like a stalwart and then pivoted. The recent breakout growth is attributed to the cloud and artificial intelligence (AI).

In the second quarter of fiscal 2024, Intelligent Cloud posted $25.88 billion in revenue with a 48.2% operating margin. Productivity and Business Processes brought in $19.25 billion in revenue at an even better 53.4% margin, and More Personal Computing generated $16.89 billion in revenue off of a 25.4% margin, which is respectable for a hardware-heavy business.

AI is already having an impact across Microsoft. There's been strong adoption for AI solutions like Microsoft Copilots in Office products, Microsoft Edge, and GitHub. For example, GitHub Copilot paid subscribers reached 1.3 million, up 30% compared to Q1 fiscal 2024. The surge helped drive a 40% year-over-year increase in GitHub revenue.

In the cloud, Microsoft already has 53,000 clients for Azure AI. The company said that over half of the Fortune 500 companies use Azure OpenAI.

If you listened to the Microsoft earnings call, you probably heard a (sometimes excessive) use of the word "AI." But there's a big difference between using AI as a buzzword and generating real results from AI. Microsoft is in the camp where AI is having a measurable impact, so it's talking a big game but also backing it up.

A banner quarter

Looking at the Q2 results over the last decade is one of the easiest ways to better understand how much Microsoft's business has changed.

Over the last five years, revenue has roughly doubled, but operating income and diluted earnings per share (EPS) have nearly tripled due to margin expansion and stock buybacks. Go further back, and Microsoft is generating more diluted EPS in a single quarter than in an entire fiscal year from seven to 10 years ago.

Metric

Q2 FY15

Q2 FY16

Q2 FY17

Q2 FY18

Q2 FY19

Q2 FY20

Q2 FY21

Q2 FY22

Q2 FY23

Q2 FY24

Revenue

$26.47 billion

$23.8 billion

$25.83 billion

$28.92 billion

$32.47 billion

$36.91 billion

$43.08 billion

$51.73 billion

$52.75 billion

$62.02 billion

Operating Income

$8.02 billion

$6.03 billion

$7.91 billion

$8.68 billion

$10.26 billion

$13.89 billion

$17.90 billion

$22.25 billion

$20.4 billion

$27.03 billion

Operating Margin

30.3%

25.3%

30.6%

30%

31.6%

37.6%

41.6%

43%

38.7%

43.6%

Net Income

$5.86 billion

$6.03 billion

$6.27 billion

($6.3 billion)

$10.26 billion

$11.65 billion

$15.46 billion

$18.77 billion

$16.43 billion

$21.87 billion

Diluted EPS

$0.71

$0.62

$0.80

($0.82)

$1.08

$1.51

$2.03

$2.48

$2.20

$2.93

Data sources: Microsoft, YCharts.

The most impressive aspect of Microsoft's results is that it is growing revenue at a fast pace and growing margins. AI is a big part of that. Of Microsoft's revenue in the quarter, 72.8% came from its ultrahigh margin Productivity and Business Processes and Intelligent Cloud segments. The shift toward high-margin segments is why Microsoft, as a whole, just posted a 43.6% operating margin, which is far higher than the 30% or so margin it was generating in pre-fiscal 2020.

Microsoft's biggest headwind

The biggest red flag for investing in Microsoft is its valuation.

MSFT PE Ratio Chart

MSFT PE Ratio data by YCharts.

As you can see in the chart, Microsoft is trading well above its historic multiple. But what's really interesting about this chart is that the market has given Microsoft a steadily higher multiple over time.

It's 3-year median price-to-earnings (P/E) ratio is higher than the 5-year, which is higher than the 7-year, and so on. As Microsoft has become a faster-growing and higher-quality business, the market has been willing to pay a higher multiple for its earnings, which is reasonable if Microsoft sustains its torrid growth rate. The recent quarter proved that Microsoft is doing just that.

Microsoft deserves its 36 P/E ratio. But to get valuation expansion from here, it has to either grow margins or improve its revenue growth, which is an almost impossibly tall order.

However, the good news is that Microsoft doesn't have to gain a valuation expansion to be a great investment even now as it hovers around its all-time high. The math is wonderfully simple.

Assuming Microsoft is a fair valuation right now, then the stock would go up at the same rate as earnings growth. If earnings grow by 25%, Microsoft stock would have to go up by 25% to keep the same P/E ratio. If it stayed the same, the P/E would fall to around 27 based on the current P/E of 36. Put another way, as long as Microsoft keeps growing earnings, the stock price should go up or the stock would be inexpensive. Either way, it's a win for long-term investors.

Multiple paths to $4 trillion

The easiest way for Microsoft to reach a $4 trillion valuation is for the market to slap a 50 P/E on the stock, and we will be there in no time. But the more realistic way is good old-fashioned fundamentals.

If Microsoft keeps the same P/E ratio and its earnings increase by 33%, it will cross the $4 trillion mark. But even if its P/E falls to, let's say 30, which is around the 10-year median, then a 65% increase in earnings would still make the company worth over $4 trillion.

Given the growth we are seeing now, it's reasonable that Microsoft could accomplish that kind of earnings growth within the next three years.

Whether it's the easy way or the hard way, Microsoft stands out as a solid investment. The stock could undergo a valuation compression and slower earnings growth, and it could still easily surpass $4 trillion over the medium term.

I doubt Microsoft will pass $4 trillion this year, but I think it could easily get above $4 trillion by 2026 or 2027.