Gigi Tools

Phone Compass

Use your phone's magnetometer and gyroscope to detect direction, displaying a real-time compass for orientation and outdoor navigation.

Compass
30°60°120°150°210°240°300°330°NESW

Current Heading

0° N

How to Use
  1. Open this page on your phone (iOS users must tap "Enable Orientation Sensors" to grant permission).
  2. Hold your phone horizontally or place it flat on a surface.
  3. The compass dial automatically rotates so that "N" always points toward magnetic north.
  4. The red triangle at the top indicates the direction your phone is facing; the heading and cardinal direction are shown below.
How It Works

This tool uses the browser's DeviceOrientation API to read data from your phone's built-in magnetometer (electronic compass) and gyroscope to determine direction.

On iOS, it uses webkitCompassHeading for an accurate magnetic north bearing. On Android, it calculates heading from the alpha rotation value (heading = (360 - alpha) % 360).

To reduce sensor jitter, values are smoothed using an Exponential Moving Average (EMA), resulting in stable and fluid compass rotation.

Notes
  • The phone compass shows "magnetic north," which differs from "true north" by the magnetic declination angle, varying by geographic location.
  • Nearby magnets, electronic devices, or metal objects can interfere with magnetometer readings. Keep the phone away from such items.
  • If the compass seems inaccurate, try calibrating by moving your phone in a figure-8 pattern in the air.
  • iOS 13 and above requires explicit user permission to access orientation sensors.
FAQ
Why isn't the compass moving?

Possible reasons: 1) Using a desktop computer (no magnetometer); 2) iOS permission not granted (tap "Enable Orientation Sensors"); 3) Browser doesn't support DeviceOrientation API. Use Chrome or Safari on your phone.

How accurate is the compass?

Phone compass accuracy depends on magnetometer quality and environmental interference, typically around ±5-15°. This is sufficient for everyday direction finding but not recommended for precision navigation or professional surveying.

What's the difference between magnetic north and true north?

Magnetic north is the direction of the Earth's magnetic north pole, while true north is the direction of the geographic North Pole. The difference is called "magnetic declination" and varies by location. Professional navigation requires correcting for this.

Is my data sent to a server?

No. All sensor data is processed locally in your browser. No data is ever sent to any server.