UK Telephone numbers

Hey

We have remade several customer order forms at work and I was wondering if anyone has any interesting telephone numbers which I can throw in to the phone number field to exercise it?

I have some standard rules applied - min/max numbers allowed, no characters (+ / - . etc)

Does anyone have any humdingers I can throw in there?

Thanks!

Trixi

1 Like

I worked in telephony, and phone numbers can be a right royal pain.

It depends on what you feel that you need to support.

Full phone numbers are made up of several parts. These parts depend on the country you’re in. So in the UK a standard full phone number is made of a country code OR a trunk code plus an area code plus a unique identifier. In the UK it’s common to include the trunk code with the area code because it’s mandatory for local geographic calling - not all countries share this rule, and international standards also violate it.

So let’s look at this number: 01214960497. This is actually a trunk code 0, plus a detrunked area code 121 (this denotes Birmingham as the area), plus a unique identifier of 4960497. Fun fact: This is in the range that OFCOM (the uk communications regulator) has designated for use in TV and radio programs, so it’s not a real number. This can be useful when testing systems that might actually dial the number.

We can write this as a local number with a trunk code: 01214960497
We can write this as an internal number with a country code: 441214960497

Or we can write it in something called E164 format which is a ITU-T recommended international standard for phone numbers: +441214960497.

And in this standard the “+” symbol is optional.

If you want to dial a number that is not in the UK you can dial an E164 format number to reach it. You can also use something else a phone number can have - an exit code. The exit code for the UK is 00. When the UK phone system sees a 00 it assumes the next number is an international one. You can actually dial an exit code followed by the UK country code and end up calling a national number (00441214960497). I used to call these “boomerang numbers”.

Each country has its own quirks. For example in the UK if you omit the trunk and area code some systems will dial a local number, making the assumption that you want to dial a phone number with the same area code as you. This doesn’t work for a mobile, obviously, because it’s mobile.

The United States of America decided that they would have a country code of 1, a trunk code of 1 and an exit code of 011, because why not? Their trunk code is also optional for national dialling.

Australian phone numbers have changed multiple times over the years, and all numbers describe one of four huge areas, plus a four digit exchange code, plus a four digit number.

Singapore has no area codes and no trunk code, since 1995.

Each of these countries has a set of rules about what is and is not permitted for their telephony system. The UK system is actually very clever with these rules, at least comparatively.

Each country will have their own genius counterexamples. The UK has 999 for the emergency services, plus the 112 EU standard. The Samaritans can be called on 116123. There’s also a difference between the number assigned to someone in the PSTN (the UK phone network, although BT say they’re turning it off in 2025) and the number you see. The number you see is called the “presented CLID” (CLID: Caller Line IDentification), and can be spoofed by certain software - which is partly why scammers always seem to be calling from London. This is illegal unless you own the number you’re spoofing - one can use it to pretend that a room full of customer service people are dialling from the same number every time.

So whose phone numbers are you storing, and what does the system have to do with them? If experience has taught me anything, and it has, then the problem you’re going to run into is managing 200 different standards based on how someone typed in a number. You have a dropdown for the country code and a text field for the phone number? Well, be prepared to see someone type a trunk code into your numeric field so you end up with “+441214960497” and “+4401214960498”. Also brace yourself for the people who put a space wherever they feel like the area code ends (01214 960497 vs 0121 4960497).

I might as well rant about area codes. In the UK there are “2-digit codes” like London (020 xxxx xxxx), “three digit codes” like Birmingham (0121 xxx xxxx), “four digit codes” like Luton (01582 xxxxxx), and the old “five digit codes” (01xxxx xxxxx OR 01xxxx xxxx). Phone numbers tend to have 9 or 10 digits, but that’s not universally true.

What you need is a healthy mix of input validation and autoformatting rules, combined with great UX and user feedback, IF you need or want a standard set of phone numbers. Dealing with international numbers makes this a huge pain. E164 is a great format to store things in IF it’s done correctly and you decide on a standard for the standard - because it’s not a very standard standard and some of the stuff is optional. It’s more like a set of confusing guidelines.

So when you say “phone number field”, that’s my thought process.

5 Likes

The E164 standard is pretty much “write your country code then write up to 15 other numbers”. Some systems, like mobile phones, will dial an E164 format internationally with no problems. Some landline systems require the user to prepend their country’s exit code.

The international dialling code for a country is usually 1-3 digits. Some countries have a code that is 1 plus their “national code” - which is four digits. So if I want to call Trinidad I have to type 00 1868, then the number.

But if all you need to do is store a string and display it on the screen, then it doesn’t really matter what you test it with. Just make sure you max out the characters and they fit in the UI. Maybe zoom the browser a bit.

2 Likes