Investors must understand that it's not a question of whether a recession will occur but of when one will occur. Whether the next recession is right around the corner or in a decade is irrelevant, one will eventually come. At that time, the stock market will likely take a dive, but what stocks will be worth buying then?

I've got two that I think would make excellent buys during a recession, but they also make for solid investments right now.

1. CrowdStrike

There are some software components to a business that should never be in jeopardy of being cut. Cybersecurity is one of those line items, as eliminating it could open up a business to an attack, creating even worse problems than a recession ever could.

In this space, my top pick is CrowdStrike (CRWD -0.48%), although many other cybersecurity companies are worthy of consideration. I like CrowdStrike because it provides endpoint security for its clients, which protects network access points from threats. Additionally, it has over 20 other offerings that clients can add to their base product to create a robust solution. Switching to a different provider also becomes difficult as CrowdStrike's products become deeply integrated into the company infrastructure, making a switch or elimination of a product even more complex.

This stickiness shows up in CrowdStrike's revenue retention metric, which was above 120% in the second quarter of fiscal year 2023, meaning CrowdStrike customers spent $120 for every $100 they spent last year. Furthermore, while we aren't in a technical recession, it's hard to deny that economic optimism isn't at a high point. Because of that fact, many enterprise customers aren't willing to spend on an expensive software package, which contributed to CrowdStrike's "disappointing" (at least according to analysts) first-quarter revenue growth of 42%.

While the stock sold off after these results, CrowdStrike is already operating well in a challenging environment, and it has shown it can navigate less-than-ideal times. If CrowdStrike's stock sinks with the rest of the market in the future, it will be an outstanding stock to buy at discounted prices.

2. Autodesk

In a similar line of thinking to CrowdStrike, Autodesk (ADSK -1.30%) provides engineers and architects with the tools they need to do their jobs. Without Autodesk's software, these fields would have to revert to hand drawings, which would be at an extreme operational disadvantage (and highly unlikely to ever occur).

In past recessions, Autodesk had a yearly product, meaning clients could choose not to upgrade if the budget didn't allow it. Now, Autodesk operates on a subscription model, which requires clients to pay for use every year, regardless of the economic environment.

This model has already proven itself, as Autodesk's revenue barely budged during the COVID-19 pandemic while it had several dips from the financial crisis and other mid-2010 scares.

ADSK Revenue (TTM) Chart.

ADSK Revenue (TTM) data by YCharts.

Furthermore, after Autodesk began transitioning to this model in 2018, its revenue growth remained relatively steady. The latest revenue dip is primarily due to clients not adding additional software seats, as most companies are trying to become more efficient in the face of a recession.

If you can invest in a company that grows 8% in the bad times and 15% in the good, it is a lucrative investment, as few companies can offer that stability.

Another bonus to Autodesk is its geographic diversity, as Autodesk isn't just concentrated on American clients.

Region Q1 FY 2024 Revenue Q1 FY 2024 Makeup YOY Revenue Growth
Americas $553 Million 43% 14%
EMEA $474 Million 37% 6%
APAC $242 Million 19% 2%

Data source: Autodesk. YOY = Year over Year. EMEA = Europe, Middle East, and Africa. APAC = Asia-Pacific. Note: Revenue makeup does not add to 100% due to rounding errors.

Clearly, EMEA and APAC have some economic uncertainty associated with those regions. But, with Autodesk's global footprint, it can weather these storms.

Autodesk makes for a strong buy in a recession, but with the stock trading at 27 times forward earnings, it doesn't look bad now, either.