The S&P 500 is currently down 4% from its high, but the S&P 500 Information Technology Index -- which tracks tech stocks in the S&P 500 -- is down 9%. In other words, the tech sector has underperformed the broader market over the last few months. But if you extend the time horizon, that narrative changes.

Broadly speaking, tech stocks have actually beat the S&P 500 over the past one, three, five, and 10 years. In fact, the S&P 500 Information Technology Index is up 470% over the past decade, while the S&P 500 is up just 227%. That data makes a strong case for allocating at least a portion of your portfolio to the tech sector.

With that in mind, shares of Etsy (ETSY 0.34%) and DigitalOcean Holdings (DOCN 3.30%) currently trade over 50% below their all-time highs, but both stocks could be smart additions to your portfolio. Here's why.

A group of investors is gathered around a table, where they are discussing various financial documents.

Image source: Getty Images.

1. Etsy

Etsy operates the fourth-most-popular e-commerce marketplace in the United States in terms of monthly visits. And its focus on unique and creative goods has been essential to its success. The Etsy brand has become synonymous with handmade, vintage, and customizable inventory, differentiating it from other marketplaces like Amazon and big box retailers like Walmart.

To reinforce that edge, Etsy provides value-added services that simplify commerce for its sellers, including digital advertising tools and discounted shipping labels. On the other side of the equation, Etsy has worked hard to improve the buyer experience with AI-powered search results and personalized recommendations, and by providing better post-purchase support. Collectively, those initiatives have paid off in a big way.

Since 2019, Etsy has doubled the number of buyers and sellers on its marketplace, and it has tripled the number of habitual buyers (i.e. consumers that have spent more than $200 and made purchases on at least six days in the last 12 months). In turn, revenue has skyrocketed 35% to $2.3 billion in 2021, and earnings have risen 30% to $3.41 per diluted share.

Currently Etsy puts its core market opportunity at $466 billion, a figure that includes online spending across its seven core geographies. But that number jumps to $2 trillion if you include transactions that currently take place offline, and it gets even bigger if you factor in Etsy's recent acquisitions of fashion resale platform, Depop, and the Brazilian marketplace Elo7, which (like Etsy) specializes in handmade and unique goods.

In short, Etsy already has a big market opportunity, but it should get even bigger as online shopping continues to take share from traditional retail. More importantly, the company has carved out a defensible niche by focusing on unique and creative goods. And with shares trading at nine times sales -- quite a bit cheaper than the three-year average of 12.1 times sales -- this tech stock looks like a bargain buy.

2. Digital Ocean

Tech giants like Amazon and Microsoft have become synonymous with cloud computing, and there's a good reason for that. Those companies offer an incredible array of cloud services, from basic infrastructure solutions to cutting edge tools for machine learning and quantum computing. Unfortunately, those products are typically designed with larger enterprises in mind, meaning they are often too complex for individual developers or small businesses. That's why DigitalOcean is on a mission to democratize cloud computing.

Its platform, while no match for Amazon or Microsoft, features a growing number of infrastructure and platform services, including networking and storage, development tools, and fully managed databases. More importantly, all of those products are designed with simplicity in mind, meaning small business can provision cloud services in minutes, without any specialized training. The company also provides 24/7 customer and technical support, as well as thousands of developer tutorials and an array of community-generated educational content. In short, DigitalOcean makes it easy to build and scale cloud applications, even for clients that lack a robust IT department.

Not surprisingly, those differentiating qualities have fueled solid growth. Last year, DigitalOcean saw its customer count rise 6% to 609 thousand, and the average customer spent 16% more. In turn, that compounding dynamic drove revenue 35% higher to $429 million, and the company generate positive free cash flow of $24 million, up from a loss $57 million in 2020.

Looking forward, I think DigitalOcean could maintain (or even accelerate) its growth. Management puts its addressable market at $72 billion in 2022, but believes that figure will hit $145 billion by 2025 as more small businesses adopt cloud services. That puts DigitalOcean (and its disruptive business model) in front of a sizable opportunity. And with shares trading at 13.5 times sales -- a bit cheaper than the historical average of 14.9 times sales -- now seems like a good time to start a position in this beaten-down tech stock.