The UK Telephone Numbering Plan, and the Numbers Reserved for Fiction
Test data · August 2026 · 6 min read
How UK dialling codes are structured, why 020 7946 0xxx exists, and how to generate test phone numbers that cannot possibly ring a real person.
If your test suite generates UK phone numbers from a real area code and random digits, some of those numbers belong to real people. Ofcom publishes a solution.
How UK numbers are structured
A UK number is normally eleven digits including the leading zero, though some are ten. The structure is a national significant number split into an area code and a subscriber number:
Area codes vary in length, which is the detail most validators get wrong:
- Two digits after the zero: 020 (London), 023 (Southampton and Portsmouth), 024 (Coventry), 028 (Northern Ireland), 029 (Cardiff) — followed by eight local digits.
- Three digits: 0113 (Leeds), 0121 (Birmingham), 0131 (Edinburgh), 0141 (Glasgow), 0151 (Liverpool), 0161 (Manchester), 0191 (Tyneside) — followed by seven digits.
- Four or five digits: most of the rest, such as 01865 (Oxford) or 015394 (Hawkshead) — followed by six, five or occasionally four digits.
So "020 7946 0000" is a London number where the area code is 020 and the local number is 7946 0000. Writing it "0207 946 0000" is a common and persistent error; there is no 0207 area code.
In international format, drop the leading zero and prefix +44: +44 161 496 0000.
The ranges reserved for drama
Ofcom's National Telephone Numbering Plan sets aside blocks that are never allocated to a subscriber, specifically so that television, film, radio and print can show a number without a real person receiving the calls. They are equally suited to software test data.
Each block gives you a thousand numbers, which is more than enough for a test suite, and every one of them is guaranteed dead.
Why this matters more than it sounds
Test data escapes. A staging job runs against a production SMS gateway; a marketing import picks up the wrong CSV; a demo dials out. When the numbers are real, someone's phone rings — repeatedly, if the job retries. Using reserved ranges makes that class of incident impossible rather than unlikely.
Validating UK numbers
A reasonable structural check:
function normaliseUkNumber(input) {
return input
.replace(/[^\d+]/g, '')
.replace(/^\+44/, '0')
.replace(/^44(?=\d{10})/, '0');
}
function isPlausibleUkNumber(input) {
const digits = normaliseUkNumber(input);
if (!digits.startsWith('0')) return false;
if (digits.length < 10 || digits.length > 11) return false;
return /^0(1|2|3|7|8)/.test(digits);
}
For anything beyond a structural check — knowing whether a specific number is allocated, portable or reachable — you need a numbering-plan data source or a live lookup. A regular expression cannot tell you that.
Generate reserved-range numbers with the UK phone number generator.
More guides
- The UK Postcode Format Explained: Areas, Districts, Sectors and Units
- Royal Mail Address Formatting: How to Lay Out a UK Address Correctly
- How UK Address Generators Work — and How to Tell a Good One
- Using Real Customer Data in Test Environments: The UK GDPR Problem
- Why Your Address Form Rejects Perfectly Valid UK Addresses
- Validating UK Postcodes in JavaScript, Python and SQL
- Where UK Address Data Comes From: PAF, ONSPD, OS Open Names and AddressBase