The last three years have been very exciting for energy stocks, with deep declines and massive rallies. The driving force, as always, has been the inherent volatility of energy prices. This is actually normal, not unusual. Which brings up the ongoing question: Is now the time to buy oil stocks?

A reason to be wary about oil stocks

If you are looking at oil stocks there's a very good reason to be fearful. In simple terms, what goes up eventually comes down in a cyclical industry like energy. And with the world potentially on the brink of a recession, demand for oil could end up falling in very short order. That would put downward pressure on oil prices, which have run up dramatically since their pandemic-driven lows in 2020. That period, however, is important to understand because it was marked by a rapid decline in demand, which is what a recession would also lead to. 

A person in protective gear with pipes and a drilling rig in the background.

Image source: Getty Images.

The risk here was recently put on display when Pioneer Natural Resources (PXD -2.28%) cut its oil-linked dividend by 33%. Pioneer isn't a bad company, but the ups and downs of oil prices have a direct impact on the dividends it pays and the most recent payment proved that oil prices don't go up forever. If there is a recession, expect oil-linked dividends across the energy patch to plunge. That will likely be the case with oil stocks, as well.

Then there's the issue of the clean energy transition that's taking shape. Investors interested in environmental, social, and governance (ESG) issues are clearly against less-than-clean energy companies like oil producers. That negative sentiment isn't going to change anytime soon, particularly as the longer-term impacts of global warming become more and more apparent. That's a headwind for the business and for investor sentiment, which will likely increase volatility in the sector.

Safety first if you buy oil stocks

Those big-picture issues, however, probably shouldn't keep long-term investors on the sidelines. Notably, if you are looking to create a diversified portfolio, having some exposure to the energy sector is a good idea. And, despite the concerns about the clean energy transition, it is likely to be a multi-decade effort, so there's no immediate worry that oil will become obsolete. That said, you should tread with caution.

Most investors will likely be best off sticking to the largest and most diversified names in the sector, including integrated energy giants like ExxonMobil (XOM -2.78%), Chevron (CVX 0.37%), Shell (SHEL), and TotalEnergies (TTE 1.10%). Integrated energy companies have assets that span from drilling to pipelines to refining. Although oil tends to drive top- and bottom-line results, the broad portfolios here help to attenuate the often large performance swings the energy sector is known for.

Exxon and Chevron largely remain focused on producing oil and oil-related products (like gasoline). They are, thus, the more direct plays on energy prices. Shell and TotalEnergies both started to shift more aggressively toward clean energy. Though green energy is still a modest portion of each company's business, both are working hard to ensure their long-term position in the global energy mix via growing clean energy businesses. 

All four of these companies offer generous and growing dividends. Exxon and Chevron have multidecade increase streaks going, which makes them stand out for dividend consistency. Shell cut its dividend at about the same time that it started to shift aggressively toward clean energy, but the dividend is back in growth mode. TotalEnergies didn't cut its dividend when it made that shift, but dividend growth hasn't been nearly as robust as Shell's. All four companies, meanwhile, are fairly cautious ways to play the oil industry.

A time to worry

It is impossible to determine which direction oil prices are going to head from here. Further global tensions could lead to a huge price spike while a recession could push prices sharply lower. But what is clear is that oil is fairly expensive today and the bigger risk is likely to the downside. In that environment, if you are going to buy an oil name, erring on the side of caution is probably the best option. Exxon and Chevron are good options on that front if you want to focus as much as possible on oil while Shell and TotalEnergies are solid choices for those that want to hedge their bets with a little clean-energy exposure.