UK Address & Postcode Validator

A UK address validator checks that an address is laid out to Royal Mail conventions and that its postcode is structurally valid and consistent with the stated post town.

Paste an address and the validator extracts the postcode, checks it against the Royal Mail structural rules, cross-checks the district against the post town, and returns the address rewritten in the Royal Mail layout with the post town in capitals and the postcode last. Errors and warnings are reported separately, so a well-formed address with an unexpected post town is not confused with an invalid one.

Options

NameTypeDefaultDescription
addressstringThe address to validate, comma or newline separated.

Use cases

  • Debugging rejected addresses: Find out precisely why a postcode fails validation — an excluded letter, the wrong length, or a malformed inward code.
  • Data cleaning: Normalise imported address data into the Royal Mail layout before loading it into a system.
  • Building your own validator: Compare your implementation against a reference that enforces the full rule set, including the excluded letters.

REST API

GET /api/v1/addresses/validate

curl "https://ukaddressgenerator.org/api/v1/addresses/validate?address=12%20High%20Street,%20Manchester,%20M20%208DP"
{
  "status": "success",
  "data": {
    "isValid": true,
    "standardisedAddress": {
      "lines": ["12 High Street", "Didsbury", "MANCHESTER", "M20 8DP"],
      "postTown": "MANCHESTER",
      "postcode": "M20 8DP",
      "country": "England"
    },
    "postcode": { "formatted": "M20 8DP", "isValid": true, "format": "A99", "area": "M", "district": "M20", "sector": "M20 8", "unit": "DP", "matchedPostTown": "MANCHESTER" },
    "errors": [], "warnings": [],
    "message": "The address is structurally valid and formatted to Royal Mail conventions."
  }
}

Frequently asked questions

Does this confirm that an address exists?

No. It is a structural validator. Confirming that a property exists and receives post requires licensed Royal Mail PAF data.

What is the difference between an error and a warning?

An error means the address cannot be valid — for example a malformed postcode. A warning means it is well formed but suspicious, such as a district whose post town does not appear in the address.

Does it accept GIR 0AA?

Yes. GIR 0AA is a genuine historic postcode and is handled as a special case.

Related tools