The Sun is significantly hotter than lightning. The temperature of the Sun's surface, known as the photosphere, is around 5,500 degrees Celsius (9,932 degrees Fahrenheit). However, the core of the Sun, where nuclear fusion takes place, reaches temperatures of about 15 million degrees Celsius (27 million degrees Fahrenheit).
In contrast, lightning is incredibly hot but relatively cooler than the Sun. The temperature of a typical lightning bolt can reach around 30,000 Kelvin (53,540 degrees Fahrenheit), which is roughly five times hotter than the surface of the Sun. Despite its intense heat, lightning is short-lived and localized, whereas the Sun's heat is continuously generated through the fusion of hydrogen into helium in its core, sustaining its high temperatures over billions of years.
It's important to note that the temperature of lightning can vary depending on various factors such as the type of lightning, its duration, and atmospheric conditions. Nevertheless, compared to the Sun, lightning is significantly cooler.