Two of the largest companies globally are Microsoft (MSFT -1.27%) and Amazon (AMZN -2.56%). Combined, they have brought in $705 billion in revenue over the past 12 months, but that number pales in comparison to the growth trajectories both companies are on.

Is there an advantage that either stock has that investors should pinpoint? Or are they both evenly matched? Let's find out.

A common offering is the future for both

These two businesses hardly needs an introduction. Amazon's e-commerce platform has become the go-to place for nearly all shopping needs. Microsoft's Office products are standard for most computers, and it has a consumer product segment offering laptops and gaming consoles.

However, the most important segment for both companies' future may well be cloud computing. Microsoft's Azure and Amazon Web Services (AWS) are the industry leaders, each maintaining an impressive market share.

Company Rank Market Share
Amazon 1st 34%
Microsoft 2nd 21%
Alphabet (Google Cloud) 3rd 11%

Data source: Synergy Research Group.

That's a commanding lead over third-place Google Cloud. Additionally, each saw impressive revenue growth, with AWS rising 27% and Microsoft rising 35% year over year in their latest quarters. That growth is expected to continue for some time. Precedence Research expects the industry to grow at a compound annual rate of 17.4% from 2022 to 2030, eventually reaching a $1.6 trillion market.

Say Amazon and Microsoft can retain their current market share in cloud computing. This would put potential 2030 revenue for this segment at $544 billion for Amazon and $336 billion for Microsoft. That's impressive considering that Amazon's trailing-12-month revenue was $502 billion and Microsoft's was $203 billion. It's an opportunity for massive growth apart from their other businesses.

Looking at it another way, that $336 billion would be more than double Microsoft's non-Azure revenue today, by my estimate. By comparison, the projected $554 billion for Amazon's AWS business would be just a little over 30% more than its non-AWS revenue today. So cloud computing could have a much bigger impact down the road for Microsoft's revenue.

However, on the bottom line, cloud computing could be more meaningful for Amazon, because AWS has a higher margin than the e-commerce revenue. In fact, it's Amazon's only profitable segment right now. 

At Amazon, AWS is also funding other business segments. At Microsoft, Azure is complementary. This skews the future outlook in Microsoft's favor.

Amazon is the better value

However, stock valuation also has a role to play. Amazon isn't profitable, while Microsoft is, so comparing earnings or free cash flow isn't going to yield a helpful comparison. Plus, Amazon's commerce business is inherently low margin, even when profitable. So a direct comparison isn't possible. However, we can value each company in its own way.

MSFT PS Ratio Chart

MSFT PS Ratio data by YCharts

Microsoft's price-to-earnings ratio of 27.5 is rich although not quite as expensive as it's been over the past couple of years. Microsoft's execution and consistency have earned it its premium, but the company must continue to execute at a high level to maintain its valuation.

Moving to Amazon, if we value its AWS business at 9.4 times sales (the same as Microsoft) and its retail business at 0.7 times sales (the same as Walmart), you'd get a valuation like this below.

Amazon Segment Trailing-12-Month Revenue Segment Price-to-Sales Ratio Segment Market Cap
AWS $76.5 billion 9.4 $719.1 billion
Commerce $425.7 billion 0.7 $298.0 billion

Data source: Amazon and YCharts.

Adding those two segments together gives Amazon a theoretical valuation of $1.017 trillion, yet the stock is valued at $960 billion. This shows that it is potentially undervalued.

Over the long run, premium valuations can be overcome by solid execution and growth -- something Microsoft has demonstrated. Because of that, I think Microsoft is the better buy today although Amazon is still a strong company too. There's a lot of uncertainty with Amazon's commerce business, and so that gives Microsoft the edge.