Technically speaking, the sun is, in fact, not a source of inexhaustible energy, since every star eventually burns out. However, the sun's internal fuel supply will keep it burning for at least six billion years, enough to be considered inexhaustible for all practical purposes. The sun's nuclear furnace provides as much as 174 petawatts of solar energy to the planet, approximately 70 percent of which is absorbed by the surface.
While the sun provides plenty of energy to Earth and its denizens, harnessing that energy can be tricky. Photovoltaic solar panels can convert sunlight to electricity, but as much as 80 percent of the incoming energy may get lost in the conversion process. Other solar energy methods use the sun's heat instead, focusing it to boil water and to use that water to drive a steam turbine.
The sun's energy comes from a fusion reaction driven by its internal supply of hydrogen and helium. The matter at the heart of the sun is so dense that its gravitational pull causes atoms to fuse together, forming new structures and releasing particles that then fuse with other atoms. These reactions release enormous amounts of energy that radiate out through the sun's surface as light, heat and charged particles.