Google parent Alphabet (GOOGL 1.08%) (GOOG 1.03%) and Microsoft (MSFT 2.35%) are among the world's safest stocks. Each company boasts a market cap above $1 trillion and holds liquidity positions exceeding $100 billion.

Such factors make it unlikely investors will go wrong with either stock. Nonetheless, not all investments are equal, and many factors could potentially make one a better choice than the other.

How the companies fare

In Alphabet's early days, when investors knew it as Google, it did not compete with Microsoft. It had achieved search engine dominance and drove its revenue almost exclusively from advertising. In contrast, Microsoft had already existed for 23 years and gained PC operating system dominance when Larry Page and Sergey Brin founded Google in 1998.

However, the companies have increasingly become competitors over the years as both businesses diversify. The competition began in earnest when Google Docs became a free alternative to Microsoft Office.

But the serious competition came when both evolved into cloud businesses. According to Synergy Research Group, Microsoft Azure and Google Cloud are second and third in terms of cloud market share. Microsoft claims 21% of the market, while Google makes up 10%. Both lag the market leader, Amazon's AWS, which holds 34%.

Still, the industry has grown 29% over the last year, and both companies exceeded that performance. In Q2, Google cloud revenue rose by 36% to $6.3 billion. In comparison, Microsoft's intelligent cloud segment grew by only 20% in its fiscal Q4 (which ended June 30) to $21 billion, though revenue for its Azure cloud service surged by 40%.

Overall financials and performance

Still, investors must evaluate both companies' overall performance, including legacy and emerging businesses. In Q2, Alphabet generated $70 billion in revenue, an increase of 13% versus the year-ago quarter. Also, rapidly rising expenses and losses on debt and equity securities helped cause net income to fall 14% to $16 billion.

Microsoft brought in almost $52 billion in revenue during its fiscal Q4, 12% more than in the same quarter last year. Like Alphabet, rising expenses and security losses also affected Microsoft. Still, it managed a 2% gain yearly, reporting almost $17 billion in net income.

Also, both stocks have suffered in the current bear market. Indeed, Microsoft's 18% decline over the last 12 months means it fared better than Alphabet, which lost 28% of its value over the same period. Both underperformed the S&P 500.

However, when looking at the stocks over a five-year period, both outperformed the index by a wide margin. Microsoft's returns came in approximately 80% higher than Alphabet's during that time.

GOOG Chart

GOOG data by YCharts

But amid that more significant drop, Alphabet sells for 19 times earnings, significantly lower than Microsoft's current P/E ratio of 25x. That factor alone may lead some investors to buy Alphabet, giving them a high-quality company at a lower price.

Alphabet or Microsoft?

Admittedly, both stocks should deliver positive and likely market-beating returns over time, particularly in the cloud. Additionally, their performance in both the cloud and overall revenue did not significantly differ in the latest quarter.

However, I have to give a slight edge to Alphabet. The Google parent offers cloud growth that matches Microsoft's at a lower valuation. While it is true that Microsoft has grown faster in the past, the fact that Alphabet fell further may set investors up for a more significant recovery. In the end, Alphabet could double your money as its cloud business and other endeavors take revenue and profits higher over time.