Walmart (WMT -0.08%) and Home Depot (HD 0.94%) don't directly compete for shoppers, but they share many similarities as investments. They are both leaders in their respective retailing niches, for one, and tend to show steady market-share gains with each passing year. Shareholders' returns are also boosted by significant dividend and stock buyback spending as well.

But which stock is a better fit for your portfolio at these prices? Let's dive right in.

Walmart is more stable

Home Depot's business expands more quickly during economic boom times, as you might expect given its smaller revenue footprint and the chain's focus on the volatile home improvement industry. Comparable-store sales jumped 11% in 2021 as shoppers spent their rising incomes aggressively. Walmart grew at a 7% rate, by comparison.

The flip side of that performance is that you'll get more stable growth from owning Walmart stock. Even though consumers are spending less on merchandise these days, comps were up 6% in the just-concluded fiscal year. Home Depot reported a 4% decline. If your priority is predictability and low-risk growth, then Walmart will better satisfy your investing criteria.

Home Depot can keep winning

Walmart doesn't hold a candle to Home Depot when it comes to earnings power. Sure, profits declined by 10% this past year due to the softening home improvement market. But the chain still converted over 14% of sales into operating profit compared to Walmart's 4% rate.

WMT Operating Margin (TTM) Chart

WMT Operating Margin (TTM) data by YCharts

Both companies are highly efficient cash generators. Home Depot's operating cash flow jumped to $21 billion from $15 billion in 2023. Walmart grew its comparable figure by $7 billion to a cool $36 billion. Cash-focused investors won't be disappointed, in other words, with either stock.

Cash returns and price

Cash returns favor Home Depot, which sends more money to its shareholders through a combination of stock buybacks and dividends. The home improvement retailer also pays a bigger initial dividend yield and has hiked that payout more substantially over the last several years.

One understandable knock against Home Depot is that it doesn't have a particularly impressive track record of steady dividend raises. Management paused its annual hikes during the worst of the Great Recession and so the chain can only claim fewer than 20 years of consecutive increases. That's well below Walmart and rival Lowe's Companies, which each qualify as Dividend Kings due to their 50-plus years of annual boosts. 

Home Depot is also expecting a second straight year of weak earnings growth ahead in 2024. There's little danger of another imminent dividend pause in that case. Still, the chain might announce unusually small annual increases in 2025 and into 2026 if the housing market doesn't rebound.

Walmart is priced at a more tempting valuation, meanwhile. Its shares will cost you around 0.75 times sales, which is lower than peers like Target and Costco Wholesale. Home Depot trades at 2.4 times sales, which is near its post-pandemic high and well above Lowe's price-to-sales ratio of 1.5.

These factors mostly point to Walmart as the better stock to buy today. But investors have to weigh the main benefits (stability, value) against the biggest drawbacks (lower profitability and cash returns). Walmart will deliver acceptable returns for most investors through the widest range of selling conditions. If you're a fan of high dividends and don't mind volatility, though, then you might want to take a closer look at Home Depot.