Most non-investing folks would have a hard time telling you exactly how IBM (IBM 0.58%) and Microsoft (MSFT 0.36%) make their money. The former used to make huge computers, and the latter makes those tablets we see during NFL games. That's about it, right?

Not so fast. In fact, both companies have several revenue streams -- and you probably use some of them on a daily basis. Being so embedded in our daily lives makes both companies more valuable than you might think.

A row of computers in a data center.

These data centers drive the cloud ambitions for both IBM and Microsoft. Image source: Getty Images

But between the two, which is a better stock to buy today? That's impossible to answer with 100% certainty, but there are ways to break it down a bit. By comparing IBM to Microsoft on three key dimensions, we can get a better idea for which is the strongest bet for new money today.

Sustainable competitive advantages

If a decade of being a Foolish investor has taught me anything, it's this: there's nothing more important over the long run than a company's sustainable competitive advantage, often called a "moat." This is what will keep a company churning through good times and bad, while holding the competition at bay for decades.

While Microsoft has many different ways of making money, its primary one is probably the most well-known: its Microsoft Office 365 products, including Word, Excel, PowerPoint, Outlook, and Skype. During the previous fiscal year, 62% of operating income came from such products. Cloud services including Azure as well as manufactured products like Surface and xBox rounded out the last 38%.

But the Office products are where the real moat exists. These programs have been around since 1990, practically the time of dinosaurs when it comes to computers. Generations have grown up using Office, and that makes switching costs very high -- and the moat very wide.

IBM, on the other hand, has two lines of business. The first involves providing hardware for Enterprise customers. That line of business is slowly dying away; in its place are the "Strategic Imperative" lines of business, including cloud computing, data analytics, and AI. As with Office, switching costs can be high once a company begins using IBM for these tasks. Unlike Microsoft, however, this new line of business is nowhere near as time tested, and growth from the segment has already shown signs of stalling.

Winner = Microsoft

Financial Fortitude

Two of the big reasons investors pile into companies like IBM and Microsoft are their dividends and histories of share buybacks. While we could be excused for hoping that all the extra cash these two spit out be returned to us, there's something to be said for keeping a pile of cash on hand.

That's because every company, at one point or another, will encounter difficult financial times. Those that enter these periods with cash can often emerge stronger, thanks to share buybacks, acquisitions of distressed rivals, or -- most importantly -- outspending the competition to drive it into submission.

If you have lots of debt, crises have the exact opposite effect, making your organization even more fragile. Here's how these two stack up, keeping in mind that Microsoft is valued at over four times the size of IBM

Company

Cash

Debt

Net Income

Free Cash Flow

IBM

$25 billion

$38 billion

$11 billion

$12 billion

Microsoft

$139 billion

$76 billion

$21 billion

$31 billion

Data source: SEC filings, Yahoo! Finance. Net income and free cash flow presented on trailing twelve month basis. All figures rounded to the nearest billion.

Both of these companies have very strong cash flow -- there's no concern here with either. But when it comes to balance sheets, Microsoft has a clear advantage, with far more cash than long-term debt.

Winner = Microsoft

Valuation

Finally, we have the murky science of valuation. While there's no single metric that can tell you if a stock is cheap or expensive, there are a number of data points we can consult. Here are five that I like to use.

Company

P/E

P/FCF

PEG Ratio

Dividend

FCF Payout

IBM

11

11

4.1

4.2%

44%

Microsoft

22

18

2.3

2.1%

38%

Data source: Yahoo! Finance, E*Trade. P/E calculated using non-GAAP earnings when possible.

This is a much more difficult evaluation. IBM appears to be a bargain, except when it comes to growth prospects (PEG Ratio), where Microsoft appears to be trading at a 40% discount.

But we can't ignore the dividend, as that's the main reason investors buy into either of these companies. On that respect, IBM has a payout that's yielding twice as much as Microsoft -- and it's extremely safe, having eaten up just 44% of Big Blue's free cash flow over the past year. Because of that, I'm siding with IBM here, if only by a slight margin.

Winner = IBM

My winner is...

So there you have it: while IBM has a slight valuation edge -- primarily due to its outsized dividend -- Microsoft wins the battle with a healthier balance sheet and more enduring advantages. While I don't personally own shares of either , Microsoft would easily be my personal favorite between the two.