Just count the number of seconds that pass between a flash of lightning and the crack of thunder that follows it, then divide that number by five. The resulting number will tell you how many miles away you are from where lightning just struck.
Five seconds, for example, indicates the lightning struck 1 mile away, and a 10-second gap means the lightning was 2 miles away.
This technique is called the "flash-to-bang" method, and it can keep you safe during rainy summer weather. The National Weather Service recommends taking cover if the time between the lightning flash and the rumble of thunder is 30 seconds or less, which indicates the lightning is about 6 miles away or closer.
This method is based on the fact that light travels much faster than sound through the atmosphere: Light travels at 186,291 miles per second (299,800 km/s), whereas the speed of sound is only about 1,088 feet per second (332 meters per second), depending on air temperature.
For metric-system conversions, follow this method: Sound travels at about 340 m/s, so multiply the number of seconds you counted by 340, and you'll know how many meters away lightning struck. A three-second count, then, would place the lightning strike about 1,020 m away, or roughly 1 km.