Petroleum refining processes are those chemical engineering processes and other facilities used in petroleum refineries (also referred to as oil refineries) to transform petroleum crude oil into useful products such as liquefied petroleum gas (LPG), gasoline or petrol, kerosene, jet fuel, diesel oil and fuel oils.  
Petroleum refineries are very large industrial complexes that involve a great many different processing units and auxiliary facilities such as utility units and storage tanks. Each refinery has its own unique arrangement and combination of refining processes largely determined by the refinery location, desired products and economic considerations. There are most probably no two refineries that are identical in every respect.
Some modern petroleum refineries process as much as 800,000 to 900,000 barrels (127,000 to 143,000 cubic meters) per day of crude oil.
Prior to the 19th century, petroleum was known and utilized in various fashions in Babylon, Egypt, China, Persia, 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 discovered how to produce kerosene from coal. Shortly thereafter, in 1854, Ignacy Lukasiewicz began producing kerosene from hand-dug oil wells near the town of Krosno, now in Poland. The first large petroleum refinery was built in Ploesti, Romania in 1856 using the abundant oil available in Romania. 
In North America, the first oil well was drilled in 1858 by James Miller Williams in 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 1900's, 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.
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 reasons, the construction of new refineries came to a virtual stop in about the 1980's. 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.
The image below is a schematic flow diagram of a typical petroleum refinery that depicts the various refining processes and the flow of intermediate product streams 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. 
Large, modern petroleum refineries include most, if not all, of the process units listed below:
- Crude oil distillation unit: Distills the incoming crude oil into various fractions for further processing in other units.
- Vacuum distillation unit: 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 the naphtha fraction from the crude oil distillation or other units within the refinery.
- Catalytic reforming unit: Converts the desulfurized naphtha molecules into higher-octane molecules to produce reformate, which is a component of the end-product gasoline or petrol.
- Alkylation unit: Converts isobutane and butylenes into alkylate, which is a very high-octane component of the end-product gasoline or petrol.
- Isomerization unit: Converts linear molecules such as normal pentane into higher-octane branched molecules for blending into the end-product gasoline. Also used to convert linear normal butane into isobutane for use in the alkylation unit.
- Distillate hydrotreater unit: Uses hydrogen to desulfurize some of the other distilled fractions from the crude oil distillation unit (such as diesel oil).
- Merox (mercaptan oxidizer) or similar units: Desulfurize LPG, kerosene or jet fuel by oxidizing undesired mercaptans to organic disulfides.
- Amine gas treating, Claus unit, and tail gas treatment for converting hydrogen sulfide gas from the hydrotreaters into product 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. 
- Fluid catalytic cracking (FCC) unit: Upgrades the heavier, higher-boiling fractions from the the crude oil distillation by converting them into lighter and lower boiling, more valuable products.
- Hydrocracking unit: Uses hydrogen to upgrade heavier fractions from the crude oil distillation and the vacuum distillation units into lighter, more valuable products.
- Visbreaking unit: Upgrades heavy residual oils from the vacuum distillation unit by thermally cracking them into lighter, more valuable reduced viscosity products.
- Delayed coking and Fluid coker units: Convert very heavy residual oils into end-product petroleum coke as well as naphtha and diesel oil by-products.
The primary end-products produced in petroleum refining may be grouped into four categories: light distillates, middle distillates, heavy distillates and others.
- Liquid petroleum gas (LPG)
- Gasoline (also known as petrol)
- Jet fuel and other aircraft fuel
- Automotive and railroad diesel fuels
- Residential heating fuel
- Other light fuel oils
Many of these are not produced in all petroleum refineries:
- Specialty petroleum naphthas
- Specialty solvents
- Elemental sulfur (and sometimes sulfuric acid)
- Petrochemical feedstocks
- Petroleum coke
- Lubricating oils
- Waxes and greases
- Transformer and cable oils
- Carbon black
Petroleum refinery product yields differ significantly from one refinery to another because the large majority of refineries process their own unique slate of crude oils and, even more signicantly, have different refining process configurations.
Many refineries also change their product yields seasonally (i.e., from summer to winter) since typically the winter season demand decreases for gasoline and increases for heating oil.
However, the average of all the product yields from refineries in the United States during 2007 is depicted in the adjacent diagram.
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 are 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 process 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.
- Steam reformer unit: Converts natural gas into hydrogen for the hydrotreaters and/or the hydrocracker.
- 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.
- Utility units: Such as cooling towers for furnishing circulating cooling water, steam generators, instrument air systems for pneumatically operated control valves and an electrical substation.
- Wastewater collection and treating systems consisting of API oil-water separators, dissolved air flotation (DAF) units and some type of further treatment (such as an activated sludge biotreater) to make the wastewaters suitable for reuse or for disposal.
- Liquified gas (LPG) storage vessels for propane and similar gaseous fuels at a pressure sufficient to maintain them in liquid form. These are usually spherical vessels or bullets (horizontal vessels with rounded ends).
- Storage tanks for crude oil and finished products, usually vertical, cylindrical vessels with some sort of vapor emission control and surrounded by an earthen berm to contain liquid spills.
- ^ J.H. Gary and G.E. Handwerk (1984), Petroleum Refining Technology and Economics, 2nd Edition, Marcel Dekker, ISBN 0-8247-7150-8
- ^ W.L. Leffler (1985), Petroleum refining for the nontechnical person, 2nd Edition, PennWell Books, ISBN 0-87814-280-0
- ^ James G. Speight (2006), The Chemistry and Technology of Petroleum, 4th Edition, CRC Press, ISBN 0-8493-9067-2
- ^ 150 Years of Oil in Romania
- ^ World Events: 1844-1856
- ^ Brian Black (2000), Petrolia: the landscape of America's first oil boom, John Hopkins University Press, ISBN 0801863171
- ^ Same as References 1 and 2
- ^ Refinery flowchart (From the website of Universal Oil Products)
- ^ Sulfur production report (From the website of the United States Geological Survey)
- ^ Discussion of recovered byproduct sulfur
- ^ Products made from a barrel of crude oil U.S. Department of Energy, Energy Information Administration.
- ^ Same as References1 and 2
- ^ Henry Z. Kister (1992), Distillation Design, 1st Edition, McGraw-Hill, ISBN 0-07-034909-6
- ^ Milton R.Beychok (1967), Aqueous Wastes from Petroleum and Petrochemical Plants, 1st Edition, John Wiley & Sons, Library of Congress Control Number 67019834
- ^ Same as Reference 14
- Milton Beychok