Both Facebook and Baidu have large moats surrounding their businesses. Image Source: Getty Images

The Age of the Internet has rewritten the rules for investing. Whereas in the past -- when manufacturing played an enormous role in our economy -- there could be many winners to help supply what the world wants, the new technology boom has increasingly become a winner-takes-all game.

Social media giant Facebook (META -1.44%) and Chinese search engine Baidu (BIDU 0.17%) are textbook cases. While they both have competitors they are the top players in each respective market.

That makes both stocks investment-worthy, but which is the best bet? Below, I'll look to answer the question by looking through three lenses.

Financial fortitude

When a company has cash, it has options -- especially during market downturns. A company flush with a comfortable stash can outspend its rivals, buy back shares on the cheap, and even acquire its competitors.

Those that don't have cash sitting in the bank, on the other hand, are at the whim of such downturns. These companies are forced to contract their offerings, and do everything possible to make ends meet.

Here's where Facebook and Baidu sit in terms of cash and debt.

Company

Cash

Debt

Net Income

Free Cash Flow

Facebook

$23.3 billion

$0

$6 billion

$7.6 billion

Baidu

$15.7 billion

$0.5 billion

$4.98 billion

$2.58 billion

Data source: Yahoo! Finance, SEC filings. Data accurate as of October 26, 2016. Net income and FCF shown for trailing twelve months.

Both of these companies have excellent financial fortitude. With tens of billions of dollars in the bank, little to no debt, and lots of cash flowing in from operations, this is as healthy as you can get.

Winner = Tie

Sustainable competitive advantages

Sometimes referred to as a "moat", a company's sustainable competitive advantage is its key differentiator. As an investor, no variable has played a bigger role in the success of my investments than the underlying moat of the company I was investing in. With it, companies can dominate for decades. Without it, competition encroaches quickly.

Facebook's key advantage is called the network effect. This means that with each additional user that signs up with Facebook (or Instagram, or WhatsApp), non-users have more incentive to sign up. This makes sense: who would join Facebook if none of their friends were on it? This can be a powerful advantage that continues to build for years -- and is very hard for competitors to break.

Baidu, on the other hand, benefits from both enormous market share and high switching costs. The market share dominance is obvious: according to China Internet Watch, the company captured 80% of all advertising dollars in 2015. What's less appreciated is the company's high switching costs; since users use its email service, mobile browsers, and video sites -- to name a few of its offerings -- Chinese citizens can count on all of their critical information to be on the same cloud database. As with Facebook, once those users are locked in, it can be difficult for competitors to encroach.

Both of these are incredibly strong moats, and it's hard to clearly call one a winner.

Winner = Tie

Valuation

With Facebook and Baidu having tied on our two previous sections, it all comes down to valuation. While there's no fool-proof way to show how expensive a stock is, here are four metrics I like to consult when making a decision.

Company

P/E

P/FCF

P/S

PEG Ratio

Facebook

42

49

16.9

0.9

Baidu

41

19

5.7

1.8

Data source: Yahoo! Finance, SEC filings. P/E represents non-GAAP earnings.

Again, this is a very close pairing. On the one hand, Baidu looks much cheaper on a free cash flow basis. But when we look at expected growth (via the PEG Ratio), Facebook appears to be the better choice. More than anything, this is because Baidu is investing heavily in its Online-to-Offline initiative. While it could be lucrative if it works, the outcome is far from certain.

Facebook, on the other hand, has taken the gas pedal off of major acquisitions or uber-expensive initiatives, so I would say it -- by a hair -- is the safer bet right now.

Winner = Facebook

As you can tell, these are both very high quality companies to invest in. That helps explain why -- when combined -- they make up over 20% of my family's real-life holdings. Both are worthy of your consideration.