TL;DR
Geocode.xyz provides both forward geocoding (address to coordinates) and reverse geocoding (coordinates to address) with global coverage. It handles full addresses, city names, landmarks, and postal codes. The free tier supports a generous number of requests per day without an API key. Output formats include JSON, GeoJSON, CSV, and XML. Particularly useful for mapping applications, store locators, and spatial data enrichment without paying for Google's API.
Quick start: https://geocode.xyz/51.50354,-0.12768?geoit=json
No API key needed — just make a request!
How to Use This API
1. Reverse Geocode — Coordinates to Address
Converts London coordinates to an address:
https://geocode.xyz/51.50354,-0.12768?geoit=json
2. Forward Geocode — City Name to Coordinates
https://geocode.xyz/paris?geoit=json
3. Full Address Lookup
https://geocode.xyz/1600+Pennsylvania+Ave+Washington+DC?geoit=json
4. JavaScript — Get User Location
navigator.geolocation.getCurrentPosition(pos => {
const { latitude, longitude } = pos.coords;
fetch(`https://geocode.xyz/${latitude},${longitude}?geoit=json`)
.then(r => r.json())
.then(data => {
console.log(`You're near: ${data.city}, ${data.country}`);
console.log(`Postal: ${data.postal}`);
});
});
5. Python — Batch Geocode
import requests
cities = ['London', 'Tokyo', 'Sydney', 'Cairo', 'Rio de Janeiro']
for city in cities:
data = requests.get(
f'https://geocode.xyz/{city}?geoit=json'
).json()
print(f"{city}: {data.get('latt', '?')}, {data.get('longt', '?')}")
https://geocode.xyz/51.50354,-0.12768?geoit=json
Frequently Asked Questions
- What output formats are supported?
- Use
geoit=jsonfor JSON,geoit=xmlfor XML,geoit=csvfor CSV, andgeoit=geojsonfor GeoJSON. Also supportsjsonpfor cross-domain requests. - What is the rate limit for the free tier?
- The free tier allows approximately 1 request per second without an API key. For higher limits, register for a free API key which increases your daily quota.
- Does it support bulk geocoding?
- Yes, you can geocode multiple addresses by separating them with semicolons in the URL. Response will be an array of results.
- How accurate is the geocoding?
- Accuracy varies by region. Major cities and well-known landmarks have precise results. Rural areas may have less accurate coordinates. Street-level data is best in North America and Europe.
- Can I use it for store locator apps?
- Yes, Geocode.xyz is well-suited for mapping applications. Use forward geocoding to plot store locations and reverse geocoding to detect user proximity.
- What is the
lattandlongtin responses? - Note the spelling — the API returns
latt(latitude) andlongt(longitude) as strings. Parse them as floats for calculations.
API Details
- API URL
https://geocode.xyz/- Documentation
- geocode.xyz/api
- Category
- Utility
- Authentication
- Not Required (optional free key for higher limits)
- Geographic Coverage
- Global
What You Can Build
- Store locator page that finds nearby locations from user ZIP code
- Route planning tool that geocodes waypoints for navigation apps
- Address autocomplete widget for checkout forms
- Real estate map that plots property listings by address
- Travel journal app that reverse-geocodes GPS photos to city names