How Does an Online Speedometer Work?

From GPS satellites to your screen in under 2 seconds: a plain-English explanation of how every online speedometer (including this one) measures your real-time speed.

Step 1: How GPS Satellites Power an Online Speedometer

The Global Positioning System (GPS) is a constellation of 31 active satellites orbiting Earth at approximately 20,200 km altitude. Each satellite continuously broadcasts a precise timestamp and its orbital position. Your phone's GPS chip receives signals from four or more satellites simultaneously.

By measuring the tiny time difference between when each signal was broadcast and when it was received, the chip calculates its distance from each satellite. With four distances known, it can pinpoint your exact position in 3D space: latitude, longitude, and altitude. This is the same satellite data this online speedometer reads to show your live GPS speed.

Step 2: Calculating Speed

GPS chips use two methods to calculate speed:

Doppler shift method (primary): Just like a police radar gun, GPS receivers detect the Doppler shift in satellite signal frequency caused by your motion. This gives a near-instantaneous speed reading that is highly accurate: typically within 0.1 m/s.

Position differencing (fallback): When the Doppler method isn't available, speed is derived by dividing the distance between two consecutive position fixes by the elapsed time. Zpeedometer uses the Haversine formula to compute this distance accurately across the curved surface of the Earth.

Step 3: The Web Geolocation API

Zpeedometer uses the W3C Web Geolocation API: a standard built into every modern browser. When you tap Start GPS, the browser asks for your permission to access location data.

Once granted, the API returns a GeolocationPosition object every 1–2 seconds containing:

  • coords.latitude & coords.longitude: your position
  • coords.speed: speed in m/s (null if unavailable)
  • coords.accuracy: estimated position accuracy in metres
  • timestamp: Unix timestamp of the fix

Zpeedometer reads coords.speed first. If it's null, zero, or negative (which some devices return erroneously), it falls back to the Haversine calculation from position deltas.

Step 4: The Haversine Formula

The Haversine formula calculates the shortest distance between two points on a sphere given their latitudes and longitudes:

a = sin²(Δlat/2) + cos(lat1) × cos(lat2) × sin²(Δlon/2)
c = 2 × atan2(√a, √(1−a))
d = R × c  (R = 6,371,000 m)

Dividing d (in metres) by the time elapsed (in seconds) gives speed in m/s, which is then converted to your chosen unit.

Step 5: Rendering the Gauge

The speedometer dial is drawn on an HTML5 <canvas> element using the 2D Canvas API. Each animation frame (via requestAnimationFrame) the gauge is redrawn with:

  • A dark circular face with tick marks at every 10 km/h
  • A colour-graduated arc from blue (slow) through orange to red (fast)
  • A smooth animated needle pointing to the current speed
  • DPR (device pixel ratio) scaling for crisp rendering on retina displays

Privacy Architecture

All of the above happens entirely within your browser tab. No position data, speed data, or any other information is transmitted to Zpeedometer's servers or any third party. The site has no cookies, no analytics, and no user accounts. Your location is yours alone.

Advertisement

Frequently Asked Questions

GPS receivers primarily use the Doppler shift of satellite signals: the same principle as a radar gun. As a fallback, they divide the distance between consecutive position fixes by the elapsed time. This is exactly how the online speedometer on this site calculates the speed shown on the gauge.

A W3C browser standard that lets websites request your device's position with explicit user permission. It can use GPS, Wi-Fi positioning, or cell-tower triangulation.

A formula that calculates the great-circle distance between two latitude/longitude points on a sphere. GPS speedometers use it to compute speed from position deltas when a native speed reading isn't available.

Car speedometers measure wheel rotation, affected by tyre wear and calibration. By law they cannot read below true speed, so they over-read. GPS measures true ground speed from satellite geometry.

Partly. You need a connection to open the page, but once it has loaded, GPS tracking keeps working without mobile data. GPS is a one-way signal from satellites: no internet connection is needed to receive it.

Advertisement

Try the Speedometer