In theory, diesel engines and gasoline engines are quite similar. They are both internal combustion engines designed to convert the chemical energy available in fuel into mechanical energy. This mechanical energy moves pistons up and down inside cylinders. The pistons are connected to a crankshaft, and the up-and-down motion of the pistons — known as linear motion — creates the rotary motion needed to turn the wheels of a car forward.