Random UK Town & City Generator

A UK town generator selects real British post towns at random and returns the county, country, region, postcode areas and dialling code that belong to each.

Every town in the list is a genuine Royal Mail post town, so the output is suitable as reference data as well as test data. Each result carries the county in the correct terminology for its country — ceremonial county in England, council area in Scotland, preserved county in Wales, traditional county in Northern Ireland.

Options

NameTypeDefaultDescription
countryenumFilter by UK country.
slugstringReturn a single post town by slug.

Use cases

  • Dropdown and filter fixtures: Populate town selectors and location filters with real British place names.
  • Regional test coverage: Make sure a test suite covers all four UK countries rather than only English addresses.
  • Content and demo data: Generate believable location data for demos, tutorials and screenshots.

REST API

GET /api/v1/locations

curl "https://ukaddressgenerator.org/api/v1/locations?country=Wales"
{
  "status": "success",
  "total": 57,
  "data": [
    { "slug": "cardiff", "name": "Cardiff", "postTown": "CARDIFF", "country": "Wales", "county": "South Glamorgan", "countyType": "Preserved county", "region": "Wales", "postcodeAreas": ["CF"], "districts": ["CF3","CF5","CF10","CF11","CF14","CF23","CF24"], "diallingCode": "029", "lat": 51.4816, "lng": -3.1791 }
  ]
}

Frequently asked questions

Are these real towns?

Yes. Only the selection is random; every town, county and postcode area in the output is real.

What is a post town?

A post town is the Royal Mail routing label written in capitals on an address. It is not the same as a local-authority area, and it may differ from the name people use for where they live.

Related tools