The S&P 500 slipped 19.4% last year as runaway inflation, rising interest rates, and recession fears rattled Wall Street. But the benchmark index rebounded 15.9% in the first half of 2023 amid better-than-expected earnings and enthusiasm surrounding artificial intelligence. That momentum points to positive returns in the second half.

Since 1957, when returns in the first half of a year exceeded 10%, the average return for the second half was 6.8%, according to data from Carson Group. So what? The S&P 500 has traded sideways since the end of June, but if the current year falls precisely in line with the average, the index will climb another 6.8% before the end of 2023.

Of course, past performance never guarantees future returns, but now is still a good time for patient investors to buy these growth stocks.

1. Shopify

Shopify (SHOP 1.11%) provides a turnkey solution for omnichannel commerce. Its software allows merchants to sell products across physical and digital stores, including popular marketplaces, social media networks, and direct-to-consumer webpages. The company also provides adjacent solutions for marketing, payments, and wholesale, as well as logistics support through partners like Flexport and (most recently) Amazon.

Shopify is the second-largest U.S. e-commerce company behind Amazon, and it's the global leader in e-commerce and omnichannel commerce software. That strong market presence translated into solid results in the second quarter. Revenue climbed 31% to $1.7 billion, a meaningful acceleration from 16% growth in the prior-year period, and non-GAAP earnings per diluted share improved to $0.14, up from a loss of $0.03 per share.

Turning to the future, the e-commerce software market is projected to increase 16% annually through 2030, while retail and wholesale e-commerce sales are forecast to grow 8% and 20% per year, respectively. Shopify is tackling those opportunities through product innovation and efforts to push upmarket.

For instance, Commerce Components is an offering that allows larger enterprises to incorporate elements of the Shopify commerce stack (e.g., solutions for checkout, wholesale commerce, or storefront-building) into their existing systems. Similarly, Shopify Magic is a suite of artificial intelligence tools that can automate tasks like running reports, writing product descriptions, and redesigning storefronts.

Going forward, Morgan Stanley says Shopify could earn $36 billion in annual revenue by 2033, implying annual growth of 19% over the next decade. That makes its current valuation of 12.2 times sales seem more reasonable, especially when its three-year average is 27.5 times sales. Investors should feel confident in buying Shopify stock today, but as always, it should only represent one piece of a broader, diversified portfolio.

2. Cloudflare

Cloudflare (NET 1.44%) provides a broad range of cloud services that protect and accelerate applications and infrastructure across public clouds, private data centers, and hybrid environments. In other words, Cloudflare makes the internet faster and safer for clients while serving as an agnostic intermediary between vendors like Amazon Web Services and Microsoft Azure.

The company powers about 20% of the internet. That ubiquity is a product of unparalleled speed -- Cloudflare is the fastest cloud network on the market -- and freemium pricing. It also provides the company with deep insight into performance issues and security threats across the web. As a result, Cloudflare was recently recognized as a leader in email security and zero trust network access. The company has also been hailed as a leader in edge development platforms.

Second-quarter earnings saw its customer count increase 15% to 174,129, and it clocked a dollar-based net retention rate of 115%, meaning the average customer spent 15% more than they did in year-ago period. In turn, revenue climbed 32% to $308 million and non-GAAP earnings improved to $0.10 per diluted share, up from breakeven in the prior year. Cloudflare is well positioned to maintain or even accelerate its momentum when economic conditions improve and business spending rebounds.

The company values its addressable market at $146 billion this year, and management says its revenue run rate will reach $5 billion by the third quarter of 2027. That implies annual growth of 39% in the interim, which makes its current valuation of 18.1 times sales more palatable. Investors should feel comfortable buying this cloud stock today.