The sound of thunder during a thunderstorm is caused by a phenomenon called "thunder." Thunder is the result of the rapid expansion and contraction of the air surrounding a lightning bolt.
When a lightning bolt travels through the atmosphere, it rapidly heats the air along its path to an extremely high temperature, up to 30,000 Kelvin (53,540 degrees Fahrenheit). This sudden increase in temperature causes the air to expand explosively, creating a shock wave that moves outward in all directions from the lightning channel.
As the shock wave propagates through the air, it creates a compression of air molecules, resulting in a rapid increase in air pressure. This sudden increase in pressure generates a sound wave, which is what we perceive as thunder.
The reason we hear thunder after seeing the lightning is because light travels much faster than sound. Light travels at a speed of about 299,792 kilometers per second (186,282 miles per second), while sound travels at a much slower speed of around 343 meters per second (1,125 feet per second) at sea level. Therefore, the light from the lightning reaches our eyes almost instantly, while the sound takes some time to travel to our ears, causing the delay between the flash of lightning and the sound of thunder.
The distance between you and the lightning determines how long it takes for the sound of thunder to reach your ears. By counting the number of seconds between the lightning flash and the thunder, you can estimate how far away the lightning strike occurred. The sound of thunder can travel over long distances, depending on atmospheric conditions, so it can be heard even if the storm is several miles away.