The S&P 500 has lost 16% of its value in the past year. Investors have hit the panic button amid surging inflation, rising interest rates, macroeconomic headwinds, and the probability of a recession. But it is worth noting that the stock market has been a good place to park one's funds over the long run.

Picking the right stocks can help investors beat inflation and grow their wealth in the long run, as evident from the average returns that the stock market has generated over the years. That's why savvy investors should consider buying beaten-down stocks with healthy long-term potential on the cheap right now, as such a move could supercharge their portfolios in the long run.

Cloudflare (NET 1.44%) and Twilio (TWLO 1.47%) are two such names that have been battered big time on the market in the past year, losing 62% and 77% of their values, respectively. However, both companies operate in fast-growing niches that should help them sustain their impressive growth rates. What's more, it won't be surprising to see shares of Cloudflare and Twilio double in the next five years. Let's see why that may be the case.

1. Cloudflare

Cloud services provider Cloudflare, whose offerings make internet connections and web applications secure, faster, and more reliable, has been growing at an eye-popping pace thanks to the rapid adoption of its solutions.

The company's revenue in the first nine months of 2022 increased a whopping 51% year over year to $700.5 million. Its 2022 outlook suggests that it will close the year with around $975 million in revenue, which would be a 48% jump over 2021. The good part is that Cloudflare's robust top-line growth is here to stay as per analysts' estimates.

Chart showing Cloudflare's revenue estimates for the current and next fiscal year rising.

NET Revenue Estimates for Current Fiscal Year data by YCharts

It is also worth noting that the company expects to hit $5 billion in annual revenue over the next five years. That would translate into a compound annual revenue growth rate of nearly 39% based on 2022's estimated revenue. A closer look at the market in which Cloudflare operates will tell us why it can achieve such a high pace of growth.

The company estimates that its total addressable market will hit $135 billion in 2024, which means that it hasn't captured even 1% of the opportunity on offer. This huge market opportunity that Cloudflare is sitting on will be driven by multiple applications such as the cloud object storage market (which allows customers to store large amounts of unstructured data in the cloud), the growing adoption of zero trust security services (which requires authentication of all the users on an organization's network), and the proliferation of other security solutions such as firewalls and DDoS (distributed denial-of-service).

With Cloudflare being used by nearly 80% of the websites that use content delivery networks, the company is in a nice position to sustain its rapid growth. Its dominant market share explains why its customer base and customer spending have been growing impressively.

In the third quarter of 2022, the number of paying customers increased 18% year over year. The number of large customers (who have generated $100,000 in annualized revenue) increased at a much faster pace of 51%, indicating that they have been adopting more of the company's offerings. All this explains why Cloudflare could eventually hit its $5 billion revenue target after five years.

Cloudflare stock is now trading at 15.7 times sales. That's expensive compared to the S&P 500's price-to-sales ratio of 2.1, but a higher valuation seems justified given Cloudflare's popularity and its ability to grow fast over the next five years. Assuming Cloudflare's sales multiple drops to even half of what it is right now after five years owing to rising competition that could challenge its growth prospects, its market capitalization could jump to more than $35 billion.

That would be more than double Cloudflare's current market capitalization of $14 billion, suggesting that this cloud stock could double investors' money in five years.

2. Twilio

Twilio stock is down a whopping 77% in the past year. That may seem a bit far-fetched, considering that the company's 2022 revenue is estimated to have increased 34% year over year to $3.8 billion. Analysts are expecting a major slowdown in Twilio's growth this year, with revenue expected to increase just 16.5%, but that's still quite respectable considering the company's valuation.

Twilio is now trading at 2.5 times sales. That's a nice discount to its five-year average sales multiple of 16.5. Buying Twilio stock at this valuation seems like a no-brainer, as the company is likely to sustain its solid growth for years to come. Analysts, for instance, anticipate 82% annual growth in the company's earnings for the next five years.

It is not surprising to see why Wall Street is so optimistic about Twilio's prospects. The company is a key player in the fast-growing cloud collaboration space. According to the Synergy Research Group, Twilio was the third-largest player in the market for hosted cloud services after Microsoft and RingCentral. This space is generating an estimated $7 billion in revenue each quarter.

Overall, Twilio is the fourth biggest company in the market for on-premises and cloud collaboration tools, a space that generated $15 billion in revenue in the second quarter of 2022. However, enterprises are moving from on-premise products to the cloud, which means that the size of Twilio's addressable market should keep increasing.

Twilio's solutions allow companies to communicate with their customers with the help of APIs (application programming interfaces). These APIs can be installed in the smartphones or computers of customer service associates, eliminating the need for costly physical contact centers. This explains why the cloud-based contact center market is expected to clock nearly 23% annual growth through 2027, which would set Twilio up for impressive growth over the next five years.

Investors should also note that the company's top-line growth is expected to accelerate to 18% in 2024.

Chart showing Twilio's estimated revenue for the next two fiscal years falling.

TWLO Revenue Estimates for Next Fiscal Year data by YCharts

Assuming Twilio can maintain a conservative 15% annual revenue growth rate over the next five years (which is slower than the estimated annual growth of its end market), its top line could increase to $7.6 billion at the end of the forecast period. Multiplying the estimated revenue with the company's current sales multiple of 2.5 would translate into a market capitalization of $19 billion.

That's double the company's current market cap, which means that investors have a golden opportunity to buy this tech stock on the cheap and set their portfolios up for success in the long run.