Diesel fuels are used primarily in automobile and marine diesel compression ignition engines. Diesel engines rely on pistons within the engine cylinder to compress and heat air, rather than using spark plugs. When diesel fuels are injected into the cylinder containing the heated compressed air they burn almost immediately. Unlike diesel engines, gasoline engines compress air and fuel together at lower pressures in a combustion chamber until a spark ignites the mixture. Diesel fuels can offer significantly more miles per gallon (depending on the grade) compared to gasoline fuels. The reason behind this is high compression and energy density. Diesel fuel contains heavier hydrocarbon molecules than gasoline, which keeps it from evaporating as easy. The heavier the hydrocarbon, the greater the energy densities. This is because there are more hydrogen and carbon atoms available to react with oxygen. The higher compression rates in diesel are due mostly to the fact that air is compressed without fuel before the fuel is actually added. So, when the diesel fuel is finally added there is significantly more oxygen in the chamber to burn it. This compression ratio is the reason that diesel engines offer more power at lower engine speeds than a gasoline engine. However, diesel engines cannot move as fast as gasoline engines, because the diesel pistons have more compressed air to deal with. The power of a diesel piston stroke is much stronger, but it is also much slower. This is why diesel engines are particularly useful for commercial applications that do not require high engine speeds, but need the ability to pull heavy loads.
Diesel is cheaper to produce and refine because crude oil naturally contains more diesel range molecules than gasoline range molecules. Diesel engines also tend to require less maintenance because of the lack of an electric ignition system.