Nearest Town

Give it a latitude and longitude anywhere in the US, and it tells you which town you're in, or which one you're nearest. For example: “2.3 miles NW of Millhousen, IN.”

Your point Town center (Census internal point) Click the map, or enter coordinates:
Examples:
Pick a spot to see the answer here.

Why it exists

A coordinate pair doesn't mean much to most people. “2.3 miles NW of Millhousen, IN” does. Weather alerts, storm reports, field notes and dispatch logs all describe places this way.

For years this site got that answer from the National Weather Service's /points API, which returned a relativeLocation for every forecast point. NWS changed that API in June 2026, so nearest.town now runs its own small API that gives the same kind of answer from the same Census place list.

Why not just reverse-geocode to a street address? Because an address names the post office that serves a point, which in rural areas can be a town many miles farther away than the one you're actually near.

How it works

Each lookup gives exactly one answer, chosen in two steps:

  1. Inside a town? If the point falls within a town's boundary, that town is the answer. Great American Ball Park returns Cincinnati, OH, even though Newport, KY's center is closer across the river.
  2. Otherwise, the nearest center. If the point isn't inside any town, the answer is the town whose center point is closest by great-circle (haversine) distance. This matches how the NWS API used to behave.

In both cases, the distance and direction are measured from the town's center to your point. That's why a point inside Cincinnati still reads “3.0 miles S of Cincinnati, OH”. The direction is rounded to one of 16 compass points (N, NNE, NE, …).

The data

Use the API

The API is free, read-only, needs no key, and allows calls from any website (CORS is open).

Request

GET https://nearest.town/api/nearest/{lat},{lon}
GET https://nearest.town/api/nearest?lat={lat}&lon={lon}

Coordinates are plain decimal degrees (up to 10 decimal places), with latitude between −90 and 90 and longitude between −180 and 180.

Examples

curl https://nearest.town/api/nearest/39.237535,-85.461877
const res = await fetch("https://nearest.town/api/nearest/39.237535,-85.461877");
const place = await res.json();
console.log(place.text);   // "2.3 miles NW of Millhousen, IN"

Response

{
  "query": { "lat": 39.237535, "lon": -85.461877 },
  "town": {
    "name": "Millhousen", "state": "IN", "type": "town",
    "geoid": "1849662", "lat": 39.211988, "lon": -85.434165
  },
  "inside": false,
  "distance": { "meters": 3711, "miles": 2.31 },
  "bearing": 320,
  "direction": "NW",
  "text": "2.3 miles NW of Millhousen, IN"
}
FieldMeaning
queryThe coordinates you sent.
town.name, town.stateTown name and two-letter state (or PR, DC).
town.typeCensus place type, such as city, town, village or CDP.
town.geoidCensus GEOID: 2-digit state FIPS code plus 5-digit place code.
town.lat, town.lonThe town's center (Census internal point).
insidetrue if your point is within the town's boundary.
distanceFrom the town center to your point, in meters and miles.
bearingCompass bearing in degrees (0–359) from the town center to your point.
directionThe bearing as one of 16 compass points.
textA ready-to-display sentence.

Errors and limits

StatusWhen
400Coordinates missing, malformed or out of range.
429More than 600 requests per minute from one IP address. Wait for the number of seconds in the Retry-After header.
404Unknown path.

Error bodies look like {"error": "…"}. Successful answers can be cached for a day. GET https://nearest.town/api/health reports the service status and which data vintage is loaded.

Limitations