Last year, as the pandemic forced consumers to shelter at home, they turned to online shopping for everything from groceries and toiletries to supplies for home improvement projects. That meant more people were making purchases on marketplaces like Amazon (AMZN -1.64%) and Etsy (ETSY -2.17%).

Not surprisingly, both stocks performed incredibly well. In fact, over the last 12 months, the share price of Amazon is up 58% and Etsy's stock price has surged more than 400%. But which one of these e-commerce companies is the better buy today?

Amazon: The everything store

Amazon's marketplace is the most visited e-commerce website in the world, and the company is by far the largest online retailer in the U.S., with a 39% market share, according to eMarketer. That scale gives Amazon a big advantage over competitors like Walmart.

Amazon books retail store.

Image source: Amazon.

But the thing that really sets Amazon apart is the incredible diversity of its business. Unlike its retail rivals, Amazon also competes in markets like cloud computing, consumer electronics, digital advertising, digital payments, streaming media, shipping and logistics, and video games.

Notably, Amazon Web Services (AWS) -- the company's cloud computing business -- is the largest public cloud service provider in the world, with a 32% market share, according to Canalys. Amazon is also the third-largest player in the U.S. digital ad market, behind only Alphabet's Google and Facebook. The takeaway is this: These complementary lines of business allow Amazon to compete in several quickly growing markets, and they typically come with much higher margins than its core retail segment.

In other words, not only is Amazon much larger than the vast majority of retailers, but it also benefits from higher-margin revenue streams. That has allowed the company to invest aggressively in growing its business. For instance, Amazon has built out a massive logistics network, allowing it to provide fulfillment services for merchants and one- or two-day shipping for consumers. That value proposition has helped the company attract at least 150 million Prime members across 170 countries worldwide.

Put simply, it's hard for rivals to compete against a bigger, more profitable company like Amazon. And that advantage has translated into strong financial performance on both the top and bottom lines.

Metric

2017

2020

CAGR

Revenue

$178 billion

$386 billion

29%

Free cash flow

$6.4 billion

$26 billion

60%

Data source: Amazon SEC filings. CAGR = compound annual growth rate.

Despite Amazon's colossal size and tremendous past performance, the company has room to expand. E-commerce is still gaining traction around the world, as is cloud computing, digital advertising, and many other markets in which Amazon competes. Those trends should power its business to even greater heights in the years ahead.

Etsy: The handmade marketplace

Etsy has also benefited from the widespread adoption of e-commerce. But unlike Amazon, its marketplace deals in handcrafted and vintage goods, the type of personalized or specialized items consumers might not find in a typical store. For example, if you're looking to buy wall art directly from an artist, home furnishings from a woodworker, or a cosplay outfit from a designer, Etsy is a great place to shop.

Ivy-covered arch at the Etsy headquarters building.

Image source: Etsy.

Last year, the pandemic supercharged Etsy's growth and showcased the strengths of its dynamic inventory. When physical retailers closed their doors, consumers turned to Etsy for necessities like face masks, and its sellers adapted quickly.

In fact, within two weeks of receiving an email from management detailing the demand for face masks, 20,000 different merchants were selling masks on Etsy's marketplace. And over the course of the year, mask sales contributed $743 million to Etsy's gross merchandise sales (GMS). That agility comes from its massive seller base, which reached 4.4 million in 2020, up 62% from 2019 -- giving Etsy a big advantage over smaller rivals.

But mask sales weren't the only bright spot for the company last year. Management took other steps to drive marketplace growth, including the launch of an offsite advertising service that helped draw consumers from social media platforms like Instagram and search engines like Google. In 2020, those efforts helped Etsy reach 81.9 million active buyers, up 77% from the prior year.

Notably, the company's growing network of buyers and sellers accelerated revenue growth to 111% in 2020, extending Etsy's track record of strong financial performance. Even more impressive, the company didn't sacrifice pricing power to achieve that growth. In fact, its gross margin jumped to 73% last year, up from 67% in 2019.

Metric

2017

2020

CAGR

Revenue

$441 million

$1.7 billion

58%

Free cash flow

$56 million

$671 million

129%

Data source: Etsy SEC filings. CAGR = compound annual growth rate.

Put simply, the pandemic tested Etsy's durability, and the company passed with flying colors. Going forward, I doubt mask sales will contribute to Etsy's top line to the same extent, but its value proposition to both consumers and merchants likely converted many people to permanent buyers and sellers. That should help the company continue to grow its business in the years ahead.

The verdict

Both of these companies look like solid long-term investments, especially given that online shopping is still gaining traction around the globe. But I think Etsy's smaller size and faster growth translates into more potential upside for investors. In the coming years, as its business continues to expand and mature, I expect Etsy to become an increasingly meaningful part of the e-commerce landscape.