How UK Address Generators Work — and How to Tell a Good One

Test data · August 2026 · 6 min read

What separates a generator that produces usable UK test data from one that emits random noise: real districts, internal consistency, and honesty about what is fictional.

Generating a UK address is easy. Generating one that is realistic, internally consistent and safely fictional at the same time is the interesting problem.

The three properties that matter

A useful synthetic address needs to be:

1. Structurally valid — it passes the same validation your production code runs. 2. Internally consistent — the postcode, post town, county and country all agree with each other. 3. Definitely not real — it does not identify a property or a person, and it cannot be used to send post.

Those requirements pull against each other. Maximum realism means using real data; maximum safety means using none. The resolution is to be deliberate about which half of each field is real.

What should be real

The geography. Postcode areas and districts, post towns, dependent localities, counties, countries and dialling codes are all published reference data that describes public infrastructure. Using it makes the output believable and, more importantly, self-consistent.

Consistency is what naive generators get wrong. If a generator picks a street from one list, a town from a second and a postcode from a third, it will happily produce "12 Sauchiehall Street, Manchester, CF10 1EP" — a Glasgow street, an English post town and a Welsh postcode. Any code that cross-checks town against postcode will fail on data like that, and you will spend an afternoon deciding whether the bug is in your validator or your fixtures.

The fix is to treat the location as one unit. Choose a post town, then choose one of *its* districts, then take the county, country, region, coordinates and dialling code from the same record.

What must be fictional

The building. Specifically: the building number or name, the recipient name, the organisation, and the inward half of the postcode.

That last one is the key trick. A postcode's inward code — the digit and two letters after the space — identifies roughly fifteen addresses. Generate it randomly and you get a postcode that is structurally perfect and, overwhelmingly likely, not a live delivery point. Real outward code, generated inward code: passes validation, fails delivery. Exactly right for test data.

Street names deserve care

Attaching a famous street to the wrong town is the second most common realism failure. "Baker Street, Manchester" reads wrong to anyone British.

The way out is to use only street names that genuinely recur across the whole country. High Street, Church Lane, Station Road, Victoria Road, Mill Lane, The Avenue, Manor Road, Springfield Close — these exist in hundreds of towns, so pairing one with any post town produces something plausible. Save regional flavour for genuinely regional patterns: Welsh-language street names in Welsh post towns, Scottish thoroughfare types such as Wynd and Brae in Scotland.

Telephone numbers: the safety issue nobody mentions

Most fake-data libraries build a UK phone number from a real area code and eleven random digits. A meaningful proportion of those numbers are live. When test data leaks into a marketing system or an automated SMS test, real people get the calls.

Ofcom publishes ranges permanently reserved for drama and fiction precisely so this does not have to happen: 020 7946 0xxx for London, 0161 496 0xxx for Manchester, 028 9018 0xxx for Northern Ireland, 029 2018 0xxx for Cardiff, 07700 900xxx for mobiles, and 01632 960xxx for a landline with no geographic association. Those numbers are never allocated to a subscriber. A generator should use nothing else.

The same logic applies to email: RFC 2606 reserves example.com, example.org and example.net for exactly this purpose.

Reproducibility

Random test data is a problem in CI. A snapshot test that regenerates its fixtures on every run fails at random and teaches your team to ignore failures.

A seeded pseudo-random generator solves it: the same seed and the same options produce byte-identical output, so fixtures stay stable and a failing test means something changed in your code. Our API accepts ?seed=1234 for this reason.

A checklist for evaluating any generator

  • Does the postcode's outward code correspond to a real district in the stated town?
  • Does the county belong to the stated country, using that country's own terminology?
  • Do phone numbers come from a reserved range?
  • Do emails use a reserved domain?
  • Does it tell you plainly which fields are real and which are generated?
  • Can you reproduce a dataset from a seed?
  • Does it cover all four UK countries, or only England?

If a generator cannot answer those questions, it is producing noise that looks like data — which is worse than obviously fake data, because it passes review and fails in production.

Try the UK address generator, or read about why UK address forms reject valid addresses.

More guides