There aren't many retailers that can consistently deliver steadily rising dividends through the ups and downs of the economic cycle. That success requires sufficient scale, prime market positioning, and a management team that's committed to efficiently allocating capital. But even with these factors present, some retailers struggle to keep up with those annual dividend hikes.

Walmart (WMT -0.08%) and Home Depot (HD 0.94%) aren't in that category of struggling retailers. Even though parts of their business saw demand pressures in recent quarters, they've maintained impressive profitability and cash flow while continuing to attack their growth initiatives.

Income investors will find a lot to like about both businesses, but let's compare the two to see which would make the better dividend stock to buy right now.

Growing in a hard environment

Walmart is faring better in the current economic environment that's seeing demand tilt toward consumer essentials in 2023. Sales growth was a healthy 6% last quarter and was driven by a balance between higher customer traffic and increased spending online and at its stores. Home Depot, on the other hand, reported a 2% sales decline in mid-August as management cited "continued pressure in certain big-ticket, discretionary categories."

Two other factors put Walmart in the lead when it comes to expectations around growth in the short term. The retailer is beating peers on the core comps metric, for one, including Target and Costco, suggesting it is well positioned to capture market share as shoppers look for savings.

Second, Walmart is raising expectations for the fiscal year while Home Depot's outlook has held steady. The retailing giant said last month that sales should rise by between 4% and 4.5% this year, up from the prior forecast of 3.5%. Home Depot affirmed its guidance calling for declines of between 2% and 5% this fiscal year.

Cash returns and profits

The picture is more mixed when it comes to cash and profits. Home Depot is far more profitable, even considering the current weak demand environment. Operating profit margin is on pace to stay above 14% of sales this year, compared with Walmart's roughly 4% rate. Home Depot's success here helps explain why its dividend payout is bigger. The yield sits above 2.5% today, while Walmart's rate is 1.4%.

Walmart's cash flow is improving quickly, though, suggesting shareholders could see more aggressive dividend increases in 2024 and beyond. And the retailer has a longer streak of payout raises, with 50 consecutive ones under its belt. Home Depot had to pause its raises during the sharp pullback in the home-improvement industry that started in 2007. Its dividend has been growing for 15 consecutive years.

The final takeaway

If you can stomach the lower yield, then Walmart will be the better option as an all-around dividend stock. It offers a balance between recession-resistant earnings and the potential for more capital gains as the retailer continues winning market share while boosting profitability in 2023 and beyond.

Home Depot, meanwhile, will appeal to investors who don't mind taking on more risk in hopes of seeing stronger growth in future years. The home-improvement industry won't remain in a downturn forever, and there are major factors supporting the market's growth runway, including an aging housing stock in the U.S. and a flood of millennials likely to form new households in the next few years. "We remain very positive on the medium-to-long term outlook," Home Depot executives told investors in August.

In either case, choosing to automatically reinvest your dividends, for both Home Depot and Walmart stocks, is a great way to amplify returns while ensuring that you're steadily accumulating shares of these high-quality income investments.