The Microsoft Surface. Photo: Vernon Chan, via Wikimedia Commons.

In the world of technology companies, you'd be hard-pressed to find two giants who have stood at the top of their respective niches for as long as Microsoft (MSFT -1.47%) and Alphabet (GOOG -2.01%) (GOOGL -2.12%), formerly known as Google.

With the market having experienced a bit more volatility than years' past, and with both of these stocks sitting near 10-year highs, you might think about sitting on the sidelines. But from a historical perspective, that's a mistake: Stocks go up more than they go down -- and if you're a long-term investors, you'll have to endure several volatile markets, and continue holding through several "10-year highs."

So, between these two, which is the more enticing bet? Let's examine based on three criteria.

Financial fortitude
There's nothing more fragilizing than debt. When unexpectedly tough times hit, debt can cause companies to drastically change their goals... or even declare bankruptcy. On the other hand, if a company has a lot of cash on hand, such volatile periods can actually present an opportunity -- to expand market share, make acquisitions, or even buy back stock.

Here's how the two companies stack up on traditional metrics of financial fortitude.

 

Cash & Equiv.

Debt

Net Income

Free Cash Flow

Microsoft

$102 B

$45 B

$11.4 B

$24 B

Alphabet

$72 B

$8 B

$15.8 B

$16 B

Cash and debt rounded to nearest billion. Net income and FCF are for trailing twelve months. Source: Yahoo! Finance

At the end of the day, each of these companies is a veritable cash machine. Google relies on its dominance of the advertising market for much of its cash, while Microsoft still benefits from its Office and Windows products and licenses for the vast bulk of its business.

Overall, I'm inclined to say that this is a tie. While Microsoft has more money on hand, it also has much more debt. And while Alphabet sports very little debt -- relative to its cash -- it didn't generate nearly as much free cash flow as Microsoft.

Winner = Tie

Sustainable competitive advantages and optionality
In my eight years of active investing, I've come to realize that there's no single metric that matters more to the success of my investments than an underlying company's sustainable competitive advantages. It is this which keeps customers coming back -- again and again -- to use the company's products.

With Microsoft, the ubiquity of both Office and Windows is undeniable. Office 365 has pulled ahead of Alphabet to gain the largest market share of enterprise customers -- though that share stands only at 25.2%. And according to netmarketshare.com, Windows accounts for 88% of desktop operating systems. The same cannot be said, however, for mobile devices, where as of the second quarter of 2015, Windows only accounted for 2.6% of operating systems.

And it is there where Google has been gaining a distinct advantage. We'll get to the company's search dominance in a minute, but consider that Alphabet's Android operating systems accounted for 83% of mobile operating systems worldwide last year, and you'll see that the slow migration to mobile devices is definitely helping Alphabet.

Beyond Android, Google has several other products with over 1 billion users: Google search, Maps, YouTube, Chrome, and Gmail... to name a few. What's key about these is that Alphabet collects gobs of data on users, and that data can then be used to offer advertisers the type of targeted ads that companies of yesteryear would have killed for.

Beyond that, Alphabet recently changed its structure to highlight its optionality. Starting with the company's Google[x] lab, Alphabet is taking a swing at many "moonshots" -- technologies that may not succeed, but if they do, will improve certain outcomes exponentially. Driverless cars, the connected house, and contact lenses that can sense insulin levels are just three examples of such technologies.

Combine this optionality with Google's 88% share of the global search market, and I think it has more competitive advantages.

Winner = Alphabet

Valuation
There are lots of ways to evaluate how pricey a stock is. Below, I'll show you how these two companies stack up on four different methods.

 

P/E

P/FCF

P/S

PEG

Microsoft

20

18

5

2.12

Alphabet

26

33

1.33

Source: Yahoo! Finance, E*Trade. Non-GAAP numbers used for P/E.

On almost every measure of valuation, Microsoft looks cheaper -- except for the last one, Price-to-Earnings-Growth. In effect, this tells us that analysts think it makes sense for Alphabet to trade hands for a premium -- because there's a higher probability for outsized growth. That growth will most likely come from the massive transition of advertising dollars from print and TV ads to desktop and mobile ones.

All things being said, however, Microsoft does look cheap. The number of businesses still using desktop computers -- and the company's operating system -- is still very high. The ubiquity of Office can't be ignored, either.

Winner = Tie

You really can't go wrong with buying either one of these stocks. Though I own shares of Alphabet myself, Microsoft has a more enticing valuation, and investors may be underestimating the strength of both Office and Windows. In addition, Microsoft offers a nice 2.7% dividend yield, while Alphabet has none.

While I give Alphabet the nod here, owning either Alphabet or Microsoft should help investors rest easy at night.