HubSpot (HUBS -0.78%) and Salesforce (CRM 0.42%) resemble the David and Goliath, respectively, of the cloud-based customer relationship management (CRM) market.

HubSpot provides a free CRM platform for smaller businesses, which serves as a launchpad for its tools in paid marketing, lead generation, search engine optimization, and analytics. It creates "inbound" marketing campaigns (such as social media campaigns, viral videos, or blogs) to drive consumers to seek out brands on their own.

Salesforce owns the world's largest cloud-based CRM platform and primarily serves larger enterprise customers. It also provides other sales, marketing, analytics, and data visualization services. Like HubSpot, Salesforce prioritizes the development of lower-cost inbound marketing campaigns to reach a broader range of consumers.

Customer service representatives answering calls at at a call center.

Image source: Getty Images.

HubSpot and Salesforce aren't direct competitors, and both stocks have generated impressive year-to-date gains. HubSpot's stock has risen 66% while Salesforce's climbed 57%. Should you invest in either of these high-flying CRM stocks today?

How fast is HubSpot growing?

HubSpot's revenue grew 33% in 2022, and it expects 22% to 23% growth in 2023. Its growth cooled off over the past year as macro headwinds drove companies to rein in their spending.

It continued to expand its customer base at a healthy mid-20% year over year rate over the past five quarters, but it struggled to grow its average revenue per customer at the same rate. As a result, its net revenue retention (NRR) rate -- the percentage of recurring revenue retained from existing customers -- dropped below its target level of 110% over the past four quarters.

However, management believes it can keep its NRR above 100% as smaller companies continue to scale up their businesses in this tough market. It also expects its new AI tools for generating digital content, summarizing calls and emails, assisting customers with chatbots, and accelerating data analytics to lock in more customers.

As HubSpot's revenue growth cooled off, it laid off 7% of its workforce earlier this year and implemented other cost-cutting measures to boost its margins. That's why it expects its adjusted operating margin to expand from 9.8% in 2022 to a midpoint of 13.9% in 2023, and adjusted earnings per share (EPS) to surge 88% to 90% for the full year.

Those growth rates are impressive, but a lot of optimism is already baked into its shares at 75 times forward earnings and 11 times this year's sales. Those high valuations, along with its lack of profits on the basis of generally accepted accounting principles (GAAP), could limit its appeal as long as interest rates stay elevated.

How fast is Salesforce growing?

Salesforce's revenue grew 18% in fiscal 2023 (which ended this January), but it expects only 11% growth in fiscal 2024. Like HubSpot, Salesforce is grappling with slower software spending in this challenging economy. It also lapped several major acquisitions and stopped making massive purchases over the past year.

Salesforce doesn't break out the NRR of its cloud platforms, but its remaining performance obligations (RPO) -- the remaining value of its contracts that have yet to be booked as revenue -- rose 12% year over year in its latest quarter. Its near-term revenue growth should follow a similar trajectory.

Salesforce attracted a lot of attention from activist investors as its growth slowed. In response, it laid off about 10% of its workforce and reined in spending. As a result, it expects its adjusted operating margin to expand from 22.5% in fiscal 2023 to 30% in fiscal 2024, and for its adjusted EPS to jump 53% to 54%. That's an impressive growth rate for a stock that trades at 27 times forward earnings and 6 times this year's sales. It's also consistently profitable on a GAAP basis.

The company also launched its first buyback plan last year and repurchased $4.1 billion in shares throughout the first half of fiscal 2024. All of those improvements prompted its activist investors to back off, but Salesforce still faces a lot of competition across the enterprise CRM market. Reining in its spending at the wrong time might narrow its competitive moat.

The winner: Salesforce

Salesforce is growing slower than HubSpot, but its higher operating margins, stable GAAP profits, and lower valuation all make it the better buy. HubSpot is still a great growth stock, but its frothy valuations should limit its near-term gains.