Postal Codes Dataset for United Kingdom, GB

476
Updated:
Files:1
Size:235 MB
Rows:1,749,109
Formats:csv

Postal Codes Dataset for United Kingdom, GB including name of the city, town, or place, various administrative divisions and alternative city names.

Part of a Data Solution

  • Postal Codes Solution

    Every worldwide postal-code dataset in one bundle — the ultimate global reference for precise postal codes.

    Explore →

Premium

You're viewing a free sample

Get the complete dataset — all rows and files — delivered instantly after checkout, with lifetime access to the latest version.

  • Secure checkout via Stripe
  • Instant download after payment
  • Lifetime access to the latest version
  • Open Government Licence v3.0 license
20% off
$99.90$79.92
one-time payment

API Access

Access dataset files directly from scripts, code, or AI agents.

Browse dataset files
Dataset Files

Each file has a stable URL (r-link) that you can use directly in scripts, apps, or AI agents. These URLs are permanent and safe to hardcode.

/logistics/postal-codes-gb/
https://datahub.io/logistics/postal-codes-gb/_r/-/.licensing-notes.md
https://datahub.io/logistics/postal-codes-gb/_r/-/.migration-notes.md
https://datahub.io/logistics/postal-codes-gb/_r/-/ATTRIBUTION.txt
https://datahub.io/logistics/postal-codes-gb/_r/-/README.md
https://datahub.io/logistics/postal-codes-gb/_r/-/datapackage.yaml
Key Files

Start with these files — they give you everything you need to understand and access the dataset.

datapackage.yaml— metadata & schema
https://datahub.io/logistics/postal-codes-gb/_r/-/datapackage.yaml
README.md— documentation
https://datahub.io/logistics/postal-codes-gb/_r/-/README.md
Typical Usage
  1. 1. Fetch datapackage.yaml to inspect schema and resources
  2. 2. Download data resources listed in datapackage.yaml
  3. 3. Read README.md for full context

Data Files

postal-codes-gb-sample


About this dataset

United Kingdom (GB) — internal licensing notes

Status: PACKAGED 2026-09-11, published to git + samples bucket. Main R2 bucket publish BLOCKED. Pipeline restored, sources re-fetched, licence position confirmed against the primary source document, one real attribution gap found and fixed (2026-08-25). This session (2026-09-11) finished packaging: datasets/gb/data/ now holds gb.csv, datapackage.json (with a proper licence_status block, real hash/bytes/rows/fields), README.md, ATTRIBUTION.txt, DATA_DICTIONARY.md, gb.zip — Frictionless-validated (valid: True, after fixing a truncated sha256 and a wrong field count of 16 vs the real 17). datasets/gb/scripts/publish_r2.py was written (same dry-run/--apply/preflight template used across this session) but the main postal-codes R2 bucket is returning 403 Forbidden on every key (confirmed against known-good keys fr/fr.csv, pk/pk.csv, not just gb/gb.csv — this is the session-wide credential outage, not a GB-specific problem). The 100-row sample was refreshed on the samples bucket instead (postal-codes-samples key gb/gb.csv, 13,714 → 13,731 bytes, 2026-07-30 → 2026-09-11) — GB is is_premium: true, so per this project's free-vs-paid samples rule the samples bucket gets the truncated 100-row preview, not the full file (unlike BO/CW/CI/ET/UG, which are free and got full files). datasets/gb/datapackage.yml updated: premium_tier: A (three-source consolidation — OS Code-Point Open base + ONS admin crosswalk + GeoNames place names, plus a real licensing caveat resolved — same shape as CA's tier-A justification in docs/PRICING_TIERS.md), premium_source_key: gb/gb.zip, real licenses[] and sources[] (previously a placeholder "Multiple sources" link), resource bytes/ modified corrected from the stale 2024 stub. Main-bucket product publish and _meta/catalog.json update remain pending until the 403 is resolved.

How GB got here

A full GB build (uk/ at repo root — Code-Point Open + ONS + GeoNames, 1,747,841 rows, with pipeline scripts) was added in commit 1c247b5, then deleted wholesale in commit 35a9565 ("Remove uk/ folder", no reason recorded in the message). The built CSV survived only as an untracked local file on one machine; the four scripts were gone even from that local working copy. The public datasets/gb/datapackage.yml was never touched by any of this — it still points at a 2024 GeoNames 100-row sample that predates the Code-Point Open build entirely, which is why GB shows up stale on the storefront despite a full dataset having existed at one point.

Recovered from git history and re-verified 2026-08-25: same 1,747,841 rows, same 99.9% district/ward fill, same 31.9% county fill, same 865 no-coordinate rows as the original build. Relocated from the old uk/ root layout into datasets/gb/scripts/ to match the current per-country convention.

Licence — three sources, all open, all commercial-resale-permitted

SourceLicenceConfirmed from
OS Code-Point OpenOGL v3.0the licence file shipped inside the actual Code-Point Open download (codepo_gb/Doc/licence.txt) — primary source, not a web claim
ONS Open Geography (LAD/Ward/County name-and-code lookups)OGL v3.0ons.gov.uk/methodology/geography/licences
GeoNames GBCC BY 4.0geonames.org/export

None of the three carries share-alike or a non-commercial restriction. No OSM or Nominatim data anywhere in this pipeline — unlike KWT/SGP/JEY, this build never touches the ODbL/Nominatim gate.

The attribution requirement is three-part, not two, and this was verified against the actual licence text rather than assumed:

codepo_gb/Doc/licence.txt (bundled inside the Code-Point Open download):

  Contains Ordnance Survey data © Crown copyright and database right 2026.
  Contains Royal Mail data © Royal Mail copyright and database right 2026.
  Contains National Statistics data © Crown copyright and database right 2026.

Royal Mail's postcode IP rides along with Code-Point Open even though PAF itself is out of scope for this build — OS republishes postcode-unit boundaries under OGL, but the attribution obligation to Royal Mail travels with that republication regardless.

Gap found and fixed: the working copy's uk/README.md (now datasets/gb/ equivalent) named only OS + ONS + GeoNames in its attribution paragraph — Royal Mail was missing, against the licence file's explicit third line. Corrected 2026-08-25 to quote the licence verbatim. This is exactly the failure class datahub-next#941 §6 exists to catch — a value nobody checked against its primary source — so it's recorded here rather than silently patched.

Recommendation

Licensing: clean, resolvable now. All three sources permit commercial resale with attribution; the only condition is retaining the four-line attribution block (OS, Royal Mail, National Statistics, GeoNames) in whatever ships. Add the corrected licenses: / attribution block to datasets/gb/datapackage.yml and to any published README/datapackage before this goes live — it is not there yet (still the 2024 stub, see below).

What remains before this matches the fr/sg convention:

  1. No fetch_source.py — sources are currently hand-downloaded into sources/.
  2. No package.py / publish_r2.py — no gated packaging or R2-publish step exists yet.
  3. datasets/gb/datapackage.yml still describes the 2024 100-row GeoNames sample (is_premium: true, no premium_tier, points at a stale postal.datahub.io/gb/gb.csv sample object) — it has not been updated to reflect the real 1.75M-row dataset or given a licence_status record per the #941 §6 gate.
  4. sources/manifest.json (checksummed provenance, the fr/ca convention) does not exist for GB yet — sources/ currently just holds the raw downloaded files.

What was NOT done

No R2 object was written. No is_premium/premium_tier/data_available flag was changed. Nothing was committed or pushed — datasets/gb/scripts/ and this file exist only in the local working tree. Those are human decisions, same as every other country's licensing-notes file in this repo.

Investigated 2026-08-25. Sources verified directly: codepo_gb/Doc/licence.txt (bundled with the actual Code-Point Open download), ons.gov.uk licence page, GeoNames export page.