It's important to note that this is just the average temperature. The Sun's surface is not uniformly heated, with hotter regions like sunspots reaching temperatures of about 3,800 degrees Celsius (6,872 degrees Fahrenheit), and brighter areas called faculae reaching about 6,200 degrees Celsius (11,192 degrees Fahrenheit).
The Sun's core, where nuclear fusion occurs, is much hotter, reaching temperatures of around 15 million degrees Celsius (27 million degrees Fahrenheit).