Back when Alphabet -- then known as Google -- went public, many pundits were bearish on the stock. How could a search company that provides everything it does at no cost ever be a good investment?

If the past decade has taught us anything, it's that data is the new gold -- and no one has more of it than Alphabet. The company has been able to parlay that data into targeted ads that companies crave. 

Its Chinese counterpart -- Baidu -- has been able to learn from the success and failures of Alphabet and apply them on its own home turf. But which of these two search stocks is a better buy today?

Cartoon of laptop computer with search icon super-imposed

Image source: Getty Images

It's impossible to answer that question with 100% certainty, but if we break it down into three digestible facets, we can get a better idea of which stock we're more comfortable with in our own portfolios.

Financial fortitude

First, we look at financial fortitude. Here, we want to see how a company would be affected by a major economic downturn. Companies that have lots of cash and little debt can actually grow stronger as a result of such times -- by leveraging their war chest to gain long-term market share.

Keeping in mind that Alphabet is valued at over 10 times the size of Baidu, here's how the two stack up:

Company Cash Debt Free Cash Flow
Baidu (BIDU 0.72%) $27 billion $6 billion $4.5 billion
Alphabet (GOOGL -1.97%) (GOOG -1.96%) $119 billion $4 billion $23 billion

Data sources: SEC filings and Yahoo! Finance. Cash includes long- and short-term investments.

Both companies are on very solid footing. There's far more cash on hand than debt, and both have prodigious free cash flows.

That being said -- if forced to choose -- my nod goes to Alphabet. A net cash position of over $115 billion is absolutely enormous. It means that in a downturn, Alphabet would have the ability to buy ancillary businesses that compliment its own core mission at cheap prices. Over time, that kind of optionality can lead to deals that produce enormous results on the bottom line.

Winner: Alphabet

Valuation

Next we have valuation. There's no single metric that gives us a perfect idea for how cheap or expensive a stock is. As such, I like to consult a number of different metrics when comparing two stocks.

Company P/E Ratio P/FCF Ratio P/S Ratio PEG Ratio
Baidu 18 14 4.4 0.7
Alphabet 26 32 5.7 1.6

Data sources: Yahoo! Finance, YCharts, and E*Trade. Some P/E figures presented on non-GAAP basis.

On every single metric, Baidu is the cheaper option -- sometimes appearing to be 50% less expensive. This shouldn't be too surprising given the concern lately about a weakening Chinese economy. But that doesn't change the fact that Baidu's stock is demonstrably cheaper today than Alphabet.

Winner: Baidu

Sustainable competitive advantages

Finally, we have what I consider to be the most important -- and difficult -- facet to measure about a company, its moat, or its sustainable competitive advantages. Both Alphabet and Baidu benefit from brand power and low-cost production.

In terms of brand power, Forbes ranks Alphabet's Google as the second-most valuable brand in the world -- behind only Apple -- worth $132 billion. Baidu is estimated by eMarketer to have a brand value of roughly $24 billion. Not only is that less than Alphabet, but eMarketer also reports that as of mid-2017, the value of that brand had actually shrunk by 11%.

When it comes to low-cost production, the thing being produced is data. By coming up with solutions that people can use largely for free, these companies don't have to invest very much for each incremental user once the services become popular. The more users that sign on, the more data that's collected.

Alphabet now has eight different products with over 1 billion users: Search, Gmail, YouTube, Android, Chrome, Google Play, Google Drive, and Maps. That produces gobs of data on a global level. 

Baidu, on the other hand, still has millions of users. But it has been changing its focus at a dizzying level lately -- from search to mobile to online-to-offline ventures to artificial intelligence -- and that has led me to wonder if the company is struggling to find its true niche. Many have also noted that while Alphabet has stayed on the cutting edge with global competition, Baidu is falling behind badly on many of its initiatives when compared to Tencent and Alibaba.

Winner: Alphabet

And my winner is...

So there you have it: While Baidu might be a cheaper stock, Alphabet has both a better balance sheet and a stronger moat protecting its core business. Perhaps that helps explain why I'm comfortable with Alphabet occupying a 10%-plus portion of my own real-life portfolio.

If you're looking for a search and advertising giant to invest in, Alphabet is your best bet today.