This animation describes the working principles of diesel engines in the context of an inline-four engine that operates in a four-stroke mode. This kind of engine has four cylinders mounted in a straight line. Unlike the typical Otto-cycle engine, a diesel engine takes in only air through the intake valves during the 1st stroke. During the 2nd stroke, the intake valves are closed and the air is compressed. As the air is highly compressed in the cylinder, the temperature of the air rises and reaches almost 1300 degrees Fahrenheit. In the 3rd stroke, diesel fuel is injected directly into the cylinder. The fuel instantly ignites because of the high temperature of the air. The explosion pushes the piston down, which transfers power to the crankshaft. The 4th stroke is the process where the spent fuel-air mixture exits through the open exhaust valves and the stroke cycle is repeated again. A big advantage of diesel engines is that they typically deliver 25-30 % better fuel economy than similarly performing gasoline engines.