Joseph S. Merola, a chemistry professor and associate dean of the College of Arts and Sciences at Virginia Tech, offers this explanation:

Joseph S. Merola

Although we don't usually associate automobiles with chemistry, a lot of chemistry takes place in a working car--the burning of gasoline to run the engine, for example, and chemical reactions in the battery to generate electricity. Another reaction--one that most drivers would just as soon not experience firsthand--involves the air bag. Air bags are not inflated from some compressed gas source but rather from the products of a chemical reaction. The chemical at the heart of the air bag reaction is called sodium azide, or NaN3.

CRASHES trip sensors in cars that send an electric signal to an ignitor. The heat generated causes sodium azide to decompose into sodium metal and nitrogen gas, which inflates the car's air bags.

Under normal circumstances, this molecule is quite stable. If heated, though, it will fall apart. The chemical equation 2 NaN3 --> 2 Na + 3 N2 describes exactly how it falls apart. Notice that the second product of the above reaction is N2, also known as nitrogen gas. A handful (130 grams) of sodium azide will produce 67 liters of nitrogen gas--which is enough to inflate a normal air bag.

Air bag animation
0.03 SECOND is all it takes to inflate an air bag.

That's not the only chemistry involved. Notice that the other chemical into which sodium azide falls apart is Na, or sodium. Sodium is a very reactive metal that will react rapidly with water to form sodium hydroxide; as a result, it would be quite harmful if it got into your eyes, nose or mouth. So to minimize the danger of exposure, air bag manufacturers mix the sodium azide with other chemicals that will react with the sodium and, in turn, make less toxic compounds.

What prompts an air bag to inflate by way of this reaction? There are sensors in the front of the automobile that detect a collision. These sensors send an electric signal to the canister that contains the sodium azide and the electric signal detonates a small amount of an igniter compound. The heat from this ignition starts the decomposition of the sodium azide and the generation of nitrogen gas to fill the air bag. What is particularly amazing is that from the time the sensor detects the collision to the time the air bag is fully inflated is only 30 milliseconds, or 0.03 second. Some 50 milliseconds after an accident, the car's occupant hits the air bag and its deflation absorbs the forward-moving energy of the occupant.