Microsoft (MSFT -1.27%) and IBM (IBM 0.06%) have dominated the tech landscape for decades. Yet their fortunes have diverged in recent years, as Microsoft's business and stock price have surged, while IBM has fallen on harder times.

But which of these companies is the better buy today? Could Microsoft's soaring share price be a signal that even more gains lie ahead? Or should investors buy low with IBM in hopes of a rebound? Let's find out.

A person drawing a rising green line above a declining red line

Image source: Getty Images.

Financial fortitude

Let's take a look at some key metrics to see how Microsoft and IBM stack up in regards to financial strength.

Metric

Microsoft

IBM

Revenue

$95.65 billion

$78.37 billion

Operating income

$24.09 billion

$12.17 billion

Operating cash flow

$41.98 billion

$14.84 billion

Free cash flow

$33.28 billion

$11.05 billion

Cash & investments

$138.53 billion

$12.58 billion

Debt

$93.19 billion

$46.82 billion

DATA SOURCES: MORNINGSTAR, YAHOO! FINANCE.

IBM is certainly no slouch when it comes to financial fortitude, with $11 billion in annual free cash flow and $12 billion in cash reserves on its balance sheet. Yet Microsoft's financials are even more impressive; the tech titan generated $33 billion in free cash flow over the past year, helping it amass a war chest of more than $138 billion in cash reserves. Moreover, Microsoft enjoys a net cash (cash minus debt) position of $45 billion, while IBM has $34 billion in net debt. As such, Microsoft has the edge here.

Advantage: Microsoft

Growth

Microsoft's edge over IBM is even more pronounced when it comes to sales and profit growth in recent years.

MSFT Revenue (TTM) Chart

MSFT Revenue (TTM) data by YCharts.

Over the next five years, Wall Street expects Microsoft to increase its earnings per share at an 11% annualized rate, fueled by the growth of its cloud computing and artificial intelligence initiatives. Meanwhile, analysts forecast that IBM will grow its EPS by less than 3% annually during that same time, with the lumbering tech giant expected to continue to struggle with tepid sales growth. So here, too, Microsoft outshines IBM.

Advantage: Microsoft

Valuation 

No better-buy discussion should take place without a look at valuation. Let's check out some key value metrics for Microsoft and IBM, including price-to-earnings and price-to-free-cash-flow ratios.

Metric

Microsoft

IBM

Trailing P/E

74.38

25.10

Forward P/E

23.28

10.85

P/FCF

21.17

12.90

DATA SOURCES: YAHOO! FINANCE, MORNINGSTAR.

On all three metrics, IBM's shares are significantly less expensive than Microsoft's. That's to be expected, considering its lower projected growth rates. Still, I'll give IBM the edge in terms of valuation.

Advantage: IBM 

The better buy is... 

IBM's stock may be more attractively priced, but Microsoft's superior financial strength and greater growth prospects make it the better long-term investment.