Back

How an oil refinery works

260 points9 hoursconstruction-physics.com
tolerance6 hours ago

Instantly I'm reminded of "That Time I Tried to Buy an Actual Barrel of Crude Oil"

https://news.ycombinator.com/item?id=43761572

https://archive.is/kLFxg

Which leads to "Planet Money Buys Oil"

https://www.npr.org/sections/money/2016/08/26/491342091/plan...

diginova5 hours ago

My father actually works at the Jamnagar refinery. I was bought up in there seeing and visiting the refinery as families are allowed for some trips every now and then. I learnt a lot of this process of refining out of curiosity of what my father did and it was just so cool. The refinery in context is the world's largest since more than a decade and seeing it with your own eyes, it feels like a wonder of the world for real. Truly marvellous outcome of perseverance and engineering. Loved to see this blog on the HN homepage, its very well written

alephnerd4 hours ago

Would love to hear stories about it. Reliance is working on replicating the Jamnagar refinery approach in America [0] now as well.

It's interesting to both see Asian majors and EPCs increasingly dominating the petrochemical chain as well as see an industry that the US used to lead in increasingly become dependent those partners.

What a massive shift in just 25 years.

[0] - https://www.bloomberg.com/news/articles/2026-03-11/reliance-...

didgetmaster3 hours ago

I remember driving by a refinery years ago and it had two or three towers with big flames that were just burning off waste gas. This seemed wasteful to me. If it can burn, then it seems like it could be used for something productive.

Do they still just burn off that gas?

sushibowl3 hours ago

Usually, when refineries flare something like that it's because what they are burning is not suitable for use, and making it suitable would cost more than the product would sell for.

Often methane as a by-product of oil production is flared, because the amount is small enough that it's not worth setting up processing plants and supply chains for. Other times, the fluid is heavily contaminated by e.g. sulfur compounds, and would be costly to purify. Still other times the production of the fluid is unreliable or intermittent, and cannot sustain a continuous production process.

Although, flare gas recovery systems exist nowadays to make use of these waste gases, commonly for local power production for the refinery itself.

deepsun2 hours ago

That's why plastic bags are so cheap -- ethanol is a byproduct, but you earn more if you discard it and sell only oil.

But the burned up ethanol would be perfectly suitable for products.

Nowadays there are some regulations to prevent that, so they may sell up ethanol at negative prices sometimes.

the-grump3 hours ago

It's usually a small amount of waste, and handling gas is very different from distillate.

You'd need to either liquify that gas or collect it to a pipeline in order to make it useful. I remember reading that modern refineries make use of the gases instead of flaring them though I'm not sure how.

JohnKemeny2 hours ago

They flare to quickly burn off excess gases as a safety mechanism rather than anything else. Venting gas into the air would be much worse.

chasd003 hours ago

the way it was explained to me is if you see the flares then something is wrong. It may not be catastrophic or anything serious but something isn't going according to plan. Because you're right, why burn it off when you can sell it?

t_tsonev8 hours ago

The article is quick to point out the huge role of oil in the modern energy mix. It also fails to note that most of the energy ends up us waste heat. The so called "Primary energy fallacy". Other than that, it's a great read.

nerdsniper7 hours ago

To me (as someone who has worked on oil rigs, oil pipelines, oil refineries, and chemical plants), crude oil seems far more valuable as a material than as an energy source. It feels like a damned shame that we're still combusting so much of it for heat rather than reserving it for physical materials.

I understand the ways that economics are very important, and that the economics still currently favor burning a large fraction of the crude oil. But I also know that the right kinds of investments and a bit of luck can often change those economics, and that would be nice to see.

whatever16 hours ago

We can always make polymers and HydroCarbons in general from other sources if we have energy abundance. We literally can just capture the CO2 we emitted from burning fossil and make it plastics.

Of course this does not make sense in a world where we do not have enough energy to even keep datacenters open.

Edit: To clarify, I do not propose burning fossils to capture CO2 and make plastics. I am a Thermo Laws believer.

throw0101c7 hours ago

> It also fails to note that most of the energy ends up us waste heat.

I've heard the statistic that 40% of the total oil pumped out of the ground just to transporting oil. We use almost half just to move it to and fro before even using it.

Is this accurate?

jml7c55 hours ago

I suspect this is confusion between the statistic that 40% of global shipping traffic is transportation of fossil fuels.

https://qz.com/2113243/forty-percent-of-all-shipping-cargo-c...

dmurray5 hours ago

This can't be accurate.

Let's say a barrel of oil travels 15,000 km from Saudi Arabia to Texas, gets refined, gets shipped another 10,000 km to Europe, then the last 1,000 km overland by truck.

This reasonably well sourced Reddit post [0] says big oil tankers burn 0.1% of their fuel per 1,000 km, smaller ones a bit more. Say 0.2% on aggregate, that's 5% for the whole journey, 10% because the ship is empty half the time.

From the same source, a truck burns about 3% per 1,000 km. This seems too high: for a 40,000 kg loaded truck that's less than 1 kmpl or 2.5 mpg. But let's believe it, double it for empty journeys, and we still only get 16%.

I used very conservative estimates here: surely most oil doesn't travel anywhere near that far.

Alternative thought experiment: look at the traffic on the highway. If this were true, even neglecting oil burnt for heating or electricity or aviation, you'd expect 40% of the vehicles to be tanker trucks.

[0] https://www.reddit.com/r/explainlikeimfive/comments/2jozd7/e...

sokoloff4 hours ago

> you'd expect 40% of the vehicles to be tanker trucks.

I’d expect tanker trucks to carry far more fuel than the typical vehicle.

foota5 hours ago

This doesn't math out to me just based on what I know of energy consumption numbers.

matkoniecz5 hours ago

Sounds really dubious to me. Tankers and pipelines are really efficient.

I would not believe it at all without source.

Maybe someone got confused by "transportation" altogether being major consumer?

testing223215 hours ago

It must be way higher if you really got into it

i.e. A friend that works on rigs is flown to and from rigs from anywhere on earth every month, then choppers out to the rig and back. Same for everyone that works on the rigs.

matkoniecz5 hours ago

And? Given how much typical oil rig produces this would not be a serious part of its production.

tmellon28 hours ago

[flagged]

shhsshs8 hours ago

As someone with no real-world petrochemistry experience, but much gaming experience, I was very surprised how familiar the crude oil processing diagram looks. Factorio and GregTech are two prime examples of fairly realistic oil processing lines (probably as accurate as any game would reasonably try to be).

FumblingBear7 hours ago

I was thinking the same thing! Having played through Factorio and a fair amount of GregTech really reframed my viewpoint on energy production that a huge part of the benefit of fossil fuels is the byproducts, not just raw energy output.

triceratops6 hours ago

All the more reason to save fossil fuels instead of burning them for energy.

yread6 hours ago

I find it amazing how "naphtha" can mean crude oil, diesel, kerosene, gasoline or kind of white spirit.

EDIT: oh and it comes from Akkadian! how many Akkadian words do you know?

didgetmaster7 hours ago

The article does a good job of showing how a typical barrel of oil is converted into a dozen or more distinct usable products.

It would be helpful to also have a chart that shows how much gasoline or diesel as a percentage of each barrel is produced. It would be a bit variable, since not all crude oil is the same, but I think it would be close for most of it.

Some people think when diesel and regular gas prices diverge, that they should just be able to produce one at the expense of the other; but the distillation process shows that they are fundamentally different.

kryptiskt7 hours ago

You can to vary the split of the output by cracking heavier hydrocarbons into lighter. So it's not a fixed fraction, but driven by both demand and cost of processing.

icegreentea26 hours ago

Some crude averages from https://www.eia.gov/energyexplained/oil-and-petroleum-produc...

~50% gasoline, ~25-30% diesel.

noer7 hours ago

If you're interested in how the oil industry as a whole operates and why, Oil 101 is an interesting read.

balderdash5 hours ago

Highly recommend

jmyeet9 hours ago

This is a really good overview of oil refining. I'll add a few things.

1. The light and heavy distinction is covered by a measure called API gravity [1]. The higher the API gravity, the lighter the crude;

2. Refiners mix different crude types depending on what kind of refined products they want to produce;

3. Heavy crude tends to be less valuable although it's essential for some applications. Lighter crude produces generally more valuable products like gasoline, diesel and avgas. But heavy crude goes into construction (eg roads) and fuel for ships (ie bunkers));

4. Most refineries in the US are very old and are very polluting. They don't need to be this way. A new refiner would produce vastly less pollution but they're almost impossible to get permission to build now. One exception is the Southern Rock refinery currently being built in Oklahoma [2], which will be powered by largely renewable energy and produce a lot less emissions than an equivalent older refinery with the same capacity;

5. There are different blends of gasoline that the US produces. The biggest is so-called summer and winter blends. What's the differene? Additives are added to summer blends (in particular) to increase the boiling point so less of the gasoline is in gas form because that produces more smog;

6. California uses their own blends so in 2021-2022 when CA gas went to $8+, it wasn't just "gouging". It doesn't really work that way. CA requires a particular blend that only CA refineries produce so it's simple supply and demand as no new capacity gets added to CA refineries and demand goes up with population growth.

The reason for the CA blend goes back to the 80s and 90s when smog was a much bigger problem. Better vehicle emissions standards since then as well as improvements in the blends the rest of the country uses have largely made the CA blend obsolete so CA is really paying $1+/gallon more for literally no reason; and

7. California doesn't build pipelines so is entirely dependent on seaborne oil imports (~75%) despite the US being a net energy exporter. Last I checked, ~20% of that foreign oil comes through the Strait (from Iraq, mostly) so, interestingly, CA is more vulnerable to the Strait of Hormuz closure than the rest of the country.

I guess I'll add a disclaimer: I'm very much pro-renewables, particular solar. I think solar is the future. But we currently live in a world that has huge demand for oil and no alternatives for many of those uses (eg diesel, plastics, construction, industrial, avgas) so we should at least be smart about how we go forward.

[1]: https://en.wikipedia.org/wiki/API_gravity

[2]: https://www.oklahoman.com/story/news/2023/05/24/5-6-billion-...

flumpmaster2 hours ago

A few corrections. Credentials: I am a Chemical Engineer in a Senior Tecnical Leadership position at a refinery with over thirty years of experience.

1) API gravity is the density of the crude oil. Higher API = lower density. We use this unit of measure because it magnifies the differences in densities vs. using conventional units of measure.

2) Refiners in the US mix different crude types to maximize the objective function ($) of a set of constraints including crude grade pricing and availability, product demand volume and pricing, refinery unit constraints and product quality specifications. This is done using a linear program model.

3) light and heavy crude contain the same molecules but in different ratios. For example they all contain gasoline, jet fuel, diesel boiling range material and all contain some amount of material that could be turned into ship fuel or asphalt for paving roads. Heavy crude tends to sell at a discount to light crude because of the laws of supply and demand - refiners will buy a mix of whatever makes them the most money.

4) “Most refineries in the US are very old and are very polluting”While US refineries sites are old - some site have been in operation for over 100 year, the units and configuration of the refineries has evolved continuously over the years. The technology used in the refining units has evolved as well - this is not a static industry. The pollution standard for refinery operations and fuel emissions have been raised multiple times. So “Very Polluting” vs. new refineries does not pass muster. US refineries have been retrofitting wet gas scrubbers and selective catalytic reduction units to reduce emissions of SOx and NOx for decades. These technologies reduce emissions of both pollutants by over 90%. Most of the emissions come from burning the fuel that refineries produce and both legacy US refineries and new ones have to meet the same fuel quality specifications and hence produce equivalent emissions.

5. “There are different blends of gasoline that the US produces. The biggest is so-called summer and winter blends. What's the differene? Additives are added to summer blends (in particular) to increase the boiling point so less of the gasoline is in gas form because that produces more smog;”

Summer gasoline contains less butane than winter gasoline. That is the main difference. Butane is added to winter gasoline so cars start in cold weather. There are no additives added to raise the boiling point in summer - just less volatile light material added.

As an aside, Mvodern gasoline vehicles have carbon canisters to capture vapors (such as butane) from the gas tank when not in service. These are then regenerated by sweeping air through them when the vehicles are running.

6. “ California uses their own blends so in 2021-2022 when CA gas went to $8+, it wasn't just "gouging". It doesn't really work that way. CA requires a particular blend that only CA refineries produce so it's simple supply and demand as no new capacity gets added to CA refineries and demand goes up with population growth. The reason for the CA blend goes back to the 80s and 90s when smog was a much bigger problem. Better vehicle emissions standards since then as well as improvements in the blends the rest of the country uses have largely made the CA blend obsolete so CA is really paying $1+/gallon more for literally no reason;”

There is some out of date information here. California is a net importer of gasoline since refinery closures in California have outpaced reduced demand from increased fleet fuel efficiency / BEV adoption. There are refineries in Asia that export California and some other US refineries can also make California grade gasoline but this requires shipping via the Panama Canal on Jones act ships that are scarce and expensive.

P66 / Kinder Morgan are planning a pipeline / pipeline reversal that would bring refined product into California including California gasoline.

criddell8 hours ago

Looking at the chart in the article I was kind of surprised at how small wind and solar are globally and that coal is still ~25%.

ufmace4 hours ago

I believe that it's a physical plant thing. We have spent over a hundred years building hydrocarbon-based energy infrastructure. Much of that is still out there. Wind and solar have made a ton of progress in the last 15 years or so, but it's only really become substantially better financially in the last 5 or so years maybe. It's still going to take decades to actually replace most of that stuff, just as a matter of how fast we can build and install hardware.

Note also that it's a worldwide chart, so it includes developing countries that may not be so quick to jump on projects that are expensive right now even though they'll save a bunch of money in the long term. Though to be fair, some may have a leapfrog effect when it comes to building brand new infrastructure.

dylan6043 hours ago

I would like to think that the switch to renewables is inevitable, but could a continuous series of administrations similar to the current US admin be enough to curtail it?

rollulus8 hours ago

That’s because of the primary energy fallacy: https://medium.com/@jan.rosenow/have-we-been-duped-by-the-pr...

TL;DR: the efficiency of converting fossil energy resources into something useful is poor.

criddell7 hours ago

That chart is measuring joules of energy. I'm not sure efficiency comes into play here, does it?

Coal provides 175,000,000 TJ of energy. Solar and wind provide 21,000,000 TJ.

I was mostly surprised at how critical coal still is.

https://www.iea.org/world/energy-mix

gpm6 hours ago

The problem is where it's measuring joules of energy. To use cars as an example:

It measures joules of energy as in "how much heat the gasoline we burn produces", some of which we convert to mechanical energy to drive the car, but the majority is just waste heat going out the tailpipe.

By comparison an electric car powered by solar has no tailpipe. There's still a bit of waste heat from electrical resistance, but nowhere near as much.

If we measure like this, by converting a gasoline car to electric (powered by solar for the sake of ignoring some complexity), and driving the same distance, we somehow managed to cut our "energy demand" in half. Despite the fact that we're demanding the exact same thing from the system.

If we measured "joules delivered to the tires of the car" we wouldn't have the same issue. At least until someone starts arguing about how their car is more aerodynamic so joules delivered to the tires should count for more in it.

Edit: We could also go in the other direction. Instead of reporting it as 1kw of solar energy (electricity) it could be 4kw of solar energy (the amount of sunlight shining on the solar panels)... No one does this for obvious reasons, but it's more similar to that primary energy number for fuel in many ways.

icegreentea26 hours ago

The total energy supply figure is a primary energy mix - for the fossil fuels it represents the thermal energy of the fuel. You can look at the final energy consumption section a bit lower to get a different picture taking into account conversion losses.

+1
jeffbee6 hours ago
vel0city8 hours ago

> they're almost impossible to get permission to build now

While I do agree there's a ton of regulatory hurdle to cross to build a new refinery, lots of interviews with oil executives have stated the economics of building a new refinery aren't always great. The reasons why they aren't building isn't necessarily because the regulatory hurdles are too high, its that they don't think they'll end up making any money building them. The future demand of many refined products are uncertain, adding a lot of new capacity is quite a capital risk.

I'd love to see a lot of our ancient refineries shut down and replaced with far more modern designs, but the oil industry isn't going to do it because it probably won't be profitable.

It will be interesting to see the economics of these few new refineries coming online actually play out in the coming years.

jmyeet7 hours ago

Well-meaning legislation (eg CEQA in CA) is effectively weaponized by NIMBYs who have outsized power to add years if not a decade or more to something getting built. There is also an overly naive, even performative opposition to anything fossil fuel related without having a substitute (again, I say this as a particularly pro-solar person). This adds significantly to costs.

I'm also anti-nuclear because it's too expensive, not as safe as advocates make out and the waste problem is not even remotely solved despites all the claims to the contrary. But it's also true that the same kind of anti-development tactics used against refineries are effectively used against nuclear plants such that it takes 15+ years to build a nuclear plant and the costs balloon as a result.

But there's also strong direct evidence contrary to your claim: the new refineries in Oklahoma and Texas. Why are they getting built if "the oil industry isn't going to do it"?

I'll go even further than this: if private industry won't build new refineries, the government should. In fact, that's my preferred outcome anyway.

doctorpangloss7 hours ago

> if private industry won't build new refineries, the government should. In fact, that's my preferred outcome anyway.

maybe in some non-literal sense of financing them, which is what the government can (or will) offer to energy development generally. also there are numerous credits and tax favors for energy concerns.

on the flip side, how much demand for oil products is driven by ordinary consumers? some estimates say about 40% of extracted oil - it all eventually get refined, right? so the refining distinction is meaningless - in the US is refined into gasoline that goes directly into light duty vehicles (90% of all gas is light duty!), i.e., joe schmo public driving around.

if you are looking for government levers, your instincts seem right to reach for CEQA and NIMBYs. in the sense that you are looking at the bigger picture at A level of abstraction, but i disagree it is the right level of abstraction. fundamentally US oil consumption (and therefore refining) is about the car lifestyle, which is intimately intertwined with interest rates, because interest rates decide, essentially, how many americans live in urban sprawl and are obligated to use the car lifestyle as opposed to being able to choose.

so your preferred outcome, if we take it to its logical conclusion is, a non-independent fed. and look, you are already saying some stuff that sounds crank, so go all the way. the US president is saying a non-independent fed! it's not a fringe opinion anymore. but this is what it is really about. the system has organized itself around the interest rate lever specifically because it is independent, so be careful what you wish for.

vel0city7 hours ago

> the new refineries in Oklahoma and Texas.

Two truly new refineries in 50 years despite lots of growth of demand throughout most of those decades. The fact there's only been two in fifty years and neither is anywhere near operational is proving my point. These are largely aberrations compared to the last fifty years, and its extremely notable the larger one is being built largely by a foreign oil company wanting to diversify internationally. It hasn't even broken ground yet and you're acting like its already here.

> if private industry won't build new refineries, the government should.

Personally I'd prefer our tax dollars to be spent feeding our kids and providing healthcare instead of continuing to give handouts to billionaires, but hey lots of people have different opinions.

+1
bluGill5 hours ago
cucumber37328427 hours ago

>While I do agree there's a ton of regulatory hurdle to cross to build a new refinery, lots of interviews with oil executives have stated the economics of building a new refinery aren't always great. The reasons why they aren't building isn't necessarily because the regulatory hurdles are too high, its that they don't think they'll end up making any money building them. The future demand of many refined products are uncertain, adding a lot of new capacity is quite a capital risk.

This is a circular statement.

The regulatory hurdles are a large part of what drive cost.

I know a venue that wants to pave a dirt lot so they can better use it for stuff. It doesn't pencil out because of stupid stormwater permitting crap that'll add $250k to the project. It'd never pay off in a reasonable timeframe. So it just continues to exist in its current grandfathered in capacity when even the most unfavorable napkin math shows that what they want is an improvement.

A few weeks ago I was party to the installation of a perimeter railing on a flat commercial roof. The railing cost more than the rest of the job it was there for. Something tells me they won't be pulling permits for petty electrical work ever again.

Oil and most other heavy industry is faced with the same sort of problems with more digits in front of the decimal.

vel0city7 hours ago

> This is a circular statement.

Its not if you get the context.

> The regulatory hurdles are a large part of what drive cost

I agree, they are a large part. The things they have to do to meet the standards are expensive.

The claim was "impossible to get permission to build now". As in, the government won't let them build it. That the standards are just technically impossible to meet. They can get the permission to build it any day. Its possible to meet these standards. They just don't think it'll be worth it when they have to do it right.

+1
cucumber37328426 hours ago
alephnerd9 hours ago

> Most refineries in the US are very old and are very polluting

India's Reliance is also investing $300B [0] in a Texas megarefinery [1] in specifically for cleaner and more efficient shale refining.

This is deeply technical and complex but low margins work (semiconductor fabrication falls in the same boat) which saw this industry leave for abroad in the 2000s and 2010s when other states like China and India subsidized their refinery industries to build domestic capacity for a number of petroleum byproducts with industrial applications.

This is the same strategy Japan, South Korea, and Taiwan used in the 1960s-90s as well.

[0] - https://www.bloomberg.com/opinion/articles/2026-03-17/ambani...

[1] - https://www.bloomberg.com/news/articles/2026-03-11/reliance-...

lasermatts4 hours ago

if you liked this and the history of the industry, "The Prize" is a fantastic read!

phplovesong2 hours ago

* Ukraine has entered the chat *

tmellon28 hours ago

[flagged]

arlobish8 hours ago

Cool to see how when people talk about “transitioning off oil” it's more than replacing gasoline in cars. It's replacing this entire global machine.

advisedwang7 hours ago

Cars are the most familiar to the everyday user, which is why it's the most common in perception. It's also actually one of the easier ones to solve (ie it's basically done).

Trucking is technically not to hard but logistically difficult. Aviation is extremely technically challenging. Shipping is economically difficult. Electricity generation has lots of factors, there's a lot of generation that can and has been changed easily, but some generation which is harder to switch.

If you get outside of oil into CO2 generally, there's even thornier issues. Concrete production, for example.

If you are seriously interested in these issues, I highly recommend https://www.youtube.com/c/EngineeringwithRosie

tmellon27 hours ago

Oil is cooked. BYD is filing 52 patents every single day and has a 700 km in 9 minutes vehicle available TODAY ! Charging by Solar is going to be the norm. Watch : https://www.youtube.com/watch?v=vgCYYrhL-kE

ufmace4 hours ago

You seem to be copy-pasting this around this thread a lot, what's the deal with that?

I would agree that electric is the future, but even if all that works as advertised and we keep making more progress, it's still going to take decades to manufacture the billions of them that will be needed to seriously displace oil. I believe oil will continue to be necessary and relevant for the lifetime of everybody old enough to write posts on this thread.

throw0101c7 hours ago

> Oil is cooked. BYD is […]

By "vehicles" do you mean "cars"?

Because airplanes are also a type of vehicles. So are container ships. Neither of which are very practicable with pure electric AFAICT, and are integral to modern life. (Though more marine hybrid could be practical.)

I think there should be more of a push for BEV/hybrid cars (and transport trucks), and think more home electrification would be good (though air sealing and insulation are more important, relatively speaking). But let us set reasonable expectations of what is possible at various timeframes (and not let the perfect be the enemy of the good/better).

testing223215 hours ago

> Neither of which are very practicable with pure electric

Yet.

The surge in electric cars is a driving force for new tech - higher energy density batteries, faster charge rates, longer life, etc etc.

For shipping it’s only a matter of when.

Planes are harder, but just today electric choppers started flying in NYC. It’s coming.

throw0101c3 hours ago

I'm not against hoping that things will improve, but there's a lot of handwaving here, and an indeterminate path to "oil is cooked".

Remember that oil/petroleum is used in things like plastics, fertilizer, lubrication, non-natural-rubber seals/gaskets, LNG extraction has helium extraction has a by-product.

Reduction in oil-for-transportation can be reduced (thus reducing climate change effects), with oil-for-other-things still being a thing.

richwater3 hours ago

[dead]