They are two of the biggest, most important technology companies in the world. Apple (NASDAQ:AAPL) -- in the span of less than 20 years -- has gone from almost-bankrupt to the brink of having a $1 trillion valuation. Microsoft (NASDAQ:MSFT) -- after its meteoric rise leading up to the turn of the millennium -- has leveraged its most well-known properties to become a force again.

But between these two, which company is the better buy at today's prices? The answer may surprise you.

Man looking at computer screen with surprised face.

Image source: Getty Images

Of course, we can't answer that question with 100% certainty. But below, we'll dive in by comparing the two stalwarts on three different criteria. 

Financial fortitude

We'll start with the most straightforward measure: financial fortitude. In the end, here's what any investor should be asking him/herself: how would a company be affected by an economic downturn if it happened right now.

If it would be ruined -- because it carries too much debt and has negative cash flow -- then it is fragile. If the company would sustain some damage, but -- in the long run -- emerge unscathed, then it would be robust.

But if a company could actually benefit in the long-run from an economic downturn -- by buying back shares, acquiring smaller rivals, or bleeding the competition dry by undercutting on prices -- then it is antifragile

You want to own antifragile companies.

Keeping in mind that Apple is valued -- via market capitalization -- at a 25% premium to Microsoft, here's how they stack up.

Company Cash Debt Free Cash Flow
Apple $285 billion $104 billion $53 billion
Microsoft $147 billion $73 billion $33 billion

Data: Yahoo! Finance, SEC filings. Cash includes long and short-term investments. Free cash flow presented on trailing twelve month basis.

Based on the balance sheet and free cash flows, these are two of the most antifragile companies in the world. With a combined net cash position of over a quarter trillion dollars and cash flows of over $85 billion in the past twelve months, I believe both companies are in a position to benefit from a downturn.

Obviously, Apple's statements are stronger than Microsoft's -- but for the purposes of this exercise, I'm calling it a draw: neither would have a notable edge over the other, relative to the competition. They're both insanely strong.

Winner = Tie


Next we have a murkier variable to evaluate: valuation. While there's no single metric that will let us know how cheap or expensive a stock is, we can gather together many to create a more holistic view.

Company P/E* P/FCF PEG Ratio Dividend FCF Payout
Apple 18 17 1.3 1.4% 25%
Microsoft 26 21 2.3 1.8% 37%

Data: Yahoo! Finance, E*Trade. P/E presented using non-GAAP earnings figures.

On virtually every metric, Apple is the cheaper company. While Microsoft might have a slightly higher dividend yield, that alone is not enough to make it a better buy based on traditional valuation metrics. On this facet, Apple is squarely in the lead.

Winner = Apple

Sustainable competitive advantages

I saved the most consequential for last. If you're a long-term, buy-to-hold investor, there's nothing more important to monitor than the sustainable competitive advantages -- often called a "moat" -- of your holdings.

In the simplest form, a moat is what keeps your customers coming back for more, year after year, while holding the competition at bay for decades.

Apple's moat is primarily provided by the strength of the company's brand. Forbes ranks it as the world's most valuable, worth an estimated $170 billion. But that's not all: because the devices you have using iOS can all talk to one another and store data on the cloud, there are also moderately high switching costs.

Microsoft is no slouch either. On the brand front, Forbes ranks Microsoft as the world's third-best brand, though the absolute value of the brand -- $87 billion -- dwarfs Apple's. But Microsoft has a host of other variables in its favor. Its Office Suite has been a mainstay in computing for over two decades, and speaks to the ridiculously high switching costs of going away from Word, Excel, and PowerPoint.

The company's Azure cloud business also benefits from network effects: as more users host on Microsoft's cloud, the company is able to lower prices, benefit from economies of scale, and feed more data into Azure's AI capabilities

In the end, this may be a controversial call, but I give the edge to Microsoft. While Apple has done an admirable job of transitioning its business to repeat services, it's nowhere near the recurring revenue that Microsoft gets. Apple still has to rely on coming out with The Next Big Thing every year or two for its stock to remain afloat. Microsoft has no such pressure.

Winner = Microsoft

And my winner is...

So there you have it: a tie. Except...whenever there's a tie, I always give the nod to the company with the wider moat. In this case, that means Microsoft is the winner. Currently, Apple represents 2.5% of my real-life holdings. But I've long been wary of Apple's staying power, and have admired Microsoft's new life under CEO Satya Nadella.

In the coming week -- when Motley Fool trading rules allow -- I will be selling my Apple shares and using some of the proceeds to start a position in Microsoft. My money will firmly be where my mouth is.

This article represents the opinion of the writer, who may disagree with the “official” recommendation position of a Motley Fool premium advisory service. We’re motley! Questioning an investing thesis -- even one of our own -- helps us all think critically about investing and make decisions that help us become smarter, happier, and richer.