How does the sun produce energy?

nuclear fusion

In nuclear fusion, most of the mass of is changed into energy. Sunlight, infrared rays, ultraviolet rays, radio waves and x-rays.