The launch of OpenAI's ChatGPT in November 2022 triggered a boom in artificial intelligence (AI), with countless tech firms pivoting their businesses toward the budding industry.

According to Grand View Research, the AI market is projected to expand at a compound annual growth rate of 37% through 2030. That trajectory would see the sector exceed a value of $1 trillion before the end of the decade, suggesting there's no better time than the present to invest in AI-minded companies.

Microsoft (MSFT 0.43%) and Amazon (AMZN 0.80%) are two attractive options, with both companies investing heavily in the market and active in one of the biggest growth areas of AI: cloud computing. These companies have emerged as some of the biggest threats in the industry and could deliver significant gains over the long term.

So, let's take a closer look at these companies and determine whether Microsoft or Amazon is the better AI stock right now.

Microsoft

Microsoft was an early investor in AI, sinking $1 billion into OpenAI in 2019. The company has since increased its investment, achieving a 49% stake in the start-up. The partnership with OpenAI has granted Microsoft exclusive access to some of the most advanced AI models, which it has used to bring upgrades across its product lineup.

Over the last year, elements of ChatGPT have been integrated into Microsoft's search engine Bing, a range of new AI tools have been added to its cloud platform Azure, and its various Office services now offer improved productivity with the help of AI.

Microsoft is a behemoth in the tech world, with millions of consumers and businesses relying on its software. The popularity of its services and OpenAI's tech could be a powerful combination over the long term.

In the first quarter of 2024 (ending September 2023), Microsoft posted 13% in year-over-year revenue growth, beating Wall Street estimates by nearly $2 billion. Significant gains came from the company's cloud and productivity segments, which saw revenue rise 19% and 13%, respectively. These divisions are hyperfocused on AI development, which appears to be paying off.

Alongside free cash flow that hit $63 billion last year, Microsoft is on a promising growth path. The company has the brand power and financial resources to become one of the biggest threats in AI.

Amazon

Amazon pulled off an impressive turnaround in 2023 after its stock plunged roughly 50% the year before. Since last January, its shares have soared over 62% thanks to a return to profitability in its e-commerce business and significant potential in AI.

Over the last year, various cost-cutting measures have seen Amazon's free cash flow skyrocket 427% to $16 billion. The company has restructured its business to prioritize profit growth and is, therefore, investing heavily in its most profitable division: Amazon Web Services (AWS).

The cloud platform is responsible for over 62% of Amazon's operating income despite earning the lowest revenue out of its three segments. In Q3 2023, AWS achieved nearly $7 billion in profits, representing growth of 29% year over year.

The cloud market is expanding quickly, boosted by the emergence of AI. Businesses are increasingly looking for ways to boost efficiency with the help of AI and turning to cloud services to do so. Meanwhile, AWS' leading 32% market share in cloud computing positions it well to see big gains as AI develops.

Amazon's dominant position in cloud computing makes the company one of the best ways to invest in AI.

Is Microsoft or Amazon the better AI stock?

Microsoft and Amazon have emerged as two of the biggest names in AI over the last year. These companies have similar potential in the industry thanks to booming cloud businesses and lucrative opportunities in other areas of tech.

As a result, the best way to determine the better AI stock is to consider which is trading at a better value.

AMZN PS Ratio Chart

Data by YCharts. PS Ratio = price-to-sales ratio. PEG Ratio = price-to-earnings-to-growth ratio.

This chart compares Amazon and Microsoft's price-to-sales (P/S) and price-to-earnings-to-growth (PEG) ratios. These are helpful valuation metrics as they take into account a company's financial health against its stock price.

P/S is calculated by dividing a firm's market cap by its revenue. Meanwhile, PEG divides a stock's price-to-earnings ratio by the growth rate of its earnings. For both metrics, the lower the figure, the better the value.

In this case, Amazon's stock is a bargain compared to Microsoft. So, if you're between these two AI stocks, Amazon is the better buy this month and a screaming buy at the start of 2024.