How to Test Your Phone's Sensors
Motion sensors report orientation and movement: the accelerometer measures acceleration including gravity, the gyroscope measures rotation, and the magnetometer provides compass heading. Browsers expose these through motion and orientation events, gated behind permission.
What each sensor does
The accelerometer measures linear acceleration, including the constant downward pull of gravity. That constant is what lets a stationary phone know which way is down, and therefore whether to rotate the screen. The gyroscope measures rotation rate — how fast the device is turning about each axis — which is what makes smooth orientation tracking possible in games and camera stabilisation.
The magnetometer measures the Earth's magnetic field to derive a compass heading. It is the most easily disturbed of the three, because the field it measures is weak and any nearby magnet or ferrous metal overwhelms it.
Checking them in the browser
Motion access requires explicit permission and a secure connection, and on iOS it must be requested from a direct user action. That is why a sensor test starts with a button rather than reading values as soon as the page loads.
Tilt the device through each axis in turn and watch the corresponding value respond. Rotate slowly through a full circle to check the compass. Gentle shaking exercises the accelerometer through a wider range than tilting alone.
Reading unusual results
A value that never changes points at a genuine sensor or calibration fault. Erratic compass readings usually do not — magnetometers are routinely thrown off by speakers, magnetic cases, laptop hinges and metal desks. Move somewhere clear before concluding anything.
No readings at all on a laptop or desktop is normal. Most have no motion sensors of any kind. A few convertible laptops include them for screen rotation, but their absence is the default rather than a fault.
When it is software, not hardware
A screen that will not rotate is far more often a rotation lock than a broken accelerometer. Check that first — it is the single most common cause and takes two seconds to rule out.
Sensor support also varies between browsers. A browser may expose motion but not compass heading, or may require a flag. If readings work in one browser and not another on the same device, the hardware is fine and the difference is in the software.
Test it yourself: Phone Sensor Test
Frequently Asked Questions
Why will my phone screen not rotate?
Rotation lock is the most common cause by a wide margin, so check that before anything else. If the lock is off and the screen still will not rotate, test the accelerometer directly: if tilt values respond correctly, the sensor is fine and the problem is in software.
How do I calibrate my phone's compass?
Move away from metal, magnets and speakers, then rotate the device slowly in a figure-of-eight motion a few times. Most phones recalibrate continuously from that movement. A magnetic case is a frequent and easily missed cause of persistent error.
Why does a website need permission for motion data?
Because motion and orientation readings can reveal more than they appear to, including inferences about a user's environment and activity. Browsers therefore gate access behind explicit consent, and on iOS the request must follow a direct user action.
Can I test sensors on a laptop?
Usually there is nothing to test — most laptops and desktops have no accelerometer, gyroscope or magnetometer. Some convertible laptops include them for screen rotation. Seeing no readings on a desktop is expected, not a fault.
Why can a website not vibrate my iPhone?
iOS Safari does not implement the Vibration API, so no web page can trigger vibration on an iPhone regardless of how it is written. On Android it generally works, provided the device is not in a silent or do-not-disturb mode.
Sources: MDN — performance.now() · MDN — requestAnimationFrame()
Found an error on this page, or a result that does not match your hardware? Tell us and we will correct it.