How inverter works ?

inverter

An inverter converts direct current (DC) electricity from sources like batteries, solar panels, or fuel cells into alternating current (AC) electricity. AC electricity is what most household appliances and devices use.
Inverters work by:
Managing electricity flow
Inverters continuously manage the flow of electricity, charging batteries when the main power is on and switching to backup mode when there’s a power outage.
Using electronic components
Inverters use electronic components like transistors, capacitors, and control circuitry to convert DC to AC.
Using Pulse Width Modulation (PWM)
Modern inverters use PWM to generate the AC waveform.
Using an inductor and capacitor
An inductor and capacitor are added at the output to create a low pass filter, which filters out the high frequency triangle wave to get the low frequency sine wave.
Inverters can operate AC equipment designed for mains operation, or rectified to produce DC at any desired voltage.

inverter-block-diagram How inverter works ?