Random Dunfermline Postcode Generator

These postcodes are structurally valid but fictional, for software testing and form design. This is not a Royal Mail postcode lookup: the Dunfermline districts are real, the full postcodes are not assigned to any address.

A random Dunfermline postcode generator combines a real Dunfermline postcode district with a generated inward code, producing a structurally valid postcode that is not assigned to any delivery point.

Every postcode on this page starts from a genuine Dunfermline postcode district. There are 2 of them, in the KY postcode area, and they all belong to the DUNFERMLINE post town in Fife. The three characters after the space are generated to the Royal Mail format rules, so a result validates in any form or database while belonging to no real property.

Example Dunfermline postcodes

Need whole addresses instead?

This page produces postcodes on their own. For complete Dunfermline addresses — building number, street, locality, post town, Fife and postcode, laid out to Royal Mail conventions — use the random Dunfermline address generator.

How a random Dunfermline postcode is built

A UK postcode splits into an outward code and an inward code. The outward code identifies the district; the inward code narrows it to a small group of properties. This generator keeps the first half real and generates the second, which is what makes the output safe to use and still valid.

Outward code — real
One of Dunfermline's 2 genuine districts is chosen: KY11 and KY12. This is why a result is geographically coherent — the area, district, post town, county and country all agree.
Inward code — generated
One sector digit and two unit letters, drawn only from the permitted alphabet. C, I, K, M, O and V never appear in the final pair, because Royal Mail does not use them there.
The result
A postcode that passes structural validation and resolves to Dunfermline on any district lookup, while not being a live delivery point. It must not be used to send post or to imply a real address.

The 2 postcode districts serving Dunfermline

Dunfermline sits in the KY postcode area. Every district below is a real outward code assigned to the DUNFERMLINE post town.

DistrictLocalityStructural range
KY11—KY11 0AA – KY11 9ZZ
KY12—KY12 0AA – KY12 9ZZ

The structural range is what the postcode grammar permits for each district, not a list of codes Royal Mail has issued. Which sectors and units are actually allocated is Postcode Address File data, which is licensed and not held here — so a generated postcode inside the range may well be unallocated. For test data that is the point.

No locality names are listed for these districts. A locality is only recorded where a district is genuinely known by that neighbourhood name; where that was not established with confidence, the field is left empty rather than filled in with a guess.

What a Dunfermline postcode tells you

A postcode carries more than a location. Reading one from Dunfermline tells you which country's addressing conventions apply, which council area the address sits in, and — if you need a matching telephone number — which dialling code area it falls in.

FieldValueWhere it comes from
Post townDUNFERMLINERoyal Mail post town, written in capitals on the address
Postcode areaKYThe leading letters of every district above
Council areaFifeONS administrative geography
CountryScotlandOne of the four countries of the United Kingdom
RegionScotlandThe country name
Dialling code01383Ofcom National Telephone Numbering Plan

Royal Mail has not required a county line on addressed mail since 1996. DUNFERMLINE plus a correct postcode is sufficient; Fife is included because plenty of address forms and legacy databases still expect a county.

What Dunfermline postcodes are useful for

What they are not for: sending post, verifying an identity, or implying that a property exists. If you need to know whether a Dunfermline address is deliverable, that is a licensed Royal Mail Postcode Address File lookup, and no generator can answer it.

Frequently asked questions

Are these real Dunfermline postcodes?

The districts are real: all 2 of them are Royal Mail outward codes genuinely assigned to the DUNFERMLINE post town. The three characters after the space are generated, so the full postcode is almost certainly not allocated to any property. That combination is deliberate — the result resolves to Dunfermline in a district lookup and passes validation, but it is not a live delivery point and must never be used to send post.

How many postcode districts does Dunfermline have?

2, in the KY postcode area: KY11, KY12. That is the count for the DUNFERMLINE post town as recorded in this site's registry; a post town does not follow council boundaries, so it may not match what a resident would call "Dunfermline".

What is the postcode area for Dunfermline?

KY. The postcode area is the leading letter or letters of the outward code, so every Dunfermline postcode begins KY — for example KY11. The digits that follow identify the district within the area.

How is this different from the Dunfermline address generator?

This page generates postcodes on their own and explains Dunfermline's district structure. The Dunfermline address generator produces complete postal addresses — building number, street, locality, post town, county and postcode — laid out to Royal Mail conventions. Use this page when you need postcodes to test a postcode field; use the address generator when you need whole addresses.

Can I generate Dunfermline postcodes through the API?

Yes, with no API key. Call GET /api/v1/postcodes/random?location=dunfermline&count=25 for JSON. Add &seed=1 to get the same set back on every request, which keeps snapshot tests stable. The response carries the outward code, inward code, area, district and sector for each postcode alongside the post town and county.

Will these postcodes pass validation?

Structural validation, yes: the format, the length and the excluded letters are all respected, so a correctly written regex or a library check will accept them. A validator backed by licensed Postcode Address File data will reject most of them, correctly, because the full postcode is not an allocated delivery point. If your test suite needs addresses that pass a PAF lookup, no generator can supply them.

Postcodes for nearby post towns

Related pages

Postcodes are generated on demand and never stored. They are for software testing and development only, and must not be used to send post, to imply a real address, or for identity verification.