OpenPostcodes

Dead simple, very quick, rich, straightforward and free UK postcode lookup API - as an HTML page, JSON or Markdown.

Sample Postcodes

Request

curl https://openpostcodes.uk/EX11%201RE.json
import requests

postcode = "EX11 1RE"
response = requests.get("https://openpostcodes.uk/" + postcode + ".json")
data = response.json()
print(data)
const postcode = "EX11 1RE";

fetch("https://openpostcodes.uk/" + encodeURIComponent(postcode) + ".json")
  .then((response) => response.json())
  .then((data) => console.log(data));
OkHttpClient client = new OkHttpClient();

String postcode = "EX11 1RE";
Request request = new Request.Builder()
    .url("https://openpostcodes.uk/" + URLEncoder.encode(postcode, StandardCharsets.UTF_8).replace("+", "%20") + ".json")
    .build();

try (Response response = client.newCall(request).execute()) {
    System.out.println(response.body().string());
}
const axios = require("axios");

const postcode = "EX11 1RE";
const response = await axios.get("https://openpostcodes.uk/" + encodeURIComponent(postcode) + ".json");
console.log(response.data);
<?php
require "vendor/autoload.php";

use GuzzleHttp\Client;

$client = new Client();
$postcode = "EX11 1RE";
$response = $client->get("https://openpostcodes.uk/" . rawurlencode($postcode) . ".json");
$data = json_decode($response->getBody(), true);
print_r($data);
require "httparty"
require "erb"

postcode = "EX11 1RE"
response = HTTParty.get("https://openpostcodes.uk/" + ERB::Util.url_encode(postcode) + ".json")
puts response.parsed_response
postcode := "EX11 1RE"
resp, err := http.Get("https://openpostcodes.uk/" + url.PathEscape(postcode) + ".json")
if err != nil {
    log.Fatal(err)
}
defer resp.Body.Close()

body, _ := io.ReadAll(resp.Body)
fmt.Println(string(body))
var postcode = "EX11 1RE";
using var client = new HttpClient();
var response = await client.GetStringAsync("https://openpostcodes.uk/" + Uri.EscapeDataString(postcode) + ".json");
Console.WriteLine(response);

Response

FieldTypeNullableDescription
postcodestringPostcode in canonical format, with the space
partobjectPostcode components
part.outcodestringOutward code - before the space, e.g. EC1A
part.incodestringInward code - after the space, e.g. 1BB
part.areastringPostcode area - the leading letters, e.g. EC
part.districtstringOutward code without any trailing sub-district letter, e.g. EC1 (of EC1A)
part.subdistrictstring✓Outward code including the trailing letter, when present, e.g. EC1A; else null
part.sectorstringOutward code, a space, and the first inward character, e.g. EC1A 1
part.unitstringThe last two letters of the postcode, e.g. BB
latitudenumber✓Latitude of the postcode centroid (WGS84)
longitudenumber✓Longitude of the postcode centroid (WGS84)
open_location_codestring✓Open Location Code (plus code) for the centroid
maidenhead_locatorstring✓Maidenhead Locator (amateur radio grid square) for the centroid
qiblanumber✓Bearing to Mecca, in degrees clockwise from true north
magnetic_declinationnumber✓Angle between true and magnetic north, in degrees east (World Magnetic Model 2025)
eastingsnumber✓OS National Grid easting, in metres
northingsnumber✓OS National Grid northing, in metres
grid_referencestring✓OS grid reference - British National Grid, or Irish Grid for Northern Ireland
utmstring✓Universal Transverse Mercator coordinate for the centroid - zone, MGRS latitude band, easting and northing, e.g. "30U 479645 5621910"
antipodeobject✓The point diametrically opposite on the earth's surface
antipode.latitudenumberLatitude of the antipode (WGS84)
antipode.longitudenumberLongitude of the antipode (WGS84)
elevationnumber✓Ground elevation at the centroid, in metres (GB mainland; OS Terrain 50)
timezonestringIANA timezone (Europe/London, or the Crown Dependency zone)
sunobject✓Today's solar times at the centroid, as local ISO 8601 timestamps to the minute
sun.risestring✓Sunrise - the sun's upper limb at the horizon, allowing for refraction
sun.noonstringSolar noon - the sun crossing the meridian, at its highest point of the day
sun.setstring✓Sunset
countryobjectCountry as { name, code }. name ∈ England, Scotland, Wales, Northern Ireland, Channel Islands, Isle of Man; code is the GSS code
regionobjectRegion as { name, code } (GSS). England only; both null elsewhere
admin_districtobjectLocal authority district as { name, code } (GSS)
wardobjectElectoral ward as { name, code } (GSS)
constituencyobjectWestminster parliamentary constituency as { name, code } (GSS)
countyobjectCounty as { name, code } (GSS); both null where the postcode is not in a county
parish_codestring✓Civil parish (or community) GSS code
censusobject2011 & 2021 census statistical geographies (GSS codes)
census.oa21string✓2021 Census Output Area code
census.lsoa21string✓2021 Lower Layer Super Output Area code
census.msoa21string✓2021 Middle Layer Super Output Area code
census.msoa_namestring✓MSOA friendly name (House of Commons Library; England & Wales)
census.oa11string✓2011 Census Output Area code
census.lsoa11string✓2011 Lower Layer Super Output Area code
census.msoa11string✓2011 Middle Layer Super Output Area code
census.workplace_zone_codestring✓2011 Workplace Zone code
classificationobjectArea classifications and indices
classification.rural_urbanstring✓Rural/urban classification, decoded to text
classification.rural_urban_codestring✓Rural/urban classification code (e.g. RLN1, or 1-6 in Scotland)
classification.output_area_classificationobject2011 Output Area Classification as { name, code } (UK-wide) - supergroup name and code, e.g. 1B1
classification.imdnumber✓Deprivation rank on the relevant country's own index and scale - England's IMD, Scotland's SIMD, Wales's WIMD or Northern Ireland's NIMDM (not comparable across countries); 1 = most deprived; null for the Channel Islands and Isle of Man, which have none
classification.user_typestring✓Postcode user type - “Small” (mostly residential) or “Large”
healthobjectNHS geographies (England; GSS codes)
health.nhs_region_codestring✓NHS England region code
health.icb_location_codestring✓Integrated Care Board sub-location code
health.integrated_care_board_codestring✓Integrated Care Board code
health.cancer_alliance_codestring✓Cancer Alliance code
travel_to_work_area_codestring✓Travel to Work Area GSS code
police_force_area_codestring✓Police Force Area GSS code
national_park_codestring✓National Park GSS code; null when not in a park
built_up_area_codestring✓Built-Up Area (2024) GSS code
county_electoral_division_codestring✓County Electoral Division code (two-tier county areas)
european_electoral_regionobjectEuropean Electoral Region as { name, code } (legacy geography)
date_introducedstring✓Month the postcode was introduced, as YYYY-MM
nearestobject
nearest.railway_stationobject✓Nearest railway station (National Rail, or Translink in Northern Ireland; excludes London Underground and light rail/trams); code is the CRS code where available
nearest.hospitalobject✓Nearest hospital (CQC-registered in England, or from a hand-compiled HSC Trust list in Northern Ireland)
nearest.gpobject✓Nearest GP surgery (CQC-registered in England, or BSO-registered in Northern Ireland)
nearest.schoolobject✓Nearest school (Get Information About Schools in England, or the Scottish Government's school roll in Scotland); no source in scope for Wales or Northern Ireland, which are null
nearest.airportobject✓Nearest airport; code is the IATA code
nearest.bus_stopobject✓Nearest bus stop (NaPTAN, or Translink in Northern Ireland)
nearest.foodbankobject✓Nearest food bank (Give Food)
nearest.defibrillatorobject✓Nearest public-access defibrillator (The Circuit / BHF)
nearest.pharmacyobject✓Nearest pharmacy (OpenStreetMap)
nearest.post_officeobject✓Nearest post office (OpenStreetMap)
nearest.libraryobject✓Nearest library (OpenStreetMap)
nearest.coastobject✓Nearest point on the coast - { distance, latitude, longitude } or null
nearest.londonobject✓Straight-line distance to central London (Trafalgar Square) - { distance, latitude, longitude } or null
utilitiesobject
utilities.electricityobject✓Electricity DNO; null outside GB and Northern Ireland (e.g. Channel Islands, Isle of Man)
utilities.electricity.namestringDistribution Network Operator name
utilities.electricity.region_codestring✓MPAN distributor id, letter form (A-P); null for Northern Ireland, which doesn't use GB's MPAN numbering
utilities.electricity.mpan_idnumber✓MPAN distributor id, number form (10-23) - the same distributor as region_code; null for Northern Ireland
utilities.waterstring✓Water supply undertaker
utilities.seweragestring✓Sewerage services undertaker (often, but not always, the same company as utilities.water)
utilities.broadbandobject✓Fixed broadband coverage (Ofcom Connected Nations, postcode level); null where Ofcom has no matching record for this postcode
utilities.broadband.gigabitnumber% of premises with a gigabit-capable service available
utilities.broadband.superfastnumber% of premises with superfast broadband (SFBB, >=30Mbit/s) available
utilities.broadband.ultrafastnumber% of premises with ultrafast broadband (UFBB, >=300Mbit/s) available
utilities.broadband.below_usonumber% of premises below the Universal Service Obligation (<10Mbit/s download or <1Mbit/s upload, from fixed broadband, a WISP or mobile FWA)
adjacentstring[]Bordering postcodes
boundaryobject✓Approximate postcode boundary as a GeoJSON geometry ({ type, coordinates }, WGS84); Great Britain only - null for Northern Ireland, the Channel Islands and Isle of Man

MCP server

OpenPostcodes is also available as a Model Context Protocol (MCP) server, so AI assistants such as Claude, ChatGPT, Cursor and VS Code can look up postcodes, compare them and browse areas, districts and sectors directly. It is read-only, needs no key or sign-in, and serves the same data as these pages. Add this URL to your assistant as a connector:

https://openpostcodes.uk/mcp

Opened in a browser, the same URL is the MCP page: how to connect, every tool it offers and its limits.