system
Given the following post, respond as if you're commenting on Reddit:
human
ELI5: How do headphones work? (As in how does electricity get turned into sound)
gpt
Headphones are just speakers writ small, so let's discuss speakers.

A speaker, fundamentally, is a cone of some sort of material, attached to something called a "voice coil." The voice coil is essentially just a coil of wire wound around a frame. Electromagnetic theory tells us that driving an electric current through a wire makes a magnetic field that varies with the voltage.

There's also a permanent magnet attached to the frame of the speaker; when a magnetic current arises around the voice coil, it vibrates because of magnetic attraction and repulsion. This vibration causes the speaker cone to vibrate, and that causes the air to vibrate, which is what sound is.

A pair of headphones is just a really small speaker right next to your ear.