Fears of a recession and other macro headwinds often drive investors to dump their tech stocks and invest in more defensive sectors. However, many tech companies are actually well-equipped to handle deep economic downturns.

Today I'll take a closer look at three tech companies that should remain promising investments during a recession: the cloud-based services provider ServiceNow (NOW 0.62%), the diversified chipmaker Broadcom (AVGO 0.46%), and the Dutch semiconductor equipment maker ASML (ASML 1.30%).

A sign warning of a recession.

Image source: Getty Images.

1. ServiceNow

ServiceNow's cloud-based tools help companies streamline their work patterns into digital workflows. That digitization process makes it easier for companies to expand, reduce their costs, and support remote workers. It's naturally insulated from recessions since economic downturns usually highlight the growing need for its digital transformation services.

ServiceNow's annual revenue grew at a compound annual growth rate (CAGR) of 30% between 2017 and 2022, and it expects that momentum to continue with a CAGR of at least 21% from 2022 to 2026. Unlike many other high-growth cloud software companies, ServiceNow is firmly profitable on a generally accepted accounting principles (GAAP) basis.

ServiceNow's stock isn't cheap at 53 times forward earnings, and its near-term growth might be crimped by macro and currency challenges. But its early-mover's advantage in digital workflow tools, the stickiness of its subscriptions, and its stable gross margins all suggest it deserves to trade at a premium to slower-growth cloud plays like Salesforce.

2. Broadcom

Broadcom develops a wide range of chips for the data center, networking, broadband, wireless, storage, and industrial markets. It also operates a smaller infrastructure software business, which could grow a lot larger if its proposed takeover of the cloud giant VMware is finally approved.

Broadcom's top client is Apple, which accounted for a fifth of its revenue last year. But it also has limited exposure to the post-pandemic slowdown of the PC market, and it's benefited from the accelerating pace of infrastructure upgrades over the past year.

That diversification makes Broadcom a more balanced semiconductor play than many of its chipmaking peers. Its annual revenue rose at a CAGR of 13% from 2017 to 2022, and analysts expect a stable CAGR of 5% from 2022 to 2025, even as the broader chip market experiences a cyclical slowdown. That outlook doesn't account for its takeover of VMware, which would significantly boost its revenue and reduce its dependence on Apple.

Broadcom is firmly profitable, its stock trades at just 14 times forward earnings, and it pays a hefty forward yield of 3.1%. Those fundamental strengths should make it a sound stock to hold during a recession.

3. ASML

Fabless chipmakers like Broadcom, Qualcomm, Nvidia, and AMD all outsource the production of their chips to third-party foundries like Taiwan Semiconductor Manufacturing and Samsung. However, TSMC and Samsung can't actually manufacture their most advanced chips without ASML's lithography systems, which are used to etch circuit patterns onto silicon wafers.

ASML is the world's largest producer of lithography systems, and it's the only producer of extreme ultraviolet (EUV) systems, which are used to manufacture the world's smallest and densest chips. ASML's monopolization of these systems, which cost $200 million each and require multiple planes to ship, makes it a linchpin of the semiconductor market.

Between 2017 and 2022 ASML's annual revenue grew at a CAGR of 19% as its gross margin expanded from 45% to 50.5%. It expects its top line to continue growing at a CAGR of about 12% from 2022 to 2030 (at the midpoint of its long-term estimates) as its gross margin expands to 56%-60% by the final year.

ASML's stock might seem a bit pricey at 32 times forward earnings, but it will likely remain one of the most important -- and recession-resistant -- technology companies for the foreseeable future.