Alibaba (BABA 0.59%) and Baidu (BIDU 0.62%) are both bellwethers of the Chinese tech sector. Alibaba operates the country's largest e-commerce marketplaces and cloud infrastructure platform, while Baidu owns its top search engine.

The two companies aren't direct rivals, but they indirectly compete with each other in the online advertising market. Alibaba's promoted listings on Tmall and Taobao actually made it the country's largest digital advertising platform by revenue last year. Yet Baidu ranked fifth behind Alibaba, Pinduoduo (NASDAQ: PDD), Tencent (OTC: TCEHY), and JD.com (NASDAQ: JD).

That seismic shift suggests that businesses are buying more ads on e-commerce marketplaces and social networking apps like Tencent's WeChat instead of traditional online search engines like Baidu.

A happy couple is showered with cash.

Image source: Getty Images.

But over the past 12 months, shares of Alibaba and Baidu have stayed nearly flat as China's soft post-pandemic recovery and the delisting threats in the U.S. overshadowed their stabilizing growth. So should you buy either stock right now?

A fresh start for Alibaba

Two years ago, Chinese regulators slammed Alibaba with a record $2.8 billion antitrust fine and barred it from locking in merchants with exclusive deals, using aggressive loss-leading promotions to gain new customers, and expanding its ecosystem with unapproved investments and acquisitions. Those rigid restrictions curbed the growth of Alibaba's Chinese marketplaces and eroded its defenses against Pinduoduo and JD.

That crackdown coincided with the government's intermittent "zero COVID" lockdowns, which further disrupted the growth of Alibaba's e-commerce and cloud businesses. After rising 41% in fiscal 2021 (which ended in March 2021), Alibaba's revenue only climbed 19% in fiscal 2022 and a mere 2% in fiscal 2023. That abrupt slowdown caused many investors to abandon Alibaba, and its stock sank to an all-time low of $58.01 on Oct. 24, 2022.

However, Alibaba's share subsequently surged nearly 450% after bottoming out. That massive recovery was driven by three major tailwinds. First, it restructured into six new units -- Taobao and Tmall, Alibaba International Digital Commerce, Cloud Intelligence, Cainiao Smart Logistics, Local Services, and Digital Media and Entertainment -- and set them loose to pursue external funding and new IPOs. That separation will enable each segment to grow independently and pave the way toward IPOs for its cloud, logistics, and Freshippo supermarket divisions in the near future.

Second, Alibaba's revenue growth accelerated to double-digit levels again last quarter after China finally ended its draconian zero-COVID policies. Its margins also expanded as it tightened its spending on its overseas marketplaces, cloud platform, and digital media businesses. Based on all those improvements, analysts expect Alibaba's revenue and adjusted earnings before interest, taxes, depreciation, and amortization (EBITDA) to rise 11% and 15%, respectively, in fiscal 2024.

Baidu's growth is accelerating again

Baidu still generates over half of its revenue from its online marketing business, which sells display and search-based ads. Those legacy ads face a lot of competition, but Baidu is offsetting that pressure by expanding its Managed Pages, which enable businesses to easily build their own websites and online stores within its ecosystem.

Baidu's revenue stayed roughly flat in 2020 as the pandemic drove companies to rein in their ad spending, but rose 16% in 2021 as some of those headwinds dissipated. Unfortunately, that recovery was cut short by intermittent COVID lockdowns and government crackdowns on the gaming, education, and internet sectors (which throttled Baidu's ad sales to those companies), and its revenue dipped 1% in 2022.

That slowdown, along with the bearish notion that Baidu's advertising business would be rendered obsolete by WeChat, ByteDance's Douyin (known as TikTok overseas), and other faster-growing challengers, drove away the bulls. The sluggish growth of its streaming video platform iQiyi and its investments in its cloud infrastructure platform (Baidu AI Cloud) further compressed its operating margins.

Nevertheless, Baidu returned to double-digit revenue growth in the first half of 2023 as its advertising business recovered, iQiyi locked in more subscribers, and its cloud platform gained more customers. Its cloud platform's adjusted operating margin also turned positive over the past two quarters as it phased out its lower-margin services.

That rapid recovery counters the bearish argument that Baidu is an also-ran of the Chinese tech sector. Instead, it suggests the company is a resilient stalwart that can keep pace with Alibaba, Tencent, and ByteDance in the rapidly evolving market. Analysts expect Baidu's revenue and adjusted EBITDA to both grow 11% for the full year.

The valuations and verdict

Alibaba and Baidu are both fundamentally cheap right now, presumably since investors still aren't sure if their U.S.-listed shares will be delisted. Alibaba trades at 13 times forward earnings and 7 times this year's adjusted EBITDA. Baidu trades at 17 times forward earnings but just 6 times this year's adjusted EBITDA.

It's a close call, but I'd pick Alibaba over Baidu for three reasons. First, the growth of its overseas marketplaces will reduce its dependence on mainland China. Second, it could generate lots of cash by spinning out its subsidiaries through new IPOs. Finally, most of its regulatory headwinds in China seem to be in the rearview mirror.

Baidu's prospects are also improving, but its heavier dependence on the fickle advertising market makes it a slightly less appealing investment than Alibaba.