Even after the stock market's rally the past few weeks, 2022 has been a horrible year for most investors. And it's quite possible things could take a turn for the worse again. Inflation is at 40-year highs, gasoline prices are still well above $4 per gallon, the housing market is starting to fall, supply chains remain snarled, and inventory levels remain high. The U.S. economy has contracted for two consecutive quarters (the commonly accepted -- though unofficial -- definition of a recession).

Smart investors want to play it safe. That means seeking out dividend stocks, which tend to outperform stocks that don't pay a dividend even when the market isn't in turmoil. Yet in the short term, even the best stocks can lag behind, which gives investors a great opportunity to pick up shares of a quality company at a discount.

The following pair of safe dividend-paying stocks have been left behind by the market, performing even worse than the broad index. It's a unique chance to buy them and realize the long-term gains they'll eventually generate, while enjoying a steady stream of income in the meantime.

1. Illinois Tool Works

It's not like Illinois Tool Works (ITW -0.20%) is unknown, as dozens of Wall Street analysts cover the stock, but it still flies under the radar of many investors. That's likely because it's not a sexy, fast-growing tech stock, but rather a slow and steady business. It serves the automotive, food service, and test and measurement sectors, along with welding, polymers and fluids, construction, and specialty products industries. 

None of those are particularly exciting, and they also indicate why Illinois Tool Works' stock is down 16% this year at Wednesday's prices: In recessionary times, orders decline, and this stock reflects the general mood.

Still, it tends to remain very profitable throughout downturns, and because its products are so crucial to businesses across broad swaths of the economy, it inevitably leads to significant gains in the years afterward.

Illinois Tool Works pays an annual dividend of $4.88 per share that yields 2.4% at recent prices. It's been in business for over 100 years, and it has increased its dividend for over 50 straight years, making it a Dividend King. While there could be near-term challenges to overcome, Illinois Tool Works' long-term story remains intact, and weakness in its stock should be viewed as an opportunity to buy.

2. Stanley Black & Decker

In a very similar situation is Stanley Black & Decker (SWK 0.03%), another company whose history stretches back well more than a century -- and one that has paid a dividend for 145 years. It has also steadily increased the payout every year for the last 57 years, putting it in that same elite group of Dividend Kings.

Over those years, Stanley has evolved into a premier hand-tool and power-tool company, amassing a portfolio of brands familiar to every homeowner and professional. Beyond the Stanley and Black & Decker brands (the two companies merged in 2009), it also owns DeWalt, Porter-Cable, Bostitch, Mac Tools, Irwin, Proto, and Craftsman. In December, it acquired MTD Products, which makes a line of outdoor power tools.

Less well known to the layperson is that Stanley also has a significant presence in the industrial and healthcare markets. It produces engineered fasteners for the aerospace and oil and gas industries, infrastructure components for roads and bridges, and systems to monitor elderly patients to detect wandering and falls. 

Stanley just reported earnings last week that missed on the top and bottom lines, and the toolmaker cut its guidance for the year because, like Illinois Tool Works, it also feels the effects of a slowing economy. That's helped send the stock down roughly 50% this year.

Yet Stanley also has remained profitable during these downturns, and its dividend (which yields about 3.3% as of Wednesday's prices) is in no danger of being cut. With a payout ratio of 51% -- meaning just over half of net income goes to paying the dividend -- there's plenty of room for Stanley Black & Decker to give more cash to shareholders, just as it has for more than a half-century.