Blog

Why a compass behaves differently near metal objects

Learn why your phone compass shifts near steel, speakers, or magnets, how to check it with TooLab's Sensors Test, and what to try next.

Jason TurnerHardware tests 5 min read

Your phone compass points one way on the sidewalk, then swings when you bring it near a car, a speaker, or a metal desk. That can make it seem broken, even when the sensor is responding normally to a changed magnetic field.

Use the Sensors Test to watch the compass while you move the phone away from possible sources of interference. A repeatable change can help you tell a nearby object from a lasting sensor problem.

Test the compass near and away from metal

  1. Open the Sensors Test on the phone you want to check. If the browser asks for sensor permission, allow it.
  2. Hold the phone flat and still in an open area, away from cars, speakers, metal furniture, and magnetic accessories. Note the compass direction.
  3. Keeping the phone in the same orientation, move it near the object where the direction changes. Do not place it directly on a speaker or magnet.
  4. Move it back to the open area and check whether the original reading returns. Repeat the comparison once or twice, changing only the phone's distance from the object.

Compare the direction rather than expecting a perfectly fixed number. A compass can drift a little as you move or turn the phone, and a browser may not receive sensor data on every device.

What the result means

The direction changes near one object and returns when you move away

The object is probably distorting the magnetic field where the phone is held. Steel furniture, a vehicle body, a magnetic phone mount, and a speaker magnet can all affect a compass. Use the phone farther from that object when you need a dependable direction.

The direction changes when you rotate the phone, but behaves consistently

That is expected. The compass reports direction relative to the phone's position and orientation. Turn the phone, and the reading should change accordingly. To compare two readings, hold the phone in the same position and orientation each time.

The direction stays erratic in an open area

Nearby interference is less likely to be the only cause. A magnetic case, an attached accessory, a sensor calibration issue, or a problem with the phone's compass sensor could be involved. Remove accessories and repeat the test outside, away from vehicles and large metal objects.

No compass reading appears

The phone or browser may not expose compass data to the page, or sensor access may be blocked. This does not prove the compass hardware is faulty. Try another supported browser on the phone and check its sensor permissions.

How to reduce compass interference

  1. Move to an open spot. Step away from cars, steel shelving, filing cabinets, and large appliances. Even if an object is not a magnet, steel can become magnetized and alter the local field.
  2. Remove magnetic accessories. Take off a case with a magnetic clasp, magnetic wallet, or mount, then repeat the comparison. Keep headphones and other accessories with magnets away from the phone while testing.
  3. Calibrate away from metal. If the phone asks you to calibrate, follow its on-screen instructions in an open area. On iPhone, check Settings › Privacy & Security › Location Services › System Services › Compass Calibration and make sure Compass Calibration is enabled. Calibration cannot remove interference while you are standing next to the object causing it.
  4. Check browser sensor access. On recent iPhones, look under Settings › Apps › Safari › Motion & Orientation Access. On older iOS versions, look under Settings › Safari › Motion & Orientation Access. In Chrome on Android, check Settings › Site settings › Motion sensors, and allow access for the page if it is blocked.
  5. Retest without the case. If the reading stays unstable, remove the case and any magnetic mount, restart the phone, and test again in a different open location. This helps separate a phone accessory or browser issue from a sensor fault.

Most Windows 11 desktop computers and Mac computers do not have a built-in compass sensor. There is no Windows or macOS setting that can make a missing compass sensor available to a browser. Use a phone or another device with a compass sensor for this test.

When the compass sensor may be faulty

Suspect a device problem if the reading remains erratic in several open locations, with the case and accessories removed, and after following the phone's calibration prompt. If possible, compare the same phone in another browser and compare it with a second phone in the same place. If only one device behaves badly, contact the phone maker or a repair shop, especially if the issue began after a drop or repair.

A browser test can show how the compass behaves, but it cannot inspect or repair the sensor itself. If the built-in compass also gives unreliable directions in the phone's own compass app, ask the manufacturer about service rather than repeatedly recalibrating beside metal.

Why some metal affects a compass more than others

A phone compass uses a magnetometer, a sensor that measures the magnetic field around the phone. It uses Earth's magnetic field to estimate direction. Iron and many kinds of steel can bend or strengthen that local field, so the phone may report a heading that differs from the direction you expect.

Not every metal has the same effect. Aluminum and copper usually do not pull on a compass the way magnetized steel does. Magnets in speakers, cases, and mounts can create a strong nearby field, while electrical current in wiring can also produce a magnetic field. The practical check is the same: move the phone away, keep its orientation steady, and see whether the reading becomes repeatable.