The markets have recently experienced one of the quickest and most painful drops in market history. But like the many market crashes that have come before, this bear market will be over soon enough. There have been 33 recessions since 1854, and tough times seem to make the strongest companies even stronger. 

We'll compare Microsoft (MSFT -2.45%) and HP (HPQ 0.11%) on financial fortitude, valuation and dividends, and competitive positioning to determine which stock you should buy today.

A zig-zag arrow sitting on top of an ascending bar chart, with various charts and graphs in the background.

Image source: Getty Images.

Financial fortitude

It's times like these that stress the importance of investing your hard-earned dollars in companies that have plenty of cash on hand to fund operations and pay dividends when the economic environment is weak.

Here's how Microsoft and HP compare on several measures of financial fortitude. 

Metric Microsoft  HP
Revenue (TTM) $134.25 billion $58.66 billion
Free cash flow (TTM) $40.58 billion $4.4 billion
Free cash flow as a % of revenue 30.2% 7.5%
Cash and short-term investments $134.25 billion $4.49 billion
Total debt $69.61 billion $4.86 billion

Data source: YCharts. TTM = Trailing 12 month.

Microsoft is easily the winner here. The software giant converts nearly a third of its revenue into free cash flow and has more cash than debt on its balance sheet.

Valuation and dividends

While I would favor a company that has stronger financial fortitude over a stock that is cheap but has too much debt, it's worth comparing Microsoft and HP on a range of valuation metrics. 

Metric Microsoft HP
P/E 26.3 8.3
Enterprise value/EBIT 21.4 9.5
P/FCF 28.7 5.7
Dividend yield 1.29% 4.03%
Cash payout as a % of free cash flow 35.6% 22.2%

Data source: YCharts. P/E = price-to-earnings. EBIT = earnings before interest and taxes.

If you're looking for the best value, HP wins. The P/E ratio is very low, and HP also offers a tempting above-average dividend yield of 4%.

But is the dividend at risk of a cut? I don't think so.

HP pays out less than one-quarter of its free cash flow in dividends, which leaves plenty of cash left over to reinvest in the business. While the balance sheet is not as cash-rich as Microsoft's, HP is not going anywhere because it can offset its debt with cash on hand.

Competitive position

Despite HP's cheap valuation and high dividend yield, Microsoft is the better growth stock.

Before the novel coronavirus outbreak, the software giant was clicking on all cylinders. Microsoft has successfully transitioned its core Office software business to a subscription model with Office 365. Microsoft's fast-growing Azure cloud business is also firmly positioned in second place behind Amazon Web Services. The move to the cloud has been a game-changer that made Microsoft a platform-agnostic software provider, no longer dependent on a sluggish PC market.

HP is a different story. The company has struggled to find growth as it juggles a stagnant market for PC sales and a printing business that has suffered from weak demand as more people turn to digital devices to interact with documents instead of printing them on paper. 

Over the last five years, Microsoft has grown revenue and free cash flow a cumulative total of 49% and 41%, respectively. Revenue was up 14% year over year in the most recent quarter, as LinkedIn, Dynamics 365, Azure cloud, and Office 365 reported solid results. 

MSFT Chart

MSFT data by YCharts

So far, Microsoft seems to be doing relatively well amid the COVID-19 outbreak. The two businesses that have been most affected are Windows OEM, which includes licensed sales of Windows to third-party PC manufacturers, and Surface. The supply chains for these businesses are recovering at a slower pace than management originally anticipated, as reported in an update to guidance on Feb. 26. Windows OEM and Surface are part of the more personal computing segment that generates a third of Microsoft's total revenue. 

HP is a solid business that pumps out a healthy amount of profit each year. But Microsoft's warning about its Windows OEM business might reflect negatively on HP's PC business in the short term. 

However, one overriding reason why investors may want to pay up for Microsoft is that HP is currently fighting off a hostile takeover bid from rival Xerox. This wouldn't be ideal for HP shareholders, because it would create a highly leveraged combined company with a lot of debt. As management explained in a letter to shareholders on March 25, "Any complex, large-scale, highly leveraged transaction in the current economic environment could be disastrous for HP, its shareholders and our entire ecosystem." 

The possibility that the deal might happen, although HP has rejected the proposal, might be a good reason for investors to avoid HP for now and buy shares of Microsoft.

Even if HP remains independent, it still has an uphill battle ahead. While the broader PC market recently returned to growth, headwinds in the printing business caused total revenue to decline less than 1% in the most recent quarter. About two-thirds of HP's revenue comes from the personal systems segment, including sales of PCs and retail point-of-sale systems, with virtually all of the balance derived from printing solutions. 

The reason HP continues to nurture its printing segment is that it's very profitable, generating a 16% operating margin in the last quarter compared to 6.7% for the personal systems segment. 

HP has been cutting costs and investing in higher-growth opportunities like 3D printing and graphics solutions, as well as shifting its printing business to a contractual model. Cost cutting has boosted free cash flow by nearly 70% over the last three years. Management believes it can grow adjusted earnings to $3.25 to $3.65 by fiscal 2022, which makes the stock appear severely undervalued. 

While investors could potentially double their money in the next five years if HP is successful in reaching those targets, it's also possible that competition gets more aggressive, or that the broader PC market enters another multi-year decline which could derail management's plan. 

Microsoft software running on Surface products.

Image source: Microsoft.

The final verdict

Ultimately, I believe investors will be better off investing in the company that was already delivering consistent growth before COVID-19 reared its ugly head.

It's noteworthy that, year to date, Microsoft stock has significantly outperformed the broader market, while HP stock has fallen roughly in line with the S&P 500 index. That's a reflection of each company's relative business strength right now. 

If it was my money, I would pay up for the faster-growing business and buy shares of Microsoft, which I already own. Microsoft is absolutely dominant in software, with Windows 10 installed on 1 billion devices. While the Windows operating system controls an 88% share of the market, HP's share is less than one-quarter of the PC market. That is very telling of each company's competitive strength. I give the nod to Microsoft as the better buy.