The US National Oceanic and Atmospheric Administration puts the temperature of a lightning channel at about 30,000 degrees Celsius, and states plainly that this is roughly five times hotter than the surface of the Sun, which sits near 5,500 degrees. The rapid expansion of that superheated air is what produces thunder. Both halves of the claim are correct.
The word that needs care is “hotter.”
What the numbers say
When the main return stroke of a lightning flash surges through the air, it drives an enormous current down a narrow channel. The air cannot carry that current freely, and the resistance converts the electrical energy into heat almost at once. The channel becomes a thread of plasma at around 30,000 degrees Celsius, hotter than the visible surface of the Sun by a factor of about five.
That comparison is exact about one thing and quiet about another. It measures lightning against the Sun’s surface, the photosphere, which at about 5,500 degrees is the coolest layer the Sun puts on show. The Sun’s outer atmosphere, the corona, runs to more than a million degrees. Its core is near 15 million. Lightning is hotter than the part of the Sun we see, not hotter than the Sun.
Temperature is not the same as energy
The more common misreading is to hear “five times hotter than the Sun” and conclude that lightning must be more energetic than the Sun. It is not, by a margin too large to picture.
Temperature measures how much energy each particle carries, not how much energy is present in total. A lightning channel reaches its extreme temperature in a thread of air a few centimetres across, for a few millionths of a second. The Sun holds its lower temperature across a glowing sphere more than a million kilometres wide, without pause, for billions of years. The Sun radiates vastly more energy every second than all the lightning striking Earth releases in a year.
Lightning wins on temperature and loses on everything else: a very hot, very small, very brief event.
How we know the temperature
No instrument is lowered into a lightning bolt to read 30,000 degrees off a dial.
The channel is too hot, too thin and too short-lived for anything like that. The temperature is worked out instead from the light the channel gives off. A glowing gas emits light at particular wavelengths and intensities, and that spectrum carries the signature of its temperature. As a 2016 study in Scientific Reports notes, the channel temperature is hard to measure directly and is instead derived from lightning’s spectrum. It is the same method astronomers use to take the temperature of a star they will never touch, and the same way the Sun’s own surface temperature is measured. In each case the number comes from the glow, not from contact.
Where thunder comes from
The thunder half of the claim is straightforward, and again it is NOAA’s own account. Air heated that fast has no time to expand gently. It is forced outward hard enough to compress the surrounding air into a shock wave, much like the boom from a supersonic aircraft.
Close to the channel, that shock wave is the sharp crack of thunder. As it travels outward it spreads, stretches and softens into the lower rumble heard from a distance. Because the flash runs along a long, crooked channel, the sound reaches you from many points at slightly different times, which is why thunder rolls rather than arriving as a single report.
What to keep from the factoid
The claim is accurate as written. A lightning channel really does reach about five times the temperature of the Sun’s surface, and the violent expansion of that air really is what makes thunder.
The part worth holding on to is the gap between hot and energetic. Lightning is one of the hottest things that happens at Earth’s surface and also one of the smaller energy events in a thunderstorm, let alone beside the star it gets compared with. For a few millionths of a second a thread of air is hotter than the Sun’s surface. By every other measure, the two are not in the same class.