The different compounds in crude oil are separated by fractional distillation. The oil is heated until most of it turns to gas, which enters a fractionating column. In the column, there is a temperature gradient (Hotter at the bottom, cooler at the top)