An oil refinery or petroleum refinery is an industrial process plant where crude oil is processed and refined into more useful products such as petroleum naphtha, gasoline, diesel fuel, asphalt base, heating oil, kerosene, and liquefied petroleum gas. Oil refineries are typically large, sprawling industrial complexes with extensive piping running throughout, carrying streams of fluids between large chemical processing units. In many ways, oil refineries use much of the technology of, and can be thought of, as types of chemical plants. The crude oil feed stock has typically been processed by an oil production plant. There is usually an oil depot (tank farm) at or near an oil refinery for the storage of incoming crude oil feedstock as well as bulk liquid products.
An oil refinery is considered an essential part of the downstream side of the petroleum industry.
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 which can be used as fuels, lubricants, and as feedstocks in petrochemical processes that manufacture such products as plastics, detergents, solvents, elastomers and fibers such as nylon and polyesters.