In its simplest form, thunder is the result of a shockwave that breaks the sound barrier. Thunder forms as the air around a bolt of lightning becomes superheated and explodes, producing a shockwave. This shockwave travels faster than the speed of sound, which produces a sonic boom, just as a fighter jet does when it travels faster than the speed of sound.
Thunder forms nearly instantaneously with lightning. However, because lighting travels at the speed of light and thunder travels at the speed of sound, the two are not perceived simultaneously. The difference between the time at which an individual sees lightning and hears the accompanying thunder is related to the distance between the observer and the lightning bolt. The difference in time between the two events can be used to determine distance from the storm.
To determine distance, an observer can time the seconds between a flash of lightning and a clap of thunder and then divide this figure by five to yield the distance to the lightning bolt in miles. For instance, if there is a 10-second delay between the lightning and thunder, the lightning bolt was approximately two miles away. Likewise, the movement of the storm can be determined by performing this calculation several times in succession. If the time between the lightning and thunder increases, the storm is moving away from the observer.