<labelclass="govuk-label"for="telephone-number">
UK telephone number
</label><inputclass="govuk-input govuk-input--width-20"id="telephone-number"name="telephone-number"type="tel"autocomplete="tel"></div>
Only collect telephone numbers from people if you genuinely need them. Not everyone has or can use a telephone, so make sure you give users a choice about how they can be contacted.
How it works
Allow different formats
Let users enter telephone numbers in whatever format is familiar to them. Allow for additional spaces, hyphens, dashes and brackets, and be able to accommodate country and area codes.
Validate telephone numbers
You should validate telephone numbers so you can let users know if they have entered one incorrectly. Google’s libphonenumber library can validate telephone numbers from most countries.
Use the autocomplete attribute
Use the autocomplete attribute on telephone number inputs. This lets browsers autofill the information on a user's behalf if they’ve entered it previously.
To do this, set the autocomplete attribute to tel, as shown in the HTML and Nunjucks tabs in the examples on this page.
If you are working in production you’ll need to do this to meet WCAG 2.1 Level AA.
You will not normally need to use the autocomplete attribute in prototypes, as users will not generally be using their own devices.
<labelclass="govuk-label"for="telephone-number">
UK telephone number
</label><pid="telephone-number-error"class="govuk-error-message"><spanclass="govuk-visually-hidden">Error:</span> Enter a UK telephone number
</p><inputclass="govuk-input govuk-input--width-20 govuk-input--error"id="telephone-number"name="telephone-number"type="tel"aria-describedby="telephone-number-error"autocomplete="tel"></div>
<labelclass="govuk-label"for="telephone-number">
Telephone number
</label><divid="telephone-number-hint"class="govuk-hint">
For international numbers include the country code
</div><inputclass="govuk-input govuk-input--width-20"id="telephone-number"name="telephone-number"type="tel"aria-describedby="telephone-number-hint"autocomplete="tel"></div>
{{ govukInput({
label: {
text: "Telephone number"
},
hint: {
text: "For international numbers include the country code"
},
id: "telephone-number",
name: "telephone-number",
type: "tel",
autocomplete: "tel",
classes: "govuk-input--width-20"
}) }}
Using example telephone numbers
If you wish to include an example telephone number (in hint text for example), Ofcom maintains a list of numbers that are reserved for use in media. These are:
UK non-geographic: 01632 960000 to 960999
UK London: 020 7946 0000 to 7946 0999
UK mobile: 07700 900000 to 900999
Explain why you need a telephone number
Tell users why you might contact them and when.
Do not display telephone numbers as links on devices that cannot make calls
It’s possible to mark up telephone numbers as links, like this:
<a href="tel:+442079476330">020 7947 6330</a>
However, doing this will style telephone numbers as links, which is confusing on devices that do not support telephone calls.
It might also not be necessary - some modern mobile browsers automatically detect telephone numbers and display them as links anyway.
If you do need to mark up your telephone numbers as links, for example, to support a device that cannot automatically detect them, make sure they do not display as links on devices that cannot make calls.
When you look at your service's user journey, remember that telephone numbers as links might behave in unexpected ways for the user. For example, unless the user sets a default app to handle tel: links, some browsers and operating systems will automatically start a setup process.
Avoid input masking because it makes it harder for users to:
type a number in their preferred way
transcribe a number from another place and check that they’ve got it right
Avoid reformatting telephone numbers
The GOV.UK Notify team have observed some users becoming confused when presented with a reformatted version of a telephone number that they provided, for example, with the +44 country code added.
Research on this pattern
More research is needed on the best way to handle:
international numbers
extensions
SMS shortcodes
Help improve this pattern
To help make sure that this page is useful, relevant and up to date, you can: