Phone chargers shrank because they chop power 50,000 times a second
The seeming detour from AC to DC and back again is what lets a tiny transformer do the work.

semiconroom.com · How AC Adapters and Chargers Work: From Wall Outlet to 5 V | Semiconductor RoomThe phone charger in your bag feels impossibly small for what it does, turning wall power into a gentle 5 volts. The secret is not a better transformer. It is a clever detour that lets the transformer shrink.
A modern charger first turns the alternating current from the outlet into direct current, power that flows in one direction. Then a special switch, a transistor built for high voltage and large current, chops that direct current about 50,000 times a second. That is a thousand rapid flicks during a single cycle of the 50 hertz power that comes from a wall outlet.
The chopping looks wasteful, but it is required. A transformer, a pair of coiled wires around a magnetic core that steps voltage down, needs current that keeps changing to operate. Steady direct current induces nothing in the second coil. Flicked repeatedly between passing and blocking, the power looks to the transformer like very fast alternating current.
Speed is what makes the device small. Inside a transformer, current in one coil builds up magnetism, called flux, in the core. The core can only contain so much magnetism before it stops working well. With ordinary wall power, each push lasts about one hundredth of a second, so a lot of magnetism builds up, and the core must be thick with many turns of copper wire.
Chop the power into bursts lasting about one fifty thousandth of a second at most, and far less magnetism has time to build. The core can be thinner, wound with less copper, and the material can change from heavy iron sheets to a lighter ceramiclike material called ferrite.
There is a catch, and it explains why chargers did not shrink overnight. Every flip of the switch wastes a little energy as heat, because for a brief instant both voltage and current are present. Faster switching means more flips and more heat, while a smaller plastic box has less surface to shed it. Chargers get smaller only when engineers find switches that can flip fast without adding much heat.
Questions people ask
What does a transformer actually do inside a charger?
A transformer moves electrical energy from one coil of wire to another without touching wires, using magnetism. Current in the first coil creates a changing magnetic field, and that change creates voltage in the second coil. By using a different number of turns in the two coils, it steps a high voltage down to a low one.
Why not switch millions of times a second and make chargers even tinier?
Engineers do keep pushing speeds higher, and newer materials allow it. But each switching event creates heat, and higher frequencies also waste more energy in the transformer core and wires. At some point the charger would get too hot for its small case, so size is limited by cooling as much as by electronics.
Does a tiny charger still waste power when nothing is plugged into it?
Yes, but very little. Modern rules in the United States and the European Union limit idle draw to 0.1 watts or less for small chargers, or about 0.9 kilowatt hours in a full year. Old chargers with big iron transformers could feel warm when idle because current kept flowing through the transformer.