Interest in artificial intelligence (AI) stocks surged this year as platforms like OpenAI's ChatGPT led many to rethink what is currently possible with the technology. AI has the potential to improve countless industries, including cloud computing, productivity software, e-commerce, autonomous driving, healthcare, and education.

So, it's not surprising that the AI market is projected to expand at a compound annual rate of 37% until at least 2030 (per Grand View Research). The sector is developing rapidly, and it could be a smart move to add an AI stock to your portfolio now before it's too late.

Nvidia (NVDA -0.36%) and Alphabet (GOOG -1.84%) (GOOGL -1.76%) are two attractive options, with one profiting from an uptick in AI chip demand and the other gearing up to launch a highly anticipated large language model in 2024.

So, let's assess whether Nvidia or Alphabet is the better stock to invest in AI.

Nvidia

Nvidia's stock has soared 215% this year, rallying investors as its chips have become the preferred hardware for AI developers everywhere. The company has snapped up an estimated 90% market share in AI graphics processing units (GPUs), attaining dominance that will likely be challenging for its competitors to overcome.

The tech giant has massive potential in AI and is already seeing big gains from the industry. In the third quarter of its fiscal 2024, ended Oct. 29, Nvidia posted revenue growth of 206% year over year, with operating income up more than 1,600%. Boosted earnings came alongside a 279% increase in data center revenue thanks to a spike in AI GPU sales.

Additionally, Nvidia's position in AI will likely bolster its gaming division over the long term, with the company able to offer highly powerful chips for consumers and businesses.

Macroeconomic headwinds have burdened the gaming industry over the last two years, triggering reductions in spending on tech. However, Nvidia's latest quarter saw its gaming segment post revenue growth of 81% year over year, signaling a probable end to recent market declines.

Nvidia could be a reliable way to invest in AI as it's one of the few companies already seeing significant growth from the sector and is likely to continue posting impressive earnings in 2024.

Alphabet

Cloud competitors Microsoft and Amazon have slightly overshadowed Alphabet in AI this year. However, the company has heavily invested in the technology and could play a crucial role in developing the market over the long term.

As the home of potent brands like Google, YouTube, and Android, Alphabet has countless ways to monetize its venture into AI. Its Google Cloud division boasts the third-largest market share in cloud computing and is well equipped to take advantage of increased demand for AI cloud services.

In fact, Alphabet revealed in August that 70% of AI start-ups worth more than $1 billion are currently Google Cloud clients, including Anthropic, Character.ai, and Cohere.

Moreover, Alphabet's dominance in digital advertising strengthens its prospects in AI. Platforms such as Google Search and YouTube attract billions of users daily, presenting numerous advertising opportunities. With the help of AI, the company can offer more targeted ads and introduce new features to its services that could expand its user base.

In Q3, Alphabet posted a revenue rise of 11% year over year, beating analysts' forecasts by $980 million. The growth was primarily owed to increased sales in its Google Search and YouTube ad segments, which rose 11% and 12%.

The company's earnings show Alphabet is on a promising growth trajectory. Meanwhile, plans to launch a new large language model called Gemini in 2024 could expand its position in AI.

Is Nvidia or Alphabet the better artificial intelligence (AI) stock?

Alphabet and Nvidia operate in two different areas of AI, with one excelling in hardware and the other with significant potential in the software side of the market. These companies likely have much to offer investors over the long term as demand for AI products continues to rise.

However, Alphabet is a slightly more compelling investment option as it could be the cheapest stock in AI right now.

AMD PE Ratio Chart

Data by YCharts

The chart above compares the price-to-earnings and price-to-free-cash-flow ratios of some of the most prominent names in AI. These are helpful metrics to determine the value of a stock, and Alphabet comes out on top on both fronts.

Alphabet's lower figures make it a bargain compared to its peers and especially compared to Nvidia, with its stock the better buy right now.