Distance between ZIP codes
Measure the distance between two US ZIP codes in miles and kilometers. Enter the starting and destination ZIPs to compare their locations using straight-line distance along the Earth's surface.
ZIP-to-ZIP distance versus driving distance
The endpoints are reference coordinates for each ZIP, not street addresses. The result is the shortest surface distance between those points. Road routes can be longer because they follow crossings, terrain, and the road network.
Why two addresses in one ZIP can still be far apart
Comparing a ZIP with itself compares the same reference point, so the distance is zero. Addresses within that ZIP can be separated by several miles. Use address-based routing for a particular journey.
Build a ZIP code distance calculator
The Postal API has a distance operation for two ZIP codes. It returns both units and the two places used in the calculation.
- Validate both ZIP codes as strings to preserve leading zeros.
- Call the distance operation once.
- Display distance_mi and distance with the returned endpoints.
Installation steps are included in each example. Set PARSEAPI_KEY on your server. Swift and Kotlin use an app key restricted to your app ID.
// npm install @parseapi/sdk@1.14.0
import { parseAPI } from '@parseapi/sdk';
// Set PARSEAPI_KEY on your server.
const parse = parseAPI();
function zip(value) {
const match = value.trim().match(/^(\d{5})(?:-\d{4})?$/);
if (!match) throw new Error('Enter a five-digit ZIP or ZIP+4.');
return match[1];
}
const from = zip('10001'), to = zip('28202');
const result = await parse.postal.distance(from, to, { country: 'US' });
if (![result.distance, result.distance_mi].every(Number.isFinite)) {
throw new Error('Distance is unavailable.');
}
console.log({ from: result.from, to: result.to,
kilometers: result.distance, miles: result.distance_mi });
How do I calculate distance between two ZIP codes?
Enter a starting and destination US ZIP. The result shows miles and kilometers between the two ZIP reference points.
Is ZIP-to-ZIP distance the same as driving distance?
No. This measures the shortest surface distance between the reference points. A road journey uses actual streets and can have different endpoints and mileage.
Why is the distance within the same ZIP zero?
Both inputs resolve to the same reference point. This does not mean all addresses inside the ZIP are at the same location.
Does ZIP+4 change the distance?
The tool uses the first five digits of each code. ZIP+4 values sharing those digits use the same endpoint.
Can I use postal codes outside the US?
This page accepts US ZIP codes. The Postal API supports its listed countries when coordinate data is available.