Two major stock splits are right around the corner. Alphabet (GOOG -1.10%) (GOOGL -1.23%) will conduct a 20-for-1 stock split effective July 15, 2022. Shopify (SHOP 0.23%) plans to split its shares even sooner with a 10-for-1 split scheduled for June 28.

Both of these stocks have been big winners in the past. Which stock is the better buy leading up to the stock splits? Here's how Alphabet and Shopify stack up against each other.

The case for Alphabet

Valuation, moat, and optionality. Those four words pretty much sum up the argument for why Alphabet is a great stock to buy right now. 

Granted, Alphabet's valuation might not seem all that attractive at first glance. But the tech giant is trading at a historically low earnings multiple with its forward price-to-earnings ratio below 20. Alphabet is actually even cheaper than it looks because of its huge cash stockpile.

I can't think of many companies that can claim a moat as strong as Alphabet's. Google Search remains the undisputed leader in the search market despite some valiant attempts to knock it off its perch. YouTube still has more than 2 billion monthly users despite a challenge from TikTok. 

We can't leave out Google Cloud. It has quickly become a significant rival to Amazon Web Services and continues to deliver strong revenue growth.

These businesses are also cash cows, generating more than $17.9 billion in profits in the first quarter of 2022. That's more than most big companies earn in a full year. And it gives Alphabet a key competitive advantage because it can invest more in research and development.

As for optionality, we only have to look at Alphabet's famous "other bets." The company's Waymo self-driving car technology unit presents probably the biggest growth opportunity over the next couple of decades. However, Alphabet has plenty of other bets that could pay off big-time, including its Wings drone delivery business and Verily, which focuses on using technology in healthcare.

The case for Shopify

Can we make the case for Shopify as succinctly as we could for Alphabet? I think so. Actually, my view is that we can use the same three arguments.

I'll readily admit that Shopify's forward earnings multiple of 526 makes the valuation claim a tough one. However, the stock now trades at a price-to-sales multiple of under nine times. That's as cheap as it's been in years. 

Shopify has also built up a formidable moat. It doesn't just help customers sell their products online. Shopify offers a full-blown ecosystem including logistics, payments processing, and small business loans. 

In a relatively short time, Shopify has morphed into one of the top e-commerce companies in the world. It should still have plenty of room for growth in e-commerce, with online shopping making up only 16.8% of total global retail sales. 

Shopify's relationships with its customers also give it opportunities to move into adjacent markets. That's exactly what the company has done by launching new services such as Shopify Capital. 

Better buy?

You might have noticed that I didn't mention Alphabet's and Shopify's upcoming stock splits in making the cases for stocks. That's because these splits change nothing about the underlying business prospects for either company.

It's possible that the stock splits could provide catalysts if retail investors buy shares. However, the widespread access to buying fractional shares makes stock splits less of a factor as they've been in the past.

So which of these stocks is a better pick? There's no question that Alphabet is more attractively valued than Shopify based on pretty much any valuation metric you want to use. I also think that Alphabet's moat is stronger than Shopify's. The e-commerce company faces multiple well-run rivals, including Amazon and Block.

I'm bullish on the long-term prospects for both of these stocks. However, if I could only pick one right now, it would be Alphabet.