Costco Wholesale (COST 1.01%) and Home Depot (HD 0.94%) are both leaders when it comes to brick-and-mortar shopping, even if they have different specialties. Cerainly, both possess tremendous scale and brand recognition -- and combined, they carry a gargantuan market capitalization of over $700 billion.

But which of these top retail stocks is the better buy today? Let's take a closer look at Costco and Home Depot and see if we can find out.

Costco: Memberships are key

Investors know Costco as the dominant warehouse club operator that sells high-quality general merchandise at extremely low prices. On its own, this doesn't sound like an exceptional business.

But Costco does things differently. It might sell physical goods through its 875 stores, but what really makes this a special company is its membership model. Consumers pay annual dues, providing a recurring and high-margin source of revenue, for the right to shop at a Costco warehouse.

There are currently 72 million membership households that raked in $4.6 billion of fee revenue last fiscal year. With a worldwide renewal rate of over 90%, this is a sticky customer base.

As a consumer favorite, Costco has been able to post solid sales growth, even during macro and pandemic disruptions. But what's impressive is the company's profitability. Costco's operating margin has expanded steadily over the years. This has allowed management to not only fund the current dividend with no issues but to pay special one-time payouts to its shareholder base, which boosts returns.

In the last five years, Costco shares have soared 241%, crushing the broader S&P 500 by a wide margin. The strong momentum has carried over into 2024, as the stock is in record territory. That's great news for longtime shareholders.

However, for prospective investors looking to get in on the action, it might not be a good time. The stock trades at a ridiculously steep price-to-earnings (P/E) ratio of 50.8. In the last 20 years, shares have never been this expensive. From this point forward, it's hard to believe that market-beating returns can be achieved.

Home Depot: Favorable industry backdrop

With fiscal 2023 sales of $153 billion, Home Depot is the clear leader in the home improvement market. However, it has hit a bit of a rough patch. Revenue last year declined 3% compared to fiscal 2022. And management expects same-store sales to drop 1% in the current fiscal year. These aren't exactly the trends that investors want to see.

After surging demand lifted Home Depot's revenue throughout 2020 and 2021, things have cooled down a bit. In an uncertain economic climate, with higher interest rates and ongoing inflationary pressures, consumers are hesitant to spend on big-ticket items. A valid argument can also be made that a lot of the larger renovation projects were completed during the pandemic, and we could simply be seeing things normalizing somewhat.

It's best to maintain a long-term perspective, though. Home Depot is set to increase its market share in what executives estimate is a $950 billion industry. Perhaps even more encouraging, the median age of a home in the U.S. continues rising, providing a powerful demand tailwind for this business.

Turning our attention to valuation, Home Depot looks like a much more compelling stock to own than Costco. The home improvement giant's shares trade at a P/E multiple of 25.4 right now. That's a slight premium compared to its trailing-10-year history.

It helps that Home Depot returns insane amounts of cash to shareholders. Just last year, the business paid $8.4 billion in dividends and bought back $8 billion of outstanding stock, creating a beneficial capital allocation policy.

Some investors might shy away from owning Home Depot because of its macro sensitivity in recent quarters. However, the long-term outlook is still favorable. And this is certainly a much better value than if you bought Costco's stock.