Shares of Amazon.com (AMZN -0.48%) and Microsoft (MSFT -0.25%) have outperformed the broader market significantly since the beginning of the year. Consumers and businesses are relying on these companies' services more than ever, as more people work from home. 

Amazon has been hiring tens of thousands of employees to help meet the demand for grocery delivery and other everyday essentials. The stock is currently up 28% over the last three months. 

On the other side, many businesses have made great use of Microsoft Teams over the last month to coordinate with employees during the stay-at-home mandates. Microsoft is in a solid position in the short term with its range of digital tools to help people remain productive, including Microsoft 365 (Skype and Office 365), Dynamics 365, and Teams. The shares are currently up a few percent over the last three months, despite the broader market below water year to date.

Amazon and Microsoft are rock-solid investments and have delivered market-beating returns over the past few decades. We'll compare the two stocks across several metrics to see which one is the better bet from here.

Analysts looking over data on a sheet with a laptop showing a stock chart in the background.

Image source: Getty Images.

Financial position

Here's a look at how each company stands financially. Both companies are very profitable and possess plenty of resources to invest in new growth opportunities. 

Metric Amazon Microsoft
Revenue (TTM) $280.5 billion $134.3 billion
Net income (TTM) $11.59 billion $44.32 billion
Free cash flow (TTM) $21.65 billion $40.58 billion
Net cash $31.61 billion $67.39 billion

Data source: YCharts. TTM = Trailing 12 month.

Amazon has spent massive sums opening warehouse shipping facilities to support the growing demand in its retail business over the last decade, and it continues to expand in underserved places to offer one-day delivery and even same-day delivery in some locations. 

This table illustrates how far Amazon has come over the last 10 years. Its total square footage for fulfillment centers and data centers has increased more than tenfold. Most of its square footage is comprised of massive warehouses.

Amazon's Fulfillment and Data Center Capacity 2009 2019
Total square footage worldwide 18.337 million 272.177 million

Data source: Amazon's 10-K SEC filing. 

Microsoft has made the successful transition to cloud services, as people now subscribe through Microsoft 365 to use Word and Excel instead of going to a store to buy a box with physical discs to install on your computer. This new business strategy has led to a steady improvement in profit margin over the last four years, making an already lucrative software business even more profitable. 

The software giant has a wide competitive moat, given its brand power and the familiarity millions of people have with Windows and Office programs. While these software tools continue to be a growing business for Microsoft, one analyst estimates that its fast-growing Azure cloud services business could become the company's largest source of revenue by 2023. 

The current state of both companies

Right now, most of Amazon's business is retail, while Microsoft's revenue is evenly distributed across its three main operating segments: Productivity and Business Processes (e.g. Microsoft 365 and LinkedIn), Intelligent Cloud (Azure and enterprise services), and More Personal Computing (Windows, Surface, and Xbox gaming).

Here is a breakdown of Amazon's revenue sources and recent growth: 

Amazon's Operating Segments 2019 YoY Growth
North America $170.8 billion 21%
International $74.7 billion 13%
Amazon Web Services $35.0 billion 37%
Total $280.5 billion 20%

Data source: Amazon's 10-K SEC filing.

And here is a breakdown of Microsoft's operating segments: 

Microsoft's Operating Segments Trailing-12-Month Through Fiscal Q2 2019 YoY Growth
Productivity and business processes $44.2 billion 14.7%
Intelligent cloud $43.76 billion 23.4%
More personal computing $46.3 billion 4.1%
Total $134.25 billion 13.3%

Data source: Microsoft earnings releases. 

It's impressive to see Amazon's North American retail operation still growing fast after all these years. That's because e-commerce is still small at 11% of total retail sales domestically and less than 15% worldwide. The current COVID-19 crisis will likely push more people to become comfortable ordering food and toothpaste online, so Amazon has a long way to go with its core retail business.

Despite increasing competition from Microsoft Azure, Amazon Web Services (AWS) is still the 800-pound gorilla in the infrastructure-as-a-service cloud market. Goldman Sachs estimates the value of AWS to be about $800 million, which is already about two-thirds of Amazon's total market value currently. That doesn't leave a lot of value investors are currently assigning to retail, which is a massive business on its own.

But what makes Amazon such a great investment opportunity is that there are other emerging businesses under its corporate umbrella that could grow to be even larger than both its core retail operation or cloud business.

Amazon has seen blazing growth from advertising services, although that business could see some pressure in a recession.

Additionally, Amazon is investing heavily in its own shipping fleet, which could compete with UPS and FedEx down the road.

But Amazon's biggest opportunity could be business-to-business e-commerce (Amazon Business). Bank of America estimates that by 2021 the total addressable market for Amazon Business will be nearly double that of Amazon's consumer e-commerce business. That's incredible, as it suggests that Amazon can maintain its high rate of growth for a long time to capture this massive opportunity.

As for Microsoft, the main reason to own the stock right now is the rapid growth of Azure, which reported revenue growth of 62% year over year in the December-ending quarter, and that growth rate is one reason why the stock has gone through the roof in the last few years, although Microsoft doesn't disclose the actual revenue from Azure.

Azure has chipped away at Amazon's lead in the cloud market. It recently made headlines for being awarded a $10 billion contract from the U.S. Defense Department. 

Still, AWS is estimated to be about twice the size of Azure, and AWS is still growing fast at over 30% year over year. That means that even though Azure is growing faster, AWS is still attracting about twice as much cloud spending as Azure each quarter. 

Valuation

Amazon and Microsoft have plenty of growth to offer investors looking for a good growth stock, so let's see if there is any separation between the two on valuation. Here is how these stocks measure up across a range of metrics. 

Metric Amazon Microsoft
P/E 103.8 29.8
P/FCF 55.6 32.6
P/CFO 31.3 24.4
Dividend yield NA 1.13%

Data source: YCharts. P/E = price-to-earnings. P/FCF = price-to-free cash flow. P/CFO = price-to-cash from operations. NA = not applicable; Amazon doesn't pay a dividend.

Microsoft looks like the better value across these metrics, and shareholders even get paid a dividend, whereas Amazon is plowing its cash from operations (CFO) into growth. I included the less commonly used valuation measure of P/CFO per share because it gives a different perspective on Amazon's valuation.

Given Amazon's willingness to sacrifice near-term earnings to maximize long-term free cash flow, Amazon has always looked expensive on a PE basis.

But look at this chart, which shows the last 17-year history of Amazon's P/CFO per share trading range.

AMZN Price to CFO Per Share (TTM) Chart

AMZN Price to CFO Per Share (TTM) data by YCharts

The stock has recently spurted higher to around $2,400, sending the P/CFO per share to the higher end of the range. But even at current highs, Amazon is still trading within its historical trading range on a P/CFO basis.

The thing is, the market has always undervalued Amazon's growth, which is why the stock has skyrocketed in value despite continuing to trade within the same valuation range over the last 15 years.

AMZN Chart

AMZN data by YCharts

I own both stocks and believe Amazon and Microsoft are two great growth stocks to add to your nest egg. But I would go with Amazon if I had to choose one stock to buy today.

Amazon has been a great compounding machine over the last 20 years, and the company still has so much potential.  

The range of opportunities Amazon has says a lot about the company's ability to attract talented managers who oversee its various business units, such as retail, AWS, streaming entertainment, the Alexa voice assistant, and logistics. I believe its success so far across all these areas speaks volumes about the corporate culture that CEO Jeff Bezos has cultivated since its founding, and that should serve it well in the future.