Diesel is an energy-dense secondary fuel (or energy currency) used to power many heat engines, including cars, trucks, and diesel generators. It can be a petroleum derivative, or it can be made from biomass. Diesel itself is a mixture of hydrocarbons, ranging from C10H20, (decane) to C15H28. The average composition of diesel is C12H23, but it should be restated that this is not actually a molecule, just an average composition.
Diesel is most commonly used a fuel for transportation, specifically. Because it has a higher density than gasoline, the same volume of diesel has more energy than gasoline. This fact, combined with the fact that diesel allows for engines to run much higher compression ratios, allows diesel engines to be more energy efficient than their gasoline burning counterparts. Diesel engines are also different from gasoline in that they don't use spark plugs, instead achieving ignition through compression of the fuel (and a [[glow-plug when the engine is cold). Diesel engines work by having a piston pressurize air, to heat it up (remember the ideal gas law). Fuel injectors then atomize the fuel, turning it into a gas. The heat from the air inside the chamber raises the temperature of the diesel gas until it ignites, which does work.
Petrodiesel is the name for diesel that is derived from petroleum. This diesel usually must be refined to remove sulfur from it. Currently, petrodiesel is more common than biodiesel as a fuel. Petrodiesel is produced through a process called fractional distillation, where crude oil is boiled, and its components separated. Because diesel has a higher boiling point than gasoline, the gasoline separates from the crude oil sooner. This process allows refineries to separate substances like diesel, kerosene, and gasoline from each other.
Biodiesel is diesel that is made from biomass. Biodiesel has lower net emissions than petrodiesel because the carbon it emits was taken from the modern atmosphere when the biomass grows, whereas the carbon released by petrodiesel has been stored in the earth for millions of years.