Long-term, buy-and-hold investing has been shown to be one of the most profitable ways to invest.

Holding stocks for decades allows compounding to work its magic to deliver life-changing returns, and also defers capital gains taxes that would otherwise eat into your gains. Better yet, it allows you to sleep easy at night. You simply buy great companies and let time do the work.

If you doubt the wisdom of the strategy, just ask Warren Buffett, whose Berkshire Hathaway conglomerate has grown by a compound annual rate of 20% for decades, more than doubling the S&P 500's performance over the same timeframe and beating its total return several times over.

The trick is to find the right stocks. Let's take a look at three stocks you'll want to hold for decades to come.

An hourglass with sand running out of it.

Image source: Getty Images.

1. Stitch Fix

Stitch Fix (SFIX -2.28%) has been highly volatile since it went public in 2017. As an online personalized styling service, the company is unique on the stock market, and its stock price often moves by double-digit percentages after each earnings report, a sign investors are still trying to figure the company out.

Stitch Fix has a unique approach to apparel retail as the company has collected data on its clients' tastes and fit for nearly a decade. Historically, its model has been based on shipping customers "Fixes," or boxes of five items of clothing, allowing the customer to keep what he or she wants and send the rest back.

Later this year, Stitch Fix will take a significant step forward with its data-science-based model when it launches the Direct Buy offering to new customers. Using its style profile intake questionnaire and tools like its style shuffle game, the company will offer a curated selection of clothing for new customers based on their tastes. Thus far, the company has gotten strong feedback on Direct Buy from existing customers, and the program has served one-quarter of its active women's clients.

Stitch Fix Founder and CEO Katrina Lake will be stepping down in August to be replaced by current President Elizabeth Spaulding. The move is timed to coincide with the Direct Buy launch, which will expand the company's addressable market by multiples and could supercharge its growth. At a market cap of less than $5 billion, the stock has huge upside if it can execute on Direct Buy. 

2. Okta

A decade ago, venture capitalist Marc Andreessen famously said that software is eating the world. Okta (OKTA -1.79%), a cloud-based provider of identity and security tools, may be a perfect example of that.

The company has grown to a market value of more than $30 billion, thanks to its leadership in what might seem to be a niche category but is one that has grown significantly. Okta's business providing tools like multi-factor authentication and single sign-on to allow employees and customers to seamlessly and securely log in to online networks. Its addressable market has grown significantly since its IPO in 2017, from $18 billion to $80 billion, as it has expanded into adjacent markets and seen increased interest in its identity cloud. 

The company has also grown like clockwork with revenue growth of 40% every quarter since it went public, and its profitability has significantly improved. Last year, its free cash flow reached $110.7 million or 13% of revenue, and its adjusted net income was $16.2 million. Its recent acquisition of Auth0 should also help accelerate its growth, especially in international markets. 

The need for identity and security solutions isn't going to go away, and Okta's revenue will eclipse $1 billion this year in a market worth $80 billion. There's still a lot of growth ahead for the cloud stock.

3. Roku

If there was any doubt that streaming would take over the entertainment industry, the pandemic settled that debate. Legacy media companies have scrambled to launch new services over the last year, hastening the transition from linear TV to streaming television.

That's great news for Roku (ROKU -3.05%), the market share leader in streaming TV devices with a 38% share in the U.S., according to NPD Group. Roku is much more than a seller of dongles to plug into your TV. The company's software powers many of the smart TVs on the market, and its platform has enabled it to build a powerful advertising business since it generally controls one-third of ad inventory from the streaming partners on its platform. Just as streaming accelerated during the coronavirus pandemic, so has digital advertising and a number of ad tech stocks have touted high-double-digit or even triple-digit percentage growth in Connected TV. This bodes well for Roku, as the company is in the position to act as toll collector in the industry.

Overall revenue rose 58% year over year in the fourth quarter to $649.9 million, and platform revenue, which is the high-margin component driven by advertising, jumped 81% to $471.2 million.

Video streaming still has plenty of growth ahead of it, both domestically and internationally. And ad spending should continue to grow on streaming platforms, especially as the technology and targeting behind it become even more sophisticated.

Roku looks well-positioned to capitalize on this long-term trend.