Editor's note: an earlier version of this article incorrectly stated the two companies' forward PE ratios. The article has been updated. 

For much of the last 30 years, Microsoft Corporation (NASDAQ:MSFT) has been a staple on computer desktops via its Windows operating system and its Office suite of productivity software. Alphabet Inc. (NASDAQ:GOOGL) (NASDAQ:GOOG), since the introduction of Google search in the late 1990s, has similarly dominated its core search market. While both companies have ventured into a variety of other areas, none has provided the outright dominance or revenue of their core products.

Investors are more interested in the future than the past, and both companies are making strategic investments in potential blockbuster technologies like artificial intelligence (AI), virtual reality (VR), augmented reality (AR), and cloud services.

Yes, they're both great companies. But which one should investors add to their portfolios now?

Business chart with glowing arrows and world map

In the battle of the tech titans, which has a better outlook? Image source: Getty Images.

Financial fortitude

As you can see from the table below, both companies are remarkably fit from a financial standpoint:

Company

Cash and Investments

Debt

Free Cash Flow (TTM)

Current Ratio

Microsoft

$126.0 billion

$83.4 billion

$28.46 billion

2.8

Alphabet

$86.3 billion

$3.94 billion

$27.65 billion

6.3

Data source: YCharts, filings with U.S. Securities and Exchange Commission. Chart by author. TTM = trailing twelve months.

Both have sufficient cash to meet any operational needs, and continue to generate boatloads of the green stuff. This allows for investments in growing areas of the business, or potential acquisitions to enter new or more diverse areas.

Alphabet has been on a buying spree over the last several years, snapping up companies in the field of AI, so its significant cash balance has served it well. While the two have similar levels of cash flow, Alphabet has a better current ratio and much higher level of net cash, and takes this round.

Winner: Alphabet.

Recent results and growth prospects

In Alphabet's most recent quarter, the company increased its revenue to $24.75 billion, up 22% over the prior year quarter, and produced net income of $5.4 billion, an increase of 29% year over year. Advertising revenue related to its core search and YouTube still produced the lion's share, accounting for more than 86% of total revenue.

Alphabet has been making heavy investments in the areas of artificial intelligence (AI) and autonomous driving, though those have yet to become substantial revenue drivers. The company has been integrating AI to improve products and apps like Assistant and Maps, while producing more relevant results in its core search.

In its most recent quarter, Microsoft grew revenue to $22.1 billion, up 8% over the prior-year quarter, with net income of $4.8 billion, an increase of 28% year over year. Microsoft's Office and Windows accounted for nearly $17 billion in revenue, Intelligent Cloud grew to $6.75 billion, and LinkedIn accounted for $975 million.

Microsoft has also been incorporating AI into its Bing search and Cortana virtual assistant. At the Build developer conference on May 17, the company announced its intention to infuse AI into essentially all of its products and services including Office, Windows, and even Xbox.

Both companies have tremendous core businesses and both are staking a claim in the soon-to-arrive technological future. If one had an edge, I would suspect it is Alphabet, but it is simply too early to tell.

Winner: Tie.

Stock performance and valuation

The stock performance of both companies has been very similar over the trailing twelve months, with Microsoft returning 38% to Alphabet's 37%, so this is statistically a tie. Over the longer term it's a different story, but more on that in the next category.

Looking at trailing earnings, Alphabet and Microsoft both have price-to-earnings ratios in the low 30s, but looking forward Alphabet has more growth expectations priced into the stock -- shares currently trade around 30 times future earnings compared to Microsoft's forward PE of 24. 

MSFT PE Ratio (TTM) Chart

PE Ratio (TTM) data by YCharts.

Winner: Tie.

Dividends and share buybacks

Microsoft pays a dividend that currently yields 2.1%, while Alphabet does not yet pay a dividend. Quite often, a company investing heavily in growth initiatives will forgo paying a dividend, believing that shareholders would realize a greater overall return as a result of its investments. In this case, over the past five years, Alphabet stock has gained 246% -- compared to Microsoft's 145% -- so that argument holds water.

Over the last year, Microsoft's share count has fallen by 1.5%, while Alphabet's is up over 7%, but that doesn't tell the entire story. A look at the chart below shows that Alphabet offsets its share-based compensation twice per year, in July and January, and we've caught them between the two. After those offsets, the count is typically down by about 1%:

MSFT Average Diluted Shares Outstanding (Quarterly) Chart

Average Diluted Shares Outstanding (Quarterly) data by YCharts.

However, here Microsoft's shareholder-friendly dividend gives it the edge.

Winner: Microsoft.

Final tally

In the battle of the tech titans, Google parent Alphabet comes out ahead.

A review of these metrics shows two companies with strong financials and great prospects. The story of AI is yet to be told, and either company could be in the running for victory there. But if investors are looking for both growth and income in their portfolios, they could do worse than buying Microsoft.

Suzanne Frey, an executive at Alphabet, is a member of The Motley Fool's board of directors. Teresa Kersten is an employee of LinkedIn and is a member of The Motley Fool's board of directors; LinkedIn is owned by Microsoft. Danny Vena owns shares of Alphabet (A shares). Danny Vena has the following options: long January 2018 $640 calls on Alphabet (C shares) and short January 2018 $650 calls on Alphabet (C shares). The Motley Fool owns shares of and recommends Alphabet (A shares) and Alphabet (C shares). The Motley Fool has a disclosure policy.