Tech stocks fell out of favor in 2022, as spikes in inflation curbed consumer spending and sent the Nasdaq-100 technology sector index plunging 40% throughout the year. However, the market surged in 2023 thanks to excitement over budding markets like artificial intelligence (AI). The same index is up 65% since Jan. 1 and has shown no signs of slowing heading into the new year.

As a result, it might be a smart move to dedicate a larger portion of your portfolio to tech stocks. The market has a reputation for offering consistent gains over the long term, and there's no telling how high it could rise with the power of lucrative industries like AI and cloud computing.

As two of the world's most valuable companies by market cap, Alphabet (GOOG 0.66%) (GOOGL 0.49%) and Microsoft (MSFT 1.22%) are compelling options. These companies are home to some of the most widely used products, which attract billions of users. They are both investing heavily in the $137 billion AI market and have immense earnings potential there.

However, before filling up on shares in Alphabet and Microsoft, make the most of your investment by first determining which is currently the better tech stock. 

Alphabet

Since Google's launch in 1997, Alphabet has dominated the search engine market. It's responsible for 87% of the industry, granting it a powerful position in tech. The company has amassed a vast user base through Google, allowing it to expand to other markets, from video sharing to cloud computing, digital advertising, AI, productivity software, and more.

Alphabet's success has seen its annual revenue rise 107% over the last five years, with operating income soaring 130%.

The tech giant was slightly overshadowed by cloud competitors Amazon and Microsoft for the better part of 2023, as they appeared to make more headway in AI. However, Alphabet is gearing up to make a big splash in the industry in 2024 with the launch of a new large language model it calls Gemini.

Gemini is expected to be highly competitive with OpenAI's GPT-4 and could open up countless growth opportunities in AI for the company. The technology could allow Alphabet to offer more efficient advertising through Google Search and YouTube, create a Search experience closer to ChatGPT, introduce AI features on its various productivity platforms, and more.

GOOG Free Cash Flow Chart

Data by YCharts

Alphabet's free cash flow has exceeded Microsoft's and Amazon's in 2023, strengthening its long-term prospects in tech. The company might have some catching up to do in AI, but its massive user base and significant cash reserves indicate it is well equipped to flourish in tech in the coming years.

Microsoft

Like Alphabet, Microsoft is a tech behemoth. Homegrown brands like Windows, Office, Xbox, and Azure have made the company a leader in multiple markets, such as operating systems, productivity, video games, and cloud computing. The broad reach of these services has led the tech giant's annual revenue to climb 68% over the last five years, as operating income climbed 106%.

Wall Street grew particularly bullish about Microsoft in 2023, as it has emerged as one of the biggest names in AI. Heavy investment in the sector has seen the company achieve a 49% stake in ChatGPT developer OpenAI, giving it access to some of the most advanced AI technology.

Over the last year, the company has used OpenAI's models to bring AI features across its product lineup. New tools on Azure, Office, and Microsoft 365 see the tech firm making moves to monetize its AI offerings. For example, a smart assistant on Microsoft 365 called Copilot debuted as a $30 add-on to a current subscription as the company attempts to cash in on the growing demand for such services.

Businesses and consumers worldwide depend on Microsoft's software, giving the company almost endless earnings opportunities in AI and tech in general.

Is Alphabet or Microsoft the better tech stock?

Alphabet and Microsoft are among the tech market's best options, with strong penetration in the consumer and commercial markets and significant financial resources. As a result, the best way to determine the better tech stock is to compare valuations.

MSFT PE Ratio Chart

Data by YCharts

These charts compare three valuation metrics for Alphabet and Microsoft. The Google company looks like the preferable option in every category. Its lower figures suggest its shares offer far more value than Microsoft's, making Alphabet's stock a bargain. Therefore, alongside equal, if not more, growth potential over the long term, Alphabet is a no-brainer choice right now.