The Tools Pixel Online Compass displays your real-time heading orientation and cardinal direction using your mobile device's hardware compass sensor — processed entirely in your browser with no data sent to any server.
Modern mobile devices contain a micro-electromechanical system (MEMS) sensor called a magnetometer. This sensor measures the strength and direction of magnetic fields surrounding the device, including the Earth's magnetic field. By combining data from the magnetometer, gyroscope, and accelerometer, the operating system estimates the device's physical orientation relative to geographic directions.
Web browsers access this hardware layer via the W3C Device Orientation API. By reading the alpha angle (rotation around the vertical axis), the browser calculates the precise degree rotation from 0° (North) through 360°.
If you suspect your phone's compass reading is drift-prone or stuck, you can calibrate it manually. Hold your phone flat and trace a large 'figure 8' shape in the air two or three times. This forces the device's internal compass registers to re-sample local magnetic vectors, filtering out artificial magnetic noise from your phone casing or nearby electronics.