2017 was a fantastic year for oil refiners. Many of the large- and mid-cap U.S. refiners, including Marathon Petroleum (MPC -0.69%)Valero Energy (VLO -1.01%), and Andeavor (ANDV), saw their shares rise more than 30%. Some stocks, like HollyFrontier (HFC), climbed more than 50%. Meanwhile, small-cap refiner Calumet Specialty Products Partners, L.P. (CLMT 0.94%) jumped an unbelievable 92.5% over the course of the year.

But with big gains come big questions: Was the growth justified? And is it likely to happen again in 2018? Let's look at the refining industry to see if the outperformance trend is likely to continue for some or all of these stocks.

An oil refinery at twilight

The stock market gave refining industry shares a big boost in 2017. Will the sector continue to outperform? Image source: Getty Images.

The crack spread

No, it's not a new sandwich topping: The so-called "crack spread" is the gap between the cost of crude oil and the selling price of refined fuel. The wider the crack spread, the more profitable it is to refine petroleum. And in 2017, the crack spread got very wide indeed as demand for refined petroleum increased while crude oil prices remained low. 

Of course, the crack spread can vary, depending on what refined products you're measuring and which crude oil spot price you're using. We're going to look at the "3:2:1 crack spread," which tries to approximate the product yield at a typical U.S. refinery: For every three barrels of crude oil the refinery processes, it produces two barrels of gasoline and one barrel of distillate fuel. We'll also use West Texas Intermediate Crude spot prices, which is one of the two standard prices used by U.S. refiners.

According to data compiled by accounting firm HSNO, in 2016, the 3:2:1 crack spread for WTI Crude was all over the place, ranging between $6 and $17 a barrel. The range was even wider in 2017, but its low end was about $8.20 per barrel in early March. But it went higher, hovering between $12 and $18 a barrel throughout the busy summer driving season. The Hurricane Harvey-related shutdowns of Gulf Coast refineries at the end of August then pushed it above $30 per barrel. Since Harvey, though, the crack spread has dropped as crude oil prices have risen and fuel demand has slackened with the onset of winter.

The demand equation

It's unlikely that a major hurricane would score a direct hit on the center of the nation's refining industry two years in a row. And with crude oil prices rising, the crack spread is unlikely to be as high in 2018 as it was in 2017. But the crack spread could rebound if demand rises faster than the price of oil. 

2017 saw a major boom in global demand for refined petroleum products. According to the International Energy Agency, demand increased in 2017 by 1.5 million barrels a day, or 1.6%. That growth is expected to continue by 1.3 million barrels a day in 2018. 

Meanwhile, in 2017, global output dropped by about 1.1 million barrels a day, thanks in large part to lower volumes from Russia and OPEC. It's a fluid (no pun intended) equation, and there's no telling exactly what will happen in 2018. But non-OPEC production -- which includes the U.S. and Canada -- has been rising and will probably continue to rise in 2018. 

U.S. refineries have been working at or near capacity to process all of that North American oil. Marathon even ran its refineries at 102% of capacity in Q3 2017, as did HollyFrontier in Q2. So it's unlikely that refiners can bump capacity much more than they did in 2017. 

What to expect

Obviously, it's impossible to know what's going to happen in the energy markets. In 2014 and 2015, many analysts predicted a quick rebound of oil prices, but that didn't happen. In early 2017, many predicted that $50-per-barrel oil was here to stay, but Brent Crude has since jumped above $6 per barrel. Plus, when you factor in OPEC production, federal trade policies (could a NAFTA revamp end cheap heavy crude from Canada?), demand, technology, and even the weather, we could see oil at $40 or $70 per barrel or the crack spread at $5 or $35 per barrel.

So let's instead look at the most likely outcome: Demand increases by a bit, supply jumps a little, refinery output remains at peak levels, and oil prices stay, on average, higher than they were in 2017. Those conditions would probably yield a smaller average crack spread than we saw in 2017. And that probably means that U.S. refiners aren't going to do as well in 2018 as they did in 2017, which means lower stock appreciation for U.S. refiners in 2018 -- although there's a lot of margin for error in those calculations.

Consider, too, that pretty much the entire U.S. refining industry saw stock gains in 2017 that well outpaced the market. With those gains already baked into the stocks, the likelihood increases that 2018's performance won't be as strong as 2017's.

Investor takeaway

None of this should suggest that U.S. refiners are poor investments. Because they make money on the crack spread -- and not, like drillers, from the cost of oil -- many, including Valero, Marathon Petroleum, and Andeavor, have seen big share-price gains since 2014. And because refiners tend to do well in years that drillers don't, buying into a refinery stock can help to balance an energy portfolio. Many refiners also pay dividend yields superior to those of independent oil producers, like HollyFrontier's 2.6% current yield or Valero's 3%.

Of course, not all refiners are created equal. Despite its 2017 rally, Calumet's share price is down 68.6% over the past three years, and it pays no dividend. So do your due diligence before buying any particular refiner's stock. 

Refining is definitely an industry worth considering, even factoring in 2017's share-price gains. But investors shouldn't buy in expecting 92.5%, 50%, or even 30% returns for a second year in a row. Modest growth seems more likely.