Costco Wholesale (COST -0.12%) and Home Depot (HD -0.31%) have both been phenomenal stock holdings for patient investors. The retailers are up nearly 400% in the 10 years ended in early 2023 compared to a 170% increase in the S&P 500 index. Your gains would have been better by roughly 100 percentage points if you reinvested your dividends along the way, too.

But which of these leaders in their respective industries makes the better buy today? Let's compare the stocks with an eye toward returns over the next decade.

The case for Home Depot

Home Depot might be a better fit for your portfolio if you're looking for both dividend income and blazing earnings growth. Sure, annual profits are less predictable for the home improvement giant than they are for Costco, which generates most of its earnings from subscription fees.

But Home Depot is a far more profitable business. Its operating margin sits at 15% of sales, well above Costco's 3% margin -- and even higher than rival Lowe's 12% rate.  .

Home Depot will appeal to income investors as well since the company aims to return roughly 55% of annual earnings to shareholders in dividend payments. That's more generous than most other retailers, including Lowe's and Costco.

Shares of Home Depot currently yield over 2%, while Costco's yield is around 0.6%. Sure, the warehouse giant has made a habit out of delivering large one-time dividend payments every few years. But Home Depot's payout is bigger and more predictable.

The case for Costco

If you're more worried about significant economic disruptions ahead, Costco might be a better option here. The company is heading into 2023 with some of the best customer loyalty in its history. A full 93% of its members renew their memberships right now, and it's easy to see how today's inflationary environment is helping support that record renewal level. As a price leader, the retailer's value proposition is the clearest during periods of high and/or rising prices.

Costco is also less exposed to rising interest rates, which threaten to depress demand in the housing market. As a consumer staples retailer, the company doesn't experience collapsing demand even through downturns. On the contrary, shoppers tend to visit its warehouses more often when they are looking to stretch household budgets.

Valuation comparison

Costco is also less expensive from a valuation perspective. You'd have to pay about 1 times annual sales to own shares today, which is down from about 1.3 times in the peak growth days of the pandemic. Home Depot's valuation has shrunk 33% to a price-to-sales ratio of 2.1 here in early 2023.

HD PS Ratio Chart

HD PS Ratio data by YCharts

Both of those valuation levels are likely to translate into solid returns for investors who are prepared to hold Costco and Home Depot stocks through any volatility ahead while Wall Street tries to determine if the economy will continue growing as inflation is brought under control.

But smart investors can take advantage of the pessimism by picking up shares of these high-performing retailers today. They each have different strengths as investments, but Costco's and Home Depot's market leadership positions and healthy finances should deliver excellent returns for shareholders over the next decade or more.