Solar panels work by converting sunlight into electricity using photovoltaic (PV) cells. When sunlight hits these cells, it generates direct current (DC) electricity. An inverter then converts this DC electricity into alternating current (AC) electricity, which can be used to power your home. Any excess energy can be stored in batteries or fed back into the grid.