Spirit Level

Check if a surface is level using your device's accelerometer

Initializing sensor…

How It Works

How It Works

Your device contains a MEMS accelerometer — a tiny chip that measures gravity along three axes. When you hold your phone flat, gravity pulls straight down. When you tilt it, gravity shifts to one side. The DeviceOrientationEvent API exposes two angles:

  • Beta (pitch): front-to-back tilt, from −180° to 180°.
  • Gamma (roll): left-to-right tilt, from −90° to 90°.

The bubble moves toward the high side — exactly like a real spirit level. When both angles are within ±1°, the bubble turns green and the display shows "LEVEL".

Smoothing

Raw sensor readings jitter slightly. This tool applies an exponential moving average (α = 0.2) so the bubble moves smoothly without losing responsiveness.

Zero / Calibrate

Tap Zero to treat the current tilt as the reference flat. This is useful when your device doesn't sit perfectly flat, or when you want to measure tilt relative to an existing surface rather than true horizontal. Tap Reset to return to factory zero.

Axis Modes

  • 2D: circular bubble — checks both axes simultaneously.
  • H (horizontal): tube indicator — checks left/right tilt only. Use on a shelf or countertop.
  • V (vertical): tube indicator — checks front/back tilt only. Use when checking a wall for plumb.

Tips

  • Hold the edge of your phone against the surface for the most accurate reading.
  • On tablets, the larger mass of the device gives more stable readings.
  • iOS requires explicit permission for motion access — tap "Enable Accelerometer" when prompted.
  • The visual bubble range is ±30°. Beyond that, the ring turns red and the numeric readout still shows the true angle.