Alibaba (NYSE:BABA) and Facebook (NASDAQ:FB) are two of the world's top tech companies. Alibaba is China's largest e-commerce and cloud company, and Facebook owns the world's largest social network.

Alibaba's stock more than tripled since its IPO in 2014, while Facebook's stock rose more than sixfold since its IPO in 2012. Both stocks are still solid long-term investments, but which one is the better buy today?

A woman uses a social media app on her smartphone.

Image source: Getty Images.

How do Alibaba and Facebook make money?

Alibaba generated 82% of its revenue from its core commerce business last quarter, which includes Taobao and Tmall in China, Lazada in Southeast Asia, AliExpress for overseas shoppers, Alibaba.com for businesses, its cross-border marketplaces, and brick-and-mortar stores. Its Chinese marketplaces serve 726 million annual active customers.

Alibaba's cloud business generated 11% of its revenue, while the rest came from its digital media and innovation initiatives businesses, which house other products and services -- including its streaming media platforms, web browser, search engine, and smart speakers.

E-Commerce icons on a computer keyboard

Image source: Getty Images.

However, only the core commerce business is profitable, and Alibaba subsidizes the growth of its unprofitable businesses with its online marketplaces. Those marketplaces, which sell paid listings to merchants, also make it China's largest digital advertising platform.

Facebook's core platform serves 2.6 billion monthly active users. Its entire family of apps -- which includes Messenger, WhatsApp, and Instagram -- reaches nearly 3 billion people every month. It also sells Oculus VR headsets and Portal smart screens.

Facebook generated 98% of its revenue from online ads last quarter. The remaining sliver mainly came from its hardware devices. Facebook and Alphabet's (NASDAQ:GOOG) (NASDAQ:GOOGL) Google share a near-duopoly in online ads in many countries, but both companies face fresh competition from Amazon.com (NASDAQ:AMZN), which is leveraging its e-commerce dominance to sell more ads across its platforms.

Facebook's main platforms are blocked in China, but it still generates a significant amount of revenue from Chinese companies -- which are buying ads aimed at overseas customers.

How fast are Alibaba and Facebook growing?

Alibaba's revenue rose 35% in fiscal 2020, which ended on March 31, as its adjusted earnings per share (EPS) grew 38%. It expects its revenue to rise at least 28% in fiscal 2021, even after factoring in COVID-19 headwinds, and analysts expect its adjusted earnings to grow 14%. Those are solid growth rates for a stock that trades at 26 times forward earnings.

But Alibaba faces several persistent headwinds. Its core commerce business is growing increasingly dependent on its lower-margin brick-and-mortar and cross-border marketplaces for fresh growth. Its online marketplaces also face tough competition from JD.com and Pinduoduo, the second- and third-largest e-commerce players in China, respectively.

It's also butting heads with Tencent (OTC:TCEHY) in China's cloud market, where Tencent ranks second, and online payments, where Alibaba's affiliate Alipay shares a near-duopoly with Tencent's WeChat Pay. That competition could throttle Alibaba's revenue growth and compress its margins. There's also a small (but noteworthy) chance U.S. regulators could force U.S.-listed Chinese companies like Alibaba to delist their shares.

Facebook's revenue rose 27% in 2019, but its EPS declined 15% on higher ecosystem investments and expenses incurred from regulatory probes regarding its privacy and security practices.

Facebook hasn't provided any guidance for 2020 -- but analysts expect its revenue and earnings to grow 10% and 13%, respectively, as the COVID-19 crisis throttles ad purchases. Those growth rates are a bit tepid for a stock that trades at over 30 times forward earnings.

Facebook's core platforms are still growing, but Gen Z-oriented platforms like Snap's Snapchat and ByteDance's TikTok are luring away younger users. Google, Amazon, and other rivals could attract its advertisers, and it still faces unresolved antitrust issues in both the U.S. and overseas markets.

The winner: Alibaba

Facebook and Alibaba will both keep dominating their respective markets, and both tech stocks could climb higher over the next decade.

However, Alibaba's better-diversified business, stronger growth rates, and lower valuation make it a stronger overall investment. Facebook needs to diversify its core business beyond ads, overcome its privacy and antitrust issues, and stabilize its decelerating growth before it's considered a sound investment again.

This article represents the opinion of the writer, who may disagree with the “official” recommendation position of a Motley Fool premium advisory service. We’re motley! Questioning an investing thesis -- even one of our own -- helps us all think critically about investing and make decisions that help us become smarter, happier, and richer.