When lightning strikes, it superheats the surrounding air into a plasma channel that peaks at roughly 30,000°C (54,000°F). This is the temperature of the bolt itself — a brief, intensely localized event measured in microseconds. Weather.gov and Britannica both cite this figure, describing it as approximately five times hotter than the Sun's visible surface.
The Sun's photosphere — the layer we see as its surface — registers about 5,500°C (10,000°F), according to NASA Science and the High Altitude Observatory. By that comparison, lightning is dramatically hotter. But the Sun's core, where nuclear fusion occurs, reaches around 15 million°C (27 million°F), which dwarfs lightning by several orders of magnitude.
The key distinction is what part of the Sun you compare. Lightning beats the Sun's surface temperature by a factor of roughly five, but it doesn't come close to the Sun's interior. Lightning's extreme heat is also transient — a fleeting plasma spike — rather than the sustained energy output of a star.