Safety is a relative concept on the stock market. Markets can and do drop quickly and without warning, and individual stocks will often fall even harder than the average during broad market slumps.

That's one reason why many investors like to have dividend stocks in their portfolios. Not only do these stocks tend to be more stable than their non-dividend-paying peers in periods of market volatility, but their steady payouts provide a buffer for your returns. You can take your dividends in cash or have them automatically reinvested so that you're picking up more shares when stock prices are down and fewer when prices are high. It's a win-win.

But which stocks should you pick when you're prioritizing low-risk investments? I'd start by considering two excellent options: Walmart (WMT -0.08%) and Microsoft (MSFT 1.82%).

1. Walmart

Walmart has a well-earned reputation for being a recession-resistant company. The world's biggest retailer sells consumer staples -- items like groceries and essential home goods -- that remain in steady demand even during tough economic times. Its massive scale allows it to market these items at attractive prices that appeal to value-conscious shoppers, giving competitors like Kroger little room to win market share from it.

These advantages helped Walmart boost sales by a robust 6% in its core U.S. market last quarter. This increase was powered by a healthy mix of rising customer traffic and higher average spending. Contrast that result with Target, which reported a 5% sales decline in Q2.

Walmart is also becoming more profitable, partly thanks to cost cuts and reduced inventory holdings. Sure, the chain isn't likely to significantly increase its operating profit margin of about 4% of sales. But even small increases make a huge difference on a $600 billion annual sales figure. Its yield at the current stock price is a modest 1.4%, but management has boosted its dividend annually for 50 consecutive years, and it's highly likely to keep that streak going in the decades to come.

2. Microsoft

Tech stocks aren't typically considered ultra-safe, but Microsoft is an exception. The software giant has a massive sales footprint that exceeded $200 billion in its most recent fiscal year (which ended June 30). That revenue came from diverse revenue streams that span productivity software, cybersecurity, video games, and enterprise cloud services. Several of these niches expanded even as a few contracted into early 2023, helping keep overall sales rising. In the most recent quarter, revenue was up 8% (10% on a constant-currency basis) while operating income landed at $24.3 billion, or over 43% of sales.

Shares don't look especially cheap right now. Wall Street is excited about the coming artificial intelligence (AI) boom, and for Microsoft, investors are optimistic about the potential for this emerging technology to boost the value of its platform, supercharging growth and earnings in the process.

But income investors can focus on the more concrete parts of the business, like Microsoft's cash holdings of over $111 billion and the $88 billion of operating cash flow that the company generated over the last year.

Microsoft recently announced its second consecutive 10% annual payout hike, and the figures above support the conclusion that there will be many more dividend increases ahead. Like Walmart, this stock's yield at its current share price is about 1%. Patient investors can expect to see that dividend march steadily higher as Microsoft capitalizes on its leadership position in key software and hardware niches in the coming years.