UK Random Address Generator
A UK random address generator creates fictional British postal addresses that follow Royal Mail addressing conventions and use real postcode districts, for use as software test data.
Each address is assembled from one registry entry, so the postcode district, post town, dependent locality, county, country, coordinates and dialling code always agree with one another. Building numbers, building names, recipient names and the inward half of the postcode are generated, which keeps every result fictional and non-deliverable while still passing UK postcode validation. Output can be copied one field at a time or exported in bulk as JSON, CSV, TSV, SQL, XML or Royal Mail envelope text.
Options
| Name | Type | Default | Description |
|---|---|---|---|
count | integer | 10 | How many records to return, from 1 to 1000. |
country | enum | — | Restrict generation to one UK country. |
location | string | — | Post-town slug, for example "manchester" or "cardiff". Takes precedence over country. |
type | enum | all | Delivery point type. |
format | enum | json | Response format. |
subBuilding | boolean | true | Set to false to omit flat, unit and suite lines. |
county | boolean | true | Set to false to omit the optional county line, as Royal Mail permits. |
phone | boolean | true | Set to false to omit telephone numbers. |
recipient | boolean | true | Set to false to omit recipient names. |
tableName | string | uk_addresses | Table name used by format=sql. Letters, digits and underscores only. |
seed | integer | — | Optional. Any integer. The same seed with the same options always returns the same records. |
Use cases
- Checkout and address form testing: Exercise postcode validation, address line limits, optional county handling and buildings with names instead of numbers without touching customer data.
- Database and CI seeding: Populate a staging database with realistic UK addresses using the SQL export, or seed fixtures reproducibly with the seed parameter.
- Delivery and pricing logic: Test postcode-based delivery zones, offshore and Highlands surcharges and Northern Ireland routing with addresses drawn from the right districts.
- Design and documentation: Fill mock-ups, screenshots and user guides with believable British addresses that cannot be mistaken for a real customer.
REST API
GET /api/v1/addresses/random
curl "https://ukaddressgenerator.org/api/v1/addresses/random?count=10&country=Wales"
{
"status": "success",
"count": 1,
"query": { "count": 1, "country": "ALL", "location": "manchester", "type": "residential" },
"data": [
{
"id": "uk_addr_0001_8f3k2",
"recipientName": "Isla Robertson",
"buildingNumber": "42",
"street": "Church Lane",
"locality": "Didsbury",
"postTown": "MANCHESTER",
"county": "Greater Manchester",
"postcode": "M20 4TH",
"outwardCode": "M20",
"inwardCode": "4TH",
"postcodeArea": "M",
"postcodeDistrict": "M20",
"postcodeSector": "M20 4",
"country": "England",
"region": "North West England",
"countryCode": "GB",
"latitude": 53.4791,
"longitude": -2.2503,
"timezone": "Europe/London",
"phone": "0161 496 0287",
"phoneE164": "+441614960287",
"type": "residential",
"isFictional": true,
"formattedSingleLine": "42 Church Lane, Didsbury, Manchester, M20 4TH",
"formattedMultiLine": "42 Church Lane\nDidsbury\nMANCHESTER\nGreater Manchester\nM20 4TH"
}
]
}
Frequently asked questions
- Are the generated UK addresses real?
No. The post town, postcode district, locality, county and country are real, but the building, the street pairing, the recipient and the last three characters of the postcode are generated. Nothing produced is a live Royal Mail delivery point.
- Will the addresses pass postcode validation?
Yes. Each postcode combines a real outward code with an inward code that follows the Royal Mail structural rules, including the excluded letters, so standard validators accept it.
- Can I generate addresses for a specific city?
Yes. Choose a post town in the generator, or open the dedicated page for that town, or call the API with ?location=<slug>.
- How many addresses can I generate at once?
Up to 1,000 per request, in the interface and through the API.