Five years ago, the large technology companies seemed to operate in harmony. Today, they are starting to compete with each other more intensely. Amazon is making huge moves into digital advertising. Meta Platforms has stated its intentions to spend tens of billions on computing hardware to compete with Apple. These are just two examples of increasing competitive overlap.

The tech giants who are competing the most with each other at the moment are Alphabet (GOOG -1.57%) (GOOGL -1.76%) and Microsoft (MSFT 0.13%). Both are trying to win in search engines and artificial intelligence (AI), computer operating systems and productivity software, as well as the cloud.

But which of these two tech giants is a better buy in 2024? Let's take a look.

Microsoft: coming for the search engine cash cow

The biggest development in consumer technology this year has been the growth of AI chatbots, especially ChatGPT from OpenAI. The lifelike conversational tools have seen rapid adoption from consumers and pose a threat to the traditional search engine business. Microsoft looks smart so far, hitching its wagon to the OpenAI train, making a $13 billion investment into the start-up. OpenAI is now helping power the Bing search engine, which is the largest competitor to Alphabet's Google search engine.

Alphabet has a lot at stake here as Google Search makes up the majority of its revenue -- 57.4% of its revenue last quarter, to be exact. If search engine revenue migrates from Google to Bing-OpenAI, that could be revenue lost for Alphabet and great news for Microsoft. Of course, Alphabet didn't take this lying down and launched a ChatGPT competitor called Google Bard. Just this week, Google released its next-generation AI model called Gemini, which expands on Bard's capabilities.

So far, Microsoft and OpenAI's ambitions haven't put much of a dent in Google's market share. Today, Google has an estimated 83.5% market share on desktop search, which is where Microsoft has the best distribution for its Bing search engine due to the dominance of the Windows operating system (OS). This is only down from around 84% market share for Google at the end of 2022. It is likely too early to declare victory, but so far Google's market share has held up well despite this increased competitive intensity from Microsoft. In the third quarter, Google Search revenue grew by 11% year over year to $44 billion.

Alphabet: attacking Microsoft Windows and Office

Flipping things around, Alphabet has tried to make inroads by attacking Microsoft's core profit centers: the cloud and workplace software. Microsoft has made boatloads of money from Microsoft Office products over the last few decades and recently transitioned its customers to a cloud-based solution called Office 365. This includes software like Microsoft Office, Excel, Outlook, and Teams, which it mainly sells to business customers.

Alphabet has a competitor to Office 365 called Google Drive, which offers copycat programs for all the Office products given away free to consumers (up to a certain storage limit). Even though a customer can switch to Google Drive for free, Microsoft Office revenue grew 10% last quarter. The company's Productivity and Business Processes segment -- which houses Microsoft Office -- generated $34 billion in operating income last fiscal year.

Microsoft Windows has lost some market share in recent years, which you might think comes from Alphabet's Chrome operating system. Windows went from a 95%-plus market share on desktops in 2009 to under 70% in recent months. However, only a small bit of these losses are due to Chrome, which has a measly 3.7% market share.

And Windows revenue is not relevant to this business anymore. The most important segment for Microsoft is its cloud tools and its Azure cloud infrastructure division. Alphabet is competing aggressively here with its Google Cloud subsidiary, which has operated at a loss for years as the company tries to gain market share. Despite this, Microsoft's Intelligent Cloud segment generated $87.9 billion in revenue and $37.9 billion in operating income last fiscal year with revenue growing 17% year over year.

Even though Alphabet has made a ton of noise about its ambitions with Google Cloud, Google Drive, and the Chrome OS, it hasn't made much of a dent in Microsoft's respective competitive segments. The same can be said with Microsoft trying to dethrone Google Search. It is hard to disrupt such dominant products and services when they've been used by consumers and businesses for so long.

GOOG PE Ratio Chart

GOOG PE Ratio data by YCharts.

Both are safe bets, but which is a better buy today?

Both Microsoft and Alphabet are strong businesses. The companies may compete with each other, but it hasn't stopped either of them from growing revenue and generating gobs of profits. There is plenty of customer demand for cloud, software, and search engines for each company to succeed.

So if that's the case, which stock is the better buy? From my seat, it all comes down to valuation. Alphabet trades at a price-to-earnings ratio (P/E) of 25.4, which is right around the market average. Microsoft is at a premium P/E of 36, much higher than Alphabet's. Even if Microsoft grows its revenue at a slightly faster rate for the next five to 10 years, I think this cheaper multiple makes Alphabet a better buy for investors in 2024. Microsoft investors will likely do fine over the long term, but it is hard to make a case for buying such a large business at a P/E approaching 40.