With all three major U.S. indexes trading near all-time highs after posting solid gains in recent months, some investors are getting increasingly wary about investing in stocks right now. While a few stocks can no doubt prove risky at such lofty valuations, there are several "safe" ones that should help you sleep through volatility and safeguard your capital in the long run regardless of where the markets are.

With that in mind, three of our contributors have identified International Business Machines (IBM 1.05%)Procter & Gamble (PG 0.68%), and Illinois Tool Works (ITW 0.45%) as safe stocks you can consider today. Here's why.

Value, growth, and income

Tim Brugger (IBM): Considering its stock price is up 15% over the past year, IBM may not be the first name that comes to mind as safe. However, despite its solid year, IBM has all the makings of what makes a relatively safe stock: It's undervalued, has strong growth potential, and possesses a dividend yield that's one of the best in its sector.

A "Risk" dial pointing at "Minimum."

Image source: Getty Images.

CEO Ginni Rometty is laser-focused on IBM's "strategic imperatives," which include the cloud, cognitive computing, mobile, and data security, and it's paying off handsomely. IBM acquired a total of 15 companies last year, most of which were designed to bolster its strategic imperatives offerings.

Last year, IBM generated $79.9 billion in total revenue, down 2% year over year. Thing is, $32.2 billion of those sales were from IBM's strategic imperative units, led by a whopping $13.7 billion in cloud-related revenue. Rometty set a target a few years ago of driving 40% of revenue from strategic imperatives sales by 2018. Last year's impressive gains in those key areas equaled 41% of total revenue, meaning IBM's transformation is a year ahead of its self-imposed schedule.

As for value, IBM is currently trading at a minimal 14-plus times earnings, which is on the low end compared to its peers. The better news is that IBM stock is valued at just 12 times forward earnings, making it one of the least expensive tech stocks around. Add to that a 3.2% dividend yield and IBM is hands-down one of the safest stocks to buy right now. 

Essential products and a great dividend

Keith Noonan (Procter & Gamble): When it comes to safe and dependable stocks, I'm a fan of companies in the consumer essentials space that are backed by strong brands and great dividends. Procter & Gamble is a standout on both of those fronts, and, even trading at roughly 23 times forward earnings, it still looks like one of the safest stocks on the market.

P&G has a wealth of products and brands that make its business well-equipped for managing economic volatility. During periods of economic stress, people will naturally cut back on spending, but the need for cleaning and hygiene products is likely to remain relatively consistent, and the company's stable of trusted brands should help it retain customer loyalty even if purse strings tighten. P&G makes category-leading products including Crest toothpaste, Tide detergent, and Bounty paper towels, and it currently has 22 brands that generate over $1 billion in annual retail sales.

On the returned income side of things, P&G boasts an attractive 3% yield and one of the best dividend histories of any company on the market. It's raised its payout for sixty years running, so it's reasonable to expect that the company will continue increasing and distributing its payout even if economic conditions take a turn for the worse. Dividend-paying stocks help to insulate an investment portfolio against downward volatility by providing reliable income generation, and few companies have better dividend profiles than P&G.

With its great product lineup and strong dividend, Procter & Gamble looks like one of the safest stocks you can buy.

Diversification and safe returns

Neha Chamaria (Illinois Tool Works): If you're looking to buy a safe stock today, I'd urge you to give serious thought to industrials heavyweight Illinois Tool Works.

Illinois Tool Works is neither a purely defensive nor a purely cyclical company. It's a conglomerate with a hugely diverse portfolio that comprises seven business segments: automotive OEM, food equipment, welding, test and measurement and electronics, polymers and fluids, construction products, and specialty products. As you might've guessed, the company serves several key industries, and it is this diversification -- though the company has simplified its business structure considerably in recent years -- that has helped Illinois Tool Works keep its head above water even during recessionary periods, pushing its earnings and share price higher all along. That's exactly what you'd expect out of a "safe" stock.

ITW Normalized Diluted EPS (TTM) Chart

ITW Normalized Diluted EPS (TTM) data by YCharts.

To top that, Illinois Tool Works has an incredibly strong dividend history, having increased its dividends every year for more than five decades now. Thanks to a hefty 18% hike last year, the company has now grown its dividends at a compounded average clip of 14% since 2012. Having a stable dividend to fall back on is great during volatile times.

In fact, management even issued a growth guideline for all kinds of economic scenarios recently, where it expects its organic growth to be at least 200 basis points more than the market and total shareholder returns to be within a range of 8%-10% even in a low-growth environment. That's the kind of security investors need in today's uncertain times.