In an Online UPS, the AC power from the mains is first converted to DC power by a rectifier. This DC power then charges the battery and feeds the inverter, which converts it back to AC power. This double conversion process isolates the equipment from any irregularities in the mains power. If a power outage occurs, the battery immediately takes over, providing uninterrupted power to the connected devices.