The name "octane" comes from the following fact: When you take crude oil and "crack" it in a refinery, you end up getting hydrocarbon chains of different lengths. These different chain lengths can then be separated from each other and blended to form different fuels. For example, you may have heard of methane, propane and butane. All three of them are hydrocarbons. Methane has just a single carbon atom. Propane has three carbon atoms chained together. Butane has four carbon atoms chained together. Pentane has five, hexane has six, heptane has seven and octane has eight carbons chained together.
It turns out that heptane handles compression very poorly. Compress it just a little and it ignites spontaneously. Octane handles compression very well -- you can compress it a lot and nothing happens. Eighty-seven-octane gasoline is gasoline that contains 87-percent octane and 13-percent heptane (or some other combination of fuels that has the same performance of the 87/13 combination of octane/heptane). It spontaneously ignites at a given compression level, and can only be used in engines that do not exceed that compression ratio.
During WWI, it was discovered that you can add a chemical called tetraethyl lead (TEL) to gasoline and significantly improve its octane rating above the octane/heptane combination. Cheaper grades of gasoline could be made usable by adding TEL. This led to the widespread use of "ethyl" or "leaded" gasoline. Unfortunately, the side effects of adding lead to gasoline are:
- Lead clogs a catalytic converter and renders it inoperable within minutes.
- The Earth became covered in a thin layer of lead, and lead is toxic to many living things (including humans).
When lead was banned, gasoline got more expensive because refineries could not boost the octane ratings of cheaper grades any more. Airplanes are still allowed to use leaded gasoline (known as AvGas), and octane ratings of 100 or more are commonly used in super-high-performance piston airplane engines. In the case of AvGas, 100 is the gasoline's performance rating, not the percentage of actual octane in the gas. The addition of TEL boosts the compression level of the gasoline -- it doesn't add more octane.