Send a mono sound to the left and right channels at different ratios, and the brain perceives it as coming from a particular direction. The Web Audio API's StereoPannerNode.pan controls this from -1 (full left) to 1 (full right), with 0 dead center. Equal-power panning keeps perceived loudness constant as a sound sweeps across, instead of dipping in the middle.
Notification and UI sounds mostly stay locked at center (0) so they're never missed regardless of which ear is closer. Active panning is reserved for cases where spatial information itself carries meaning — a footstep sound from the left in a game, or distinguishing two panels in an app. Perception differs between headphones and speakers, and panning disappears entirely on a phone's single mono speaker, so panning alone should never be the only signal carrying information.
Used for directional game sound effects, multitrack music mixing, and left/right-positioned notifications (e.g. a collaborator's cursor side in a collab tool).
When to use
Reserve it for when spatial/directional information itself matters. Keep notification sounds centered (pan=0) by default.