Web map scale calculator
Turn a web map's zoom level, latitude and screen DPI into its 1:N scale: zoom 10 at latitude 40.7128 on a 96 DPI screen gives 1:437960, the figure for a scale bar or legend. Free in your browser.
- Free
- Runs in your browser
- No sign-up
- Your data stays on your device
Run — free
Worked example
- Map zoom level
- 10
- Latitude in decimal degrees
- 40.7128
- Dpi
- 96
- Earth radius m
- 6,378,137
- Tile size
- 256
- Meters per pixel
- 115.8767977875
- Scale denominator
- 437,960
A web map scale calculator turns three everyday map-viewer inputs—zoom level, latitude, and screen DPI—into the representative cartographic scale denominator that labels a slippy map as one-to-N. Web maps in Leaflet, OpenLayers, Mapbox, Google Maps, and OpenStreetMap share the Web Mercator (EPSG:3857) tiling model: ground meters per pixel shrink as zoom grows and as you move away from the equator because of the cosine of latitude. This tool applies that closed formula with a stated Earth radius and tile size, then multiplies by DPI over meters-per-inch so the printed or on-screen scale matches what GIS textbooks call representative fraction.
What map scale means on a Web Mercator basemap
Cartographic scale is a ratio of map distance to ground distance, written as the representative fraction one-to-N. On paper maps N is fixed for the sheet; on interactive web maps N changes every time the user zooms or pans toward a different latitude. The Web Mercator projection used by almost every consumer basemap wraps the Earth into a square at zoom zero with two-hundred-fifty-six-pixel tiles, then subdivides each tile into four children per zoom step.
Ground resolution in meters per pixel at the equator is therefore two pi times the WGS84 equatorial radius divided by two-hundred-fifty-six times two to the zoom power. Away from the equator that resolution is multiplied by the cosine of latitude, so the same zoom number is a larger ground footprint near the poles.
Converting meters-per-pixel into a scale denominator requires knowing how large a screen pixel is in meters: screen DPI tells you dots per inch, and one international inch is exactly zero point zero two five four meters, so meters per pixel on the device equal zero point zero two five four divided by DPI. The scale denominator N is ground meters per pixel divided by device meters per pixel—equivalently ground m/px times DPI over zero point zero two five four.
Latitude must stay inside the closed interval from minus ninety to ninety degrees so cosine stays defined for real arithmetic.
What you can do with it
Legend labels on interactive basemaps
Map product teams compute 1:N from current zoom, map-center latitude, and device DPI so the scale bar text stays consistent with Web Mercator math.
Homework and GIS lab answer keys
Instructors verify student calculations of representative fraction from stated zoom, latitude, and screen resolution without opening a desktop GIS.
FAQ
How is web map scale computed from zoom?
The scale denominator is that value times DPI divided by 0.0254 m/inch.
Why do zoom and DPI have to be positive?
Zero or negative zoom would invert or nullify the tile pyramid; zero or negative DPI is not a physical screen density.
Does latitude change the scale at the same zoom?
Yes. Web Mercator ground resolution is multiplied by cos(latitude), so the same zoom is a coarser ground scale near the poles than at the equator.
Is fractional zoom supported?
Yes. Zoom is a finite positive number up to 30, so values like 12.5 match continuous camera zoom in modern web map engines.
Is the web map scale calculator free?
The browser tool is free and runs locally.
Related tools
For developers — API access
Everything on this page is available programmatically. This section is for teams who want to wire it into their own systems; everyone else can just use the tool above.
API endpoint
Prefer to automate it? One authenticated POST creates the task; the result comes back by webhook or a signed link. The same capability also runs here on the web, by email and from Telegram — and soon from our app too.
Call it from your stack
curl -X POST https://api.kit.forhosting.com/geo/map-scale \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"zoom":10,"latitude":40.7128,"dpi":96}'const res = await fetch("https://api.kit.forhosting.com/geo/map-scale", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"zoom": 10,
"latitude": 40.7128,
"dpi": 96
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/geo/map-scale",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"zoom": 10,
"latitude": 40.7128,
"dpi": 96
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/geo/map-scale", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"zoom":10,"latitude":40.7128,"dpi":96}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"zoom":10,"latitude":40.7128,"dpi":96}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/geo/map-scale", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("KIT_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)Example request
{
"zoom": 10,
"latitude": 40.7128,
"dpi": 96
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "geo.map_scale",
"status": "queued",
"_links": {
"result": "/tasks/tsk_…/result"
}
}The API is asynchronous: the call returns a task_id immediately and the result arrives by webhook. Polling is capped at 1 req/s per task.
Pricing
Published price — no tokens, no invented credits. A failed task is never charged.
Limits
min_lat | -90 |
max_lat | 90 |
min_zoom | 1e-12 |
max_zoom | 30 |
min_dpi | 1e-12 |
max_dpi | 1000000 |
Errors
| HTTP | Code | Meaning |
|---|---|---|
401 | unauthorized | Missing or invalid API key. |
402 | insufficient_balance | Your balance doesn't cover the task price. |
404 | unknown_type | That task type doesn't exist. |
429 | rate_limited | Too many requests. Use the webhook instead of polling. |
Technical notes
What map scale means on a Web Mercator basemap
When zoom or DPI is zero or negative the geometry is undefined for a map viewer, so this capability rejects non-positive zoom and non-positive DPI with invalid_input instead of inventing a scale.
How to call the API and what comes back
Zoom must be strictly positive and at most thirty; DPI must be strictly positive and at most one million; latitude must lie between minus ninety and ninety inclusive. Send a JSON body with three required finite numbers: zoom (aliases z and zoom_level), latitude (aliases lat and y), and dpi (aliases screen_dpi and resolution_dpi). On success the response echoes rounded zoom, latitude, and dpi, publishes earth_radius_m as six million three hundred seventy-eight thousand one hundred thirty-seven and tile_size as two hundred fifty-six, returns meters_per_pixel as the ground resolution, scale_denominator as the representative N (rounded to the nearest integer when absolute value is at least one), scale_ratio as the string one-colon-N, formula as the closed expression used, message as a short English summary, and steps as an ordered substitution trace you can show in worksheets or assertions. Failed validation—missing fields, non-finite numbers, latitude out of range, zoom above the published cap, DPI above the published cap, or non-positive zoom or DPI—returns invalid_input and is never charged. Pricing is a flat $0.002 per successful request with unit item and zero marginal unit price.
Practical tips, limits, and related searches
Prefer ninety-six DPI when you want the common CSS / browser reference pixel; use seventy-two only when you are matching legacy print assumptions; use the true device pixel ratio times ninety-six when you care about physical phone or retina panels. Fractional zoom is allowed because modern map engines interpolate between integer tile levels—pass ten point five when the camera sits halfway between ten and eleven. Near the poles the cosine factor collapses meters-per-pixel and therefore N; that is correct for Web Mercator, not a bug, though real apps often clamp latitude near eighty-five degrees for tile coverage. Prefer this capability when you already have zoom, latitude, and DPI and only need one-to-N; if your source is a printed map without a zoom number, measure ground and map distances directly instead. Keep zoom at or below thirty so two-to-the-zoom stays finite in IEEE double precision on the Worker and in the browser. When teaching, pair examples: zoom ten at New York with ninety-six DPI yields a city-scale denominator; the same zoom at the equator is slightly smaller N because cosine is larger; a deliberate dpi of zero or zoom of zero demonstrates the hard invalid_input path. This landing targets people searching for a web map scale calculator, zoom to scale denominator, or Mercator map scale online; it is not a geodesic distance tool, not a print layout engine, and not a tile URL builder. Failed tasks that return invalid_input do not consume prepaid balance, which keeps exploratory scripts cheap when learners deliberately send non-positive DPI. Round-trip checks are easy: recompute cos of latitude in radians times the published initial resolution divided by two to the zoom, multiply by DPI over zero point zero two five four, and confirm the integer denominator matches the published scale_denominator within a unit of ordinary rounding.
Integration use cases
Unit tests for map camera helpers
Developers assert golden scale_denominator values for fixed zoom/lat/DPI triples when testing zoom controls, print preview, or export metadata.