Oil refinery. An oil refinery or petroleum refinery is an industrial process plant where petroleum (crude oil) is transformed and refined into products such as gasoline (petrol), diesel fuel, asphalt base, fuel oils, heating oil, kerosene, liquefied petroleum gas and petroleum naphtha. Petrochemical feedstock like ethylene and propylene can also be produced directly by cracking crude oil without the need of using refined products of crude oil such as naphtha. The crude oil feedstock has typically been processed by an oil production plant.   There is usually an oil depot at or near an oil refinery for the storage of incoming crude oil feedstock as well as bulk liquid products. In 2020, the total capacity of global refineries for crude oil was about 101.2 million barrels per day.

Oil refineries are typically large, sprawling industrial complexes with extensive piping running throughout, carrying streams of fluids between large chemical processing units, such as distillation columns. In many ways, oil refineries use many different technologies and can be thought of as types of chemical plants. Since December 2008, the world's largest oil refinery has been the Jamnagar Refinery owned by Reliance Industries, located in Gujarat, India, with a processing capacity of  per day.

Oil refineries are an essential part of the petroleum industry's downstream sector.

History
The Chinese were among the first civilizations to refine oil. As early as the first century, the Chinese were refining crude oil for use as an energy source. Between 512 and 518, in the late Northern Wei dynasty, the Chinese geographer, writer and politician Li Daoyuan introduced the process of refining oil into various lubricants in his famous work Commentary on the Water Classic.

Crude oil was often distilled by Persian chemists, with clear descriptions given in handbooks such as those of Muhammad ibn Zakarīya Rāzi (). The streets of Baghdad were paved with tar, derived from petroleum that became accessible from natural fields in the region. In the 9th century, oil fields were exploited in the area around modern Baku, Azerbaijan. These fields were described by the Arab geographer Abu al-Hasan 'Alī al-Mas'ūdī in the 10th century, and by Marco Polo in the 13th century, who described the output of those wells as hundreds of shiploads. Arab and Persian chemists also distilled crude oil in order to produce flammable products for military purposes. Through Islamic Spain, distillation became available in Western Europe by the 12th century.

In the Northern Song dynasty (960–1127), a workshop called the "Fierce Oil Workshop", was established in the city of Kaifeng to produce refined oil for the Song military as a weapon. The troops would then fill iron cans with refined oil and throw them toward the enemy troops, causing a fire – effectively the world's first "fire bomb". The workshop was one of the world's earliest oil refining factories where thousands of people worked to produce Chinese oil-powered weaponry.

Prior to the nineteenth century, petroleum was known and utilized in various fashions in Babylon, Egypt, China, Philippines, Rome and Azerbaijan. However, the modern history of the petroleum industry is said to have begun in 1846 when Abraham Gessner of Nova Scotia, Canada devised a process to produce kerosene from coal. Shortly thereafter, in 1854, Ignacy Łukasiewicz began producing kerosene from hand-dug oil wells near the town of Krosno, Poland.

Romania was registered as the first country in world oil production statistics, according to the Academy Of World Records.

In North America, the first oil well was drilled in 1858 by James Miller Williams in Oil Springs, Ontario, Canada. In the United States, the petroleum industry began in 1859 when Edwin Drake found oil near Titusville, Pennsylvania. The industry grew slowly in the 1800s, primarily producing kerosene for oil lamps. In the early twentieth century, the introduction of the internal combustion engine and its use in automobiles created a market for gasoline that was the impetus for fairly rapid growth of the petroleum industry. The early finds of petroleum like those in Ontario and Pennsylvania were soon outstripped by large oil "booms" in Oklahoma, Texas and California.

Samuel Kier established America's first oil refinery in Pittsburgh on Seventh Avenue near Grant Street, in 1853. Polish pharmacist and inventor Ignacy Łukasiewicz established an oil refinery in Jasło, then part of the Austro-Hungarian Empire (now in Poland) in 1854.

The first large refinery opened at Ploiești, Romania, in 1856–1857. 
It was in Ploiesti that, 51 years later, in 1908, Lazăr Edeleanu, a Romanian chemist of Jewish origin who got his PhD in 1887 by discovering amphetamine, invented, patented and tested on industrial scale the first modern method of liquid extraction for refining crude oil, the Edeleanu process. This increased the refining efficiency compared to pure fractional distillation and allowed a massive development of the refining plants. Successively, the process was implemented in France, Germany, U.S. and in a few decades became worldwide spread. In 1910 Edeleanu founded "Allgemeine Gesellschaft für Chemische Industrie" in Germany, which, given the success of the name, changed to Edeleanu GmbH, in 1930. During Nazi's time, the company was bought by the Deutsche Erdöl-AG and Edeleanu, being of Jewish origin, moved back to Romania. After the war, the trademark was used by the successor company EDELEANU Gesellschaft mbH Alzenau (RWE) for many petroleum products, while the company was lately integrated as EDL in the Pörner Group.
The Ploiești refineries, after being taken over by Nazi Germany, were bombed in the 1943 Operation Tidal Wave by the Allies, during the Oil Campaign of World War II.

Another close contender for the title of hosting the world's oldest oil refinery is Salzbergen in Lower Saxony, Germany. Salzbergen's refinery was opened in 1860.

At one point, the refinery in Ras Tanura, Saudi Arabia owned by Saudi Aramco was claimed to be the largest oil refinery in the world. For most of the 20th century, the largest refinery was the Abadan Refinery in Iran. This refinery suffered extensive damage during the Iran–Iraq War. Since 25 December 2008, the world's largest refinery complex is the Jamnagar Refinery Complex, consisting of two refineries side by side operated by Reliance Industries Limited in Jamnagar, India with a combined production capacity of . PDVSA's Paraguaná Refinery Complex in Paraguaná Peninsula, Venezuela, with a capacity of  but effective run rates have been dramatically lower due to the impact of 20 years of sanctions, and SK Energy's Ulsan in South Korea with  are the second and third largest, respectively.

Prior to World War II in the early 1940s, most petroleum refineries in the United States consisted simply of crude oil distillation units (often referred to as atmospheric crude oil distillation units). Some refineries also had vacuum distillation units as well as thermal cracking units such as visbreakers (viscosity breakers, units to lower the viscosity of the oil). All of the many other refining processes discussed below were developed during the war or within a few years after the war. They became commercially available within 5 to 10 years after the war ended and the worldwide petroleum industry experienced very rapid growth. The driving force for that growth in technology and in the number and size of refineries worldwide was the growing demand for automotive gasoline and aircraft fuel.

In the United States, for various complex economic and political reasons, the construction of new refineries came to a virtual stop in about the 1980s. However, many of the existing refineries in the United States have revamped many of their units and/or constructed add-on units in order to: increase their crude oil processing capacity, increase the octane rating of their product gasoline, lower the sulfur content of their diesel fuel and home heating fuels to comply with environmental regulations and comply with environmental air pollution and water pollution requirements.

United States 

In the 19th century, refineries in the U.S. processed crude oil primarily to recover the kerosene. There was no market for the more volatile fraction, including gasoline, which was considered waste and was often dumped directly into the nearest river. The invention of the automobile shifted the demand to gasoline and diesel, which remain the primary refined products today.

Today, national and state legislation require refineries to meet stringent air and water cleanliness standards. In fact, oil companies in the U.S. perceive obtaining a permit to build a modern refinery to be so difficult and costly that no new refineries were built (though many have been expanded) in the U.S. from 1976 until 2014 when the small Dakota Prairie Refinery in North Dakota began operation. More than half the refineries that existed in 1981 are now closed due to low utilization rates and accelerating mergers. As a result of these closures total US refinery capacity fell between 1981 and 1995, though the operating capacity stayed fairly constant in that time period at around . Increases in facility size and improvements in efficiencies have offset much of the lost physical capacity of the industry. In 1982 (the earliest data provided), the United States operated 301 refineries with a combined capacity of  of crude oil each calendar day. In 2010, there were 149 operable U.S. refineries with a combined capacity of  per calendar day. By 2014 the number of refinery had reduced to 140 but the total capacity increased to  per calendar day. Indeed, in order to reduce operating costs and depreciation, refining is operated in fewer sites but of bigger capacity.

In 2009 through 2010, as revenue streams in the oil business dried up and profitability of oil refineries fell due to lower demand for product and high reserves of supply preceding the economic recession, oil companies began to close or sell the less profitable refineries.

Operation

Raw or unprocessed crude oil is not generally useful in industrial applications, although "light, sweet" (low viscosity, low sulfur) crude oil has been used directly as a burner fuel to produce steam for the propulsion of seagoing vessels. The lighter elements, however, form explosive vapors in the fuel tanks and are therefore hazardous, especially in warships. Instead, the hundreds of different hydrocarbon molecules in crude oil are separated in a refinery into components that can be used as fuels, lubricants, and feedstocks in petrochemical processes that manufacture such products as plastics, detergents, solvents, elastomers, and fibers such as nylon and polyesters.

Petroleum fossil fuels are burned in internal combustion engines to provide power for ships, automobiles, aircraft engines, lawn mowers, dirt bikes, and other machines. Different boiling points allow the hydrocarbons to be separated by distillation. Since the lighter liquid products are in great demand for use in internal combustion engines, a modern refinery will convert heavy hydrocarbons and lighter gaseous elements into these higher-value products.

Oil can be used in a variety of ways because it contains hydrocarbons of varying molecular masses, forms and lengths such as paraffins, aromatics, naphthenes (or cycloalkanes), alkenes, dienes, and alkynes. While the molecules in crude oil include different atoms such as sulfur and nitrogen, the hydrocarbons are the most common form of molecules, which are molecules of varying lengths and complexity made of hydrogen and carbon atoms, and a small number of oxygen atoms. The differences in the structure of these molecules account for their varying physical and chemical properties, and it is this variety that makes crude oil useful in a broad range of several applications.

Once separated and purified of any contaminants and impurities, the fuel or lubricant can be sold without further processing. Smaller molecules such as isobutane and propylene or butylenes can be recombined to meet specific octane requirements by processes such as alkylation, or more commonly, dimerization. The octane grade of gasoline can also be improved by catalytic reforming, which involves removing hydrogen from hydrocarbons producing compounds with higher octane ratings such as aromatics.  Intermediate products such as gasoils can even be reprocessed to break a heavy, long-chained oil into a lighter short-chained one, by various forms of cracking such as fluid catalytic cracking, thermal cracking, and hydrocracking. The final step in gasoline production is the blending of fuels with different octane ratings, vapor pressures, and other properties to meet product specifications. Another method for reprocessing and upgrading these intermediate products (residual oils) uses a devolatilization process to separate usable oil from the waste asphaltene material. Certain cracked streams are particularly suitable to produce petrochemicals includes polypropylene, heavier polymers, and block polymers based on the molecular weight and the characteristics of the olefin specie that is cracked from the source feedstock. 

Oil refineries are large-scale plants, processing about a hundred thousand to several hundred thousand barrels of crude oil a day.  Because of the high capacity, many of the units operate continuously, as opposed to processing in batches, at steady state or nearly steady state for months to years.  The high capacity also makes process optimization and advanced process control very desirable.

Major products

Petroleum products are materials derived from crude oil (petroleum) as it is processed in oil refineries. The majority of petroleum is converted to petroleum products, which includes several classes of fuels.

Oil refineries also produce various intermediate products such as hydrogen, light hydrocarbons, reformate and pyrolysis gasoline. These are not usually transported but instead are blended or processed further on-site. Chemical plants are thus often adjacent to oil refineries or a number of further chemical processes are integrated into it. For example, light hydrocarbons are steam-cracked in an ethylene plant, and the produced ethylene is polymerized to produce polyethene.

To ensure both proper separation and environmental protection, a very low sulfur content is necessary in all but the heaviest products. The crude sulfur contaminant is transformed to hydrogen sulfide via catalytic hydrodesulfurization and removed from the product stream via amine gas treating. Using the Claus process, hydrogen sulfide is afterward transformed to elementary sulfur to be sold to the chemical industry. The rather large heat energy freed by this process is directly used in the other parts of the refinery. Often an electrical power plant is combined into the whole refinery process to take up the excess heat.

According to the composition of the crude oil and depending on the demands of the market, refineries can produce different shares of petroleum products. The largest share of oil products is used as "energy carriers", i.e.  various grades of fuel oil and gasoline.  These fuels include or can be blended to give gasoline, jet fuel, diesel fuel, heating oil, and heavier fuel oils.  Heavier (less volatile) fractions can also be used to produce asphalt, tar, paraffin wax, lubricating and other heavy oils.  Refineries also produce other chemicals, some of which are used in chemical processes to produce plastics and other useful materials.  Since petroleum often contains a few percent sulfur-containing molecules, elemental sulfur is also often produced as a petroleum product. Carbon, in the form of petroleum coke, and hydrogen may also be produced as petroleum products.  The hydrogen produced is often used as an intermediate product for other oil refinery processes such as hydrocracking and hydrodesulfurization.

Petroleum products are usually grouped into four categories: light distillates (LPG, gasoline, naphtha), middle distillates (kerosene, jet fuel, diesel), heavy distillates, and residuum (heavy fuel oil, lubricating oils, wax, asphalt). These require blending various feedstocks, mixing appropriate additives, providing short-term storage, and preparation for bulk loading to trucks, barges, product ships, and railcars. This classification is based on the way crude oil is distilled and separated into fractions.
 Gaseous fuel such as liquified petroleum gas and propane, stored and shipped in liquid form under pressure.
 Lubricants (produces light machine oils, motor oils, and greases, adding viscosity stabilizers as required), usually shipped in bulk to an offsite packaging plant.
 Paraffin wax, used in the candle industry, among others. May be shipped in bulk to a site to prepare as packaged blocks. Used for wax emulsions, candles, matches, rust protection, vapor barriers, construction board, and packaging of frozen foods.
 Sulfur (or sulfuric acid), byproducts of sulfur removal from petroleum which may have up to a couple of percent sulfur as organic sulfur-containing compounds. Sulfur and sulfuric acid are useful industrial materials.  Sulfuric acid is usually prepared and shipped as the acid precursor oleum.
 Bulk tar shipping for offsite unit packaging for use in tar-and-gravel roofing.
 Asphalt used as a binder for gravel to form asphalt concrete, which is used for paving roads, lots, etc. An asphalt unit prepares bulk asphalt for shipment.
 Petroleum coke, used in specialty carbon products like electrodes or as solid fuel.
 Petrochemicals are organic compounds that are the ingredients for the chemical industry, ranging from polymers and pharmaceuticals, including ethylene and benzene-toluene-xylenes ("BTX") which are often sent to petrochemical plants for further processing in a variety of ways.  The petrochemicals may be olefins or their precursors, or various types of aromatic petrochemicals.
 Gasoline
 Naphtha
 Kerosene and related jet aircraft fuels
 Diesel fuel and fuel oils
 Heat
 Electricity

Over 6,000 items are made from petroleum waste by-products, including fertilizer, floor coverings, perfume, insecticide, petroleum jelly, soap, vitamin capsules.

Chemical processes

 Desalter unit washes out salt, and other water soluble contaminants, from the crude oil before it enters the atmospheric distillation unit.
 Pre-flash and/or pre-distillation which is found in most atmospheric crude oil units of more than 100,000 bpsd in capacity. 
 Crude oil distillation unit distills the incoming crude oil into various fractions for further processing in other units. See continuous distillation.
 Vacuum distillation further distills the residue oil from the bottom of the crude oil distillation unit. The vacuum distillation is performed at a pressure well below atmospheric pressure.
 Naphtha hydrotreater unit uses hydrogen to desulfurize naphtha from atmospheric distillation. Naphtha must be desulfurized before sending it to a catalytic reformer unit.
 Catalytic reformer converts the desulfurized naphtha molecules into higher-octane molecules to produce reformate (reformer product). The reformate has higher content of aromatics and cyclic hydrocarbons which is a component of the end-product gasoline or petrol. An important byproduct of a reformer is hydrogen released during the catalyst reaction. The hydrogen is used either in the hydrotreaters or the hydrocracker.
 Distillate hydrotreater desulfurizes distillates (such as diesel) after atmospheric distillation. Uses hydrogen to desulfurize the naphtha fraction from the crude oil distillation or other units within the refinery. Distillate hydrotreaters that operate above 700 psi are also capable of removing nitrogen contaminants from feedstocks if given adequate liquid hourly space velocity. 
 Fluid catalytic cracker (FCC) upgrades the heavier, higher-boiling fractions from the crude oil distillation by converting them into lighter and lower boiling, more valuable products.
 Hydrocracker uses hydrogen to upgrade heavy residual oils from the vacuum distillation unit by thermally cracking them into lighter, more valuable reduced viscosity products.
 Merox desulfurize LPG, kerosene or jet fuel by oxidizing mercaptans to organic disulfides.
 Alternative processes for removing mercaptans are known, e.g. doctor sweetening process and caustic washing.
 Coking units (delayed coker, fluid coker, and flexicoker) process very heavy residual oils into gasoline and diesel fuel, leaving petroleum coke as a residual product.
 Alkylation unit uses sulfuric acid or hydrofluoric acid to produce high-octane components for gasoline blending. The "alky" unit converts light end isobutane and butylenes from the FCC process into alkylate, a very high-octane component of the end-product gasoline or petrol.
 Dimerization unit converts olefins into higher-octane gasoline blending components. For example, butenes can be dimerized into isooctene which may subsequently be hydrogenated to form isooctane. There are also other uses for dimerization. Gasoline produced through dimerization is highly unsaturated and very reactive. It tends spontaneously to form gums. For this reason, the effluent from the dimerization needs to be blended into the finished gasoline pool immediately or hydrogenated.
 Isomerization converts linear molecules such as normal pentane to higher-octane branched molecules for blending into gasoline or feed to alkylation units. Also used to convert linear normal butane into isobutane for use in the alkylation unit.
 Steam reforming converts natural gas into hydrogen for the hydrotreaters and/or the hydrocracker.
 Liquified gas storage vessels store propane and similar gaseous fuels at pressure sufficient to maintain them in liquid form. These are usually spherical vessels or "bullets" (i.e., horizontal vessels with rounded ends).
 Amine gas treater, Claus unit, and tail gas treatment convert hydrogen sulfide from hydrodesulfurization into elemental sulfur. The large majority of the 64,000,000 metric tons of sulfur produced worldwide in 2005 was byproduct sulfur from petroleum refining and natural gas processing plants.
 Sour water stripper uses steam to remove hydrogen sulfide gas from various wastewater streams for subsequent conversion into end-product sulfur in the Claus unit.
 Cooling towers circulate cooling water, boiler plants generates steam for steam generators, and instrument air systems include pneumatically operated control valves and an electrical substation.
 Wastewater collection and treating systems consist of API separators, dissolved air flotation (DAF) units and further treatment units such as an activated sludge biotreater to make water suitable for reuse or for disposal.
 Solvent refining uses solvent such as cresol or furfural to remove unwanted, mainly aromatics from lubricating oil stock or diesel stock.
 Solvent dewaxing removes the heavy waxy constituents petrolatum from vacuum distillation products.
 Storage tanks for storing crude oil and finished products, usually vertical, cylindrical vessels with some sort of vapor emission control and surrounded by an earthen berm to contain spills.

Flow diagram of typical refinery

The image below is a schematic flow diagram of a typical oil refinery that depicts the various unit processes and the flow of intermediate product streams that occurs between the inlet crude oil feedstock and the final end products. The diagram depicts only one of the literally hundreds of different oil refinery configurations. The diagram also does not include any of the usual refinery facilities providing utilities such as steam, cooling water, and electric power as well as storage tanks for crude oil feedstock and for intermediate products and end products.

There are many process configurations other than that depicted above. For example, the vacuum distillation unit may also produce fractions that can be refined into end products such as spindle oil used in the textile industry, light machine oil, motor oil, and various waxes.

Crude oil distillation unit
The crude oil distillation unit (CDU) is the first processing unit in virtually all petroleum refineries. The CDU distills the incoming crude oil into various fractions of different boiling ranges, each of which is then processed further in the other refinery processing units. The CDU is often referred to as the atmospheric distillation unit because it operates at slightly above atmospheric pressure.
Below is a schematic flow diagram of a typical crude oil distillation unit. The incoming crude oil is preheated by exchanging heat with some of the hot, distilled fractions and other streams. It is then desalted to remove inorganic salts (primarily sodium chloride).

Following the desalter, the crude oil is further heated by exchanging heat with some of the hot, distilled fractions and other streams. It is then heated in a fuel-fired furnace (fired heater) to a temperature of about 398 °C and routed into the bottom of the distillation unit.

The cooling and condensing of the distillation tower overhead is provided partially by exchanging heat with the incoming crude oil and partially by either an air-cooled or water-cooled condenser. Additional heat is removed from the distillation column by a pumparound system as shown in the diagram below.

As shown in the flow diagram, the overhead distillate fraction from the distillation column is naphtha. The fractions removed from the side of the distillation column at various points between the column top and bottom are called sidecuts. Each of the sidecuts (i.e., the kerosene, light gas oil, and heavy gas oil) is cooled by exchanging heat with the incoming crude oil. All of the fractions (i.e., the overhead naphtha, the sidecuts, and the bottom residue) are sent to intermediate storage tanks before being processed further.

Location of refineries

A party searching for a site to construct a refinery or a chemical plant needs to consider the following issues:
 The site has to be reasonably far from residential areas.
 Infrastructure should be available for the supply of raw materials and shipment of products to markets.
 Energy to operate the plant should be available.
 Facilities should be available for waste disposal.
Factors affecting site selection for oil refinery:
 Availability of land
 Conditions of traffic and transportation
 Conditions of utilities – power supply, water supply
 Availability of labours and resources

Refineries that use a large amount of steam and cooling water need to have an abundant source of water. Oil refineries, therefore, are often located nearby navigable rivers or on a seashore, nearby a port. Such location also gives access to transportation by river or by sea. The advantages of transporting crude oil by pipeline are evident, and oil companies often transport a large volume of fuel to distribution terminals by pipeline. A pipeline may not be practical for products with small output, and railcars, road tankers, and barges are used.

Petrochemical plants and solvent manufacturing (fine fractionating) plants need spaces for further processing of a large volume of refinery products, or to mix chemical additives with a product at source rather than at blending terminals.

Safety and environment

The refining process releases a number of different chemicals into the atmosphere (see AP 42 Compilation of Air Pollutant Emission Factors) and a notable odor normally accompanies the presence of a refinery. Aside from air pollution impacts there are also wastewater concerns, risks of industrial accidents such as fire and explosion, and noise health effects due to industrial noise.

Many governments worldwide have mandated restrictions on contaminants that refineries release, and most refineries have installed the equipment needed to comply with the requirements of the pertinent environmental protection regulatory agencies.  In the United States, there is strong pressure to prevent the development of new refineries, and no major refinery has been built in the country since Marathon's Garyville, Louisiana facility in 1976. However, many existing refineries have been expanded during that time. Environmental restrictions and pressure to prevent the construction of new refineries may have also contributed to rising fuel prices in the United States. Additionally, many refineries (more than 100 since the 1980s) have closed due to obsolescence and/or merger activity within the industry itself.

Environmental and safety concerns mean that oil refineries are sometimes located some distance away from major urban areas. Nevertheless, there are many instances where refinery operations are close to populated areas and pose health risks. In California's Contra Costa County and Solano County, a shoreline necklace of refineries, built in the early 20th century before this area was populated, and associated chemical plants are adjacent to urban areas in Richmond, Martinez, Pacheco, Concord, Pittsburg, Vallejo and Benicia, with occasional accidental events that require "shelter in place" orders to the adjacent populations. A number of refineries are located in Sherwood Park, Alberta, directly adjacent to the City of Edmonton, which has a population of over 1,000,000 residents.

NIOSH criteria for occupational exposure to refined petroleum solvents have been available since 1977.

Worker health

Background
Modern petroleum refining involves a complicated system of interrelated chemical reactions that produce a wide variety of petroleum-based products. Many of these reactions require precise temperature and pressure parameters.  The equipment and monitoring required to ensure the proper progression of these processes is complex, and has evolved through the advancement of the scientific field of petroleum engineering.

The wide array of high pressure and/or high temperature reactions, along with the necessary chemical additives or extracted contaminants, produces an astonishing number of potential health hazards to the oil refinery worker.  Through the advancement of technical chemical and petroleum engineering, the vast majority of these processes are automated and enclosed, thus greatly reducing the potential health impact to workers.  However, depending on the specific process in which a worker is engaged, as well as the particular method employed by the refinery in which he/she works, significant health hazards remain.

Although occupational injuries in the United States were not routinely tracked and reported at the time, reports of the health impacts of working in an oil refinery can be found as early as the 1800s. For instance, an explosion in a Chicago refinery killed 20 workers in 1890.  Since then, numerous fires, explosions, and other significant events have from time to time drawn the public's attention to the health of oil refinery workers.  Such events continue in the 21st century, with explosions reported in refineries in Wisconsin and Germany in 2018.

However, there are many less visible hazards that endanger oil refinery workers.

Chemical exposures

Given the highly automated and technically advanced nature of modern petroleum refineries, nearly all processes are contained within engineering controls and represent a substantially decreased risk of exposure to workers compared to earlier times.  However, certain situations or work tasks may subvert these safety mechanisms, and expose workers to a number of chemical (see table above) or physical (described below) hazards.  Examples of these scenarios include:
 System failures (leaks, explosions, etc.).
 Standard inspection, product sampling, process turnaround, or equipment maintenance/cleaning activities.

A 2021 systematic review associated working in the petrochemical industry with increased risk of various cancers, such as mesothelioma. It also found reduced risks of other cancers, such as stomach and rectal. The systematic review did mention that several of the associations were not due to factors directly related to the petroleum industry, rather were related to lifestyle factors such as smoking. Evidence for adverse health effects for nearby residents was also weak, with the evidence primarily centering around neighborhoods in developed countries.

BTX stands for benzene, toluene, xylene. This is a group of common volatile organic compounds (VOCs) that are found in the oil refinery environment, and serve as a paradigm for more in depth discussion of occupational exposure limits, chemical exposure and surveillance among refinery workers.

The most important route of exposure for BTX chemicals is inhalation due to the low boiling point of these chemicals. The majority of the gaseous production of BTX occurs during tank cleaning and fuel transfer, which causes offgassing of these chemicals into the air. Exposure can also occur through ingestion via contaminated water, but this is unlikely in an occupational setting.  Dermal exposure and absorption is also possible, but is again less likely in an occupational setting where appropriate personal protective equipment is in place.

In the United States, the Occupational Safety and Health Administration (OSHA), National Institute for Occupational Safety and Health (NIOSH), and American Conference of Governmental Industrial Hygienists (ACGIH) have all established occupational exposure limits (OELs) for many of the chemicals above that workers may be exposed to in petroleum refineries.

Benzene, in particular, has multiple biomarkers that can be measured to determine exposure.  Benzene itself can be measured in the breath, blood, and urine, and metabolites such as phenol, t,t-muconic acid (t,tMA) and S-phenylmercapturic acid (sPMA) can be measured in urine.  In addition to monitoring the exposure levels via these biomarkers, employers are required by OSHA to perform regular blood tests on workers to test for early signs of some of the feared hematologic outcomes, of which the most widely recognized is leukemia.  Required testing includes complete blood count with cell differentials and peripheral blood smear "on a regular basis".  The utility of these tests is supported by formal scientific studies.

Potential chemical exposure by process

Physical hazards 
Workers are at risk of physical injuries due to a large number of high-powered machines in the relatively close proximity of the oil refinery. The high pressure required for many of the chemical reactions also presents the possibility of localized system failures resulting in blunt or penetrating trauma from exploding system components.

Heat is also a hazard. The temperature required for the proper progression of certain reactions in the refining process can reach . As with chemicals, the operating system is designed to safely contain this hazard without injury to the worker. However, in system failures, this is a potent threat to workers' health. Concerns include both direct injury through a heat illness or injury, as well as the potential for devastating burns should the worker come in contact with super-heated reagents/equipment.

Noise is another hazard. Refineries can be very loud environments, and have previously been shown to be associated with hearing loss among workers.  The interior environment of an oil refinery can reach levels in excess of 90 dB. In the United States, an average of 90 dB is the permissible exposure limit (PEL) for an 8-hour work-day.  Noise exposures that average greater than 85 dB over an 8-hour require a hearing conservation program to regularly evaluate workers' hearing and to promote its protection.  Regular evaluation of workers' auditory capacity and faithful use of properly vetted hearing protection are essential parts of such programs.

While not specific to the industry, oil refinery workers may also be at risk for hazards such as vehicle-related accidents, machinery-associated injuries, work in a confined space, explosions/fires, ergonomic hazards, shift-work related sleep disorders, and falls.

Hazard controls 
The theory of hierarchy of controls can be applied to petroleum refineries and their efforts to ensure worker safety.

Elimination and substitution are unlikely in petroleum refineries, as many of the raw materials, waste products, and finished products are hazardous in one form or another (e.g. flammable, carcinogenic).

Examples of engineering controls include a fire detection/extinguishing system, pressure/chemical sensors to detect/predict loss of structural integrity, and adequate maintenance of piping to prevent hydrocarbon-induced corrosion (leading to structural failure). Other examples employed in petroleum refineries include the post-construction protection of steel components with vermiculite to improve heat/fire resistance. Compartmentalization can help to prevent a fire or other systems failure from spreading to affect other areas of the structure, and may help prevent dangerous reactions by keeping different chemicals separate from one another until they can be safely combined in the proper environment.

Administrative controls include careful planning and oversight of the refinery cleaning, maintenance, and turnaround processes. These occur when many of the engineering controls are shut down or suppressed and may be especially dangerous to workers. Detailed coordination is necessary to ensure that maintenance of one part of the facility will not cause dangerous exposures to those performing the maintenance, or to workers in other areas of the plant. Due to the highly flammable nature of many of the involved chemicals, smoking areas are tightly controlled and carefully placed.

Personal protective equipment (PPE) may be necessary depending on the specific chemical being processed or produced. Particular care is needed during sampling of the partially-completed product, tank cleaning, and other high-risk tasks as mentioned above. Such activities may require the use of impervious outerwear, acid hood, disposable coveralls, etc. More generally, all personnel in operating areas should use appropriate hearing and vision protection, avoid clothes made of flammable material (nylon, Dacron, acrylic, or blends), and full-length pants and sleeves.

Regulations

United States
Worker health and safety in oil refineries is closely monitored at a national level by both the Occupational Safety and Health Administration (OSHA) and National Institute for Occupational Safety and Health (NIOSH). In addition to federal monitoring, California's CalOSHA has been particularly active in protecting worker health in the industry, and adopted a policy in 2017 that requires petroleum refineries to perform a "Hierarchy of Hazard Controls Analysis" (see above "Hazard controls" section) for each process safety hazard. Safety regulations have resulted in a below-average injury rate for refining industry workers. In a 2018 report by the US Bureau of Labor Statistics, they indicate that petroleum refinery workers have a significantly lower rate of occupational injury (0.4 OSHA-recordable cases per 100 full-time workers) than all industries (3.1 cases), oil and gas extraction (0.8 cases), and petroleum manufacturing in general (1.3 cases).

Below is a list of the most common regulations referenced in petroleum refinery safety citations issued by OSHA:
 Flammable and Combustible Liquids ()
 The Hazard Communication (HazCom) standard ()
 Permit-Required Confined Spaces ()
 Hazardous (Classified) Locations ()
 The Personal Protective Equipment (PPE) standard ()
 The Control of Hazardous Energy (Lockout/Tagout) standard ()

Corrosion

Corrosion of metallic components is a major factor of inefficiency in the refining process. Because it leads to equipment failure, it is a primary driver for the refinery maintenance schedule. Corrosion-related direct costs in the U.S. petroleum industry as of 1996 were estimated at US$3.7 billion.

Corrosion occurs in various forms in the refining process, such as pitting corrosion from water droplets, embrittlement from hydrogen, and stress corrosion cracking from sulfide attack. From a materials standpoint, carbon steel is used for upwards of 80 percent of refinery components, which is beneficial due to its low cost. Carbon steel is resistant to the most common forms of corrosion, particularly from hydrocarbon impurities at temperatures below 205 °C, but other corrosive chemicals and environments prevent its use everywhere. Common replacement materials are low alloy steels containing chromium and molybdenum, with stainless steels containing more chromium dealing with more corrosive environments. More expensive materials commonly used are nickel, titanium, and copper alloys. These are primarily saved for the most problematic areas where extremely high temperatures and/or very corrosive chemicals are present.

Corrosion is fought by a complex system of monitoring, preventative repairs, and careful use of materials. Monitoring methods include both offline checks taken during maintenance and online monitoring. Offline checks measure corrosion after it has occurred, telling the engineer when equipment must be replaced based on the historical information they have collected. This is referred to as preventative management.

Online systems are a more modern development and are revolutionizing the way corrosion is approached. There are several types of online corrosion monitoring technologies such as linear polarization resistance, electrochemical noise and electrical resistance. Online monitoring has generally had slow reporting rates in the past (minutes or hours) and been limited by process conditions and sources of error but newer technologies can report rates up to twice per minute with much higher accuracy (referred to as real-time monitoring). This allows process engineers to treat corrosion as another process variable that can be optimized in the system. Immediate responses to process changes allow the control of corrosion mechanisms, so they can be minimized while also maximizing production output. In an ideal situation having on-line corrosion information that is accurate and real-time will allow conditions that cause high corrosion rates to be identified and reduced.  This is known as predictive management.

Materials methods include selecting the proper material for the application. In areas of minimal corrosion, cheap materials are preferable, but when bad corrosion can occur, more expensive but longer-lasting materials should be used. Other materials methods come in the form of protective barriers between corrosive substances and the equipment metals. These can be either a lining of refractory material such as standard Portland cement or other special acid-resistant cement that is shot onto the inner surface of the vessel. Also available are thin overlays of more expensive metals that protect cheaper metal against corrosion without requiring much material.

See also
 Acid gas
 H-Bio
 AP 42 Compilation of Air Pollutant Emission Factors
 API oil-water separator
 Biorefinery
 Ethanol fuel
 Butanol fuel
 Gas flare
 Industrial wastewater treatment
 K factor crude oil refining
 List of oil refineries
 Natural-gas processing
 National Occupational Research Agenda Oil and gas Extraction Council
 Nelson complexity index
 Sour gas
 Atmospheric distillation of crude oil
 List of countries by oil production

References

Bibliography

External links

 Interactive map of UK refineries
 Searchable United States Refinery Map
 Complete, detailed refinery description
 Ecomuseum Bergslagen – history of Oljeön, Sweden
 Fueling Profits: Report on Industry Consolidation (publication of the Consumer Federation of America)
 Price Spikes, Excess Profits and Excuses (publication of the Consumer Federation of America)
 2022 AFPM Refinery Listing (free) with Detailed Unit Information (note the data is collected annually by the US Dept. of Energy)

Chemical processes
Chinese inventions
Distillation
Northern Wei
 
Song dynasty
Occupational safety and health