Google (GOOG 1.43%) and Facebook (META 0.14%) are two of the top-performing stocks of the last decade. The internet giants have beaten the S&P 500 over the last five and 10 years as they've come to dominate online advertising and other markets.  And while both businesses have their nuances, Facebook and Google are quite similar, seeing as they both make money by targeting users with advertisements.

But which stock is a better buy over the next five years and beyond? Let's take a look.

A man with his hand on his chin listening to someone across the table.

Image source: Getty Images.

Google

Google's core business, called Google Services, has grown substantially over the last few years, even when dealing with the law of large numbers and the COVID-19 recession. These assets include but are not limited to: Google search, YouTube, Google Adsense (website advertising), and Google Maps. Last year, Google Services generated $54.6 billion in operating income, up from $43.1 billion two years ago. However, Google's other subsidiaries, Other Bets and Google Cloud, lost $4.5 billion and $5.6 billion, respectively, last year. This brought its overall operating profit to $41.2 billion in 2020, significantly less than what its core business generated. 

On the surface, these billions in losses from Google's subsidiaries look bad. But it gets better once you take a deeper look. The cloud business, which competes with Amazon's (AMZN 1.49%) AWS and Microsoft (MSFT 0.46%) Azure, is durable and has high margins at scale. It just takes a lot of upfront spending to get the data centers running. Other Bets is a bit more speculative; however, it houses Waymo, the start-up that is leading the self-driving industry.  If Waymo or another one of these moonshots becomes a giant company someday, it will make up for the years of operating losses.

At a market cap of $1.45 trillion, Google trades at a price-to-operating-income ratio (P/OI) of 35. If you ex-out Google's net cash and just look at its core business, that P/OI comes down to 24.6. This is a very reasonable valuation for a company of Google's caliber.

Facebook

Facebook has four core businesses, which comprise of Facebook itself (which we'll call Big Blue), Instagram, WhatsApp, and Messenger. In 2020, Facebook generated $32.6 billion in operating income, up 36% from 2019. Big Blue had 1.84 billion daily active users (DAUs) worldwide at the end of 2020, making it 70% of Facebook's overall DAUs, which sit at 2.6 billion. 

With these numbers in mind, one can assume that the majority of Facebook's profits still come from Big Blue. However, it looks like the majority of Facebook's growth now comes from Instagram. According to Recode, 65% of Facebook's overall sales growth now comes from Instagram, and it now makes up 30% of its overall revenue. WhatsApp doesn't generate significant revenue right now, but it is launching a payments network similar to Venmo or Cash App in India, where WhatsApp had an estimated 340 million users in 2019. With all these estimates, it should be noted that Facebook does not segment out its subsidiaries very often, so much of this data is from third-party sources and is not guaranteed to be 100% accurate.

Facebook, like Google, has a large moonshot/R&D department. Its biggest initiatives are virtual and augmented reality (VR/AR), with nearly 10K employees reportedly working on this division alone. While the fruits from these investments may not come for many years, it is nice to see Facebook making these large bets on the future. Right now, Facebook has a market cap of $900 billion, giving it a P/OI of 27.6. Like Google, this is a very reasonable valuation when you consider Facebook's track record of growth.

Verdict

Both Facebook and Google seem like durable businesses trading at sensible valuations, but if forced to choose, I think Google is a better buy over the long term. Why? Because Google's assets are at less risk of disruption. Search, Google Maps, and YouTube feel like permanent assets of the internet, while Big Blue and Instagram are at risk from competitors like Snap (SNAP -0.18%), Tik Tok, and Roblox (RBLX -1.07%). For example, according to a survey from Piper Sandler, only 24% of teens chose Instagram as their favorite social platform right now, down 7% from a year ago.  And while Facebook's VR/AR incubator looks promising, it will likely face stiff competition from Apple (AAPL 0.51%), the king of consumer hardware products. 

When you consider all these factors, it looks like Google, not Facebook, is the better buy for long-term investors.