HTML Telephone Input Generator
WM-42Type a label and optional pattern and copy a labelled tel input. A tel input checks nothing by itself, so add a pattern if you want the browser to check the format.
Runs in your browser. Nothing is uploaded.
Key: value lines (label: is required; also name:, value:, placeholder:, pattern:, minlength:, maxlength:, size:, required:, readonly:, disabled:)
HTML
How to use it
- Write label:, then name:, placeholder:, pattern: and the limits you need.
- Pick the autocomplete value.
- Copy the label and input.
- Check the number again on your server.
Why tel does no format checking
Phone numbers vary too much around the world for one rule, so a tel input accepts any text. Its main effects are a phone keypad on many touch devices, and a signal to password and form managers that this is a phone number. If you want a check, add a pattern. The tool tests your pattern as a regular expression before writing it and refuses an invalid one. The browser matches the pattern against the whole value, so you do not add the anchors.
autocomplete and placeholders
autocomplete="tel" lets the browser fill a full number, and tel-national fills it without the country code. Use a placeholder to show the expected shape, such as 555-123-4567, but do not use it as the label: it disappears when typing and is not reliably read out. The label here is written with for and id so it names the field for assistive technology. The tool does not check that a number is real or can be called.
Error messages and what to do
| Message | What it means | Fix |
|---|---|---|
Add a "label:" line. An input needs a visible label so screen readers can name it. | No label: line was found. | Add label: and the visible text. |
Questions people ask
How do I add a phone number field in HTML?
Use an input of type tel with a label and a name. Add a pattern if you need a format, and autocomplete="tel" to help users fill it faster.
Does input type tel validate phone numbers?
No. It accepts any text, since formats vary by country. Use the pattern attribute for a format check, and validate on the server too. Browsers will not warn about letters, missing digits or a wrong length unless you set a pattern, minlength or maxlength.
How do I make a US phone number pattern?
For three digits, three digits and four digits with hyphens, use [0-9]{3}-[0-9]{3}-[0-9]{4}. It must match the whole value. Say the format in the label or help text so users know it.
Why use tel instead of number for a phone?
A phone number is an identifier and not a quantity. number inputs strip leading zeros, add spinner buttons and reject plus signs and spaces. tel keeps what the user typed.
What is autocomplete tel-national?
A value that asks the browser to fill the phone number without its country code. Use it when you have a separate country field. It suits forms where a country dropdown comes first, so the number itself is entered without the dialing prefix.
About this tool
Writes a label and an input of type tel. Output is a label plus the control, joined by the for and id attributes; the id comes from an id: line, else the name, else the label. Unlike email and url inputs, a tel input does no format checking at all, because phone number formats differ by country; add a pattern if you want the browser to check it. Your pattern is tested as a regular expression before it is written, and a bad one is refused. A pattern has to match the whole value, which the browser does for you. The type mostly gives touch devices a phone keypad. A placeholder is not a replacement for the label. This tool does not validate real phone numbers. Optional lines: id:, class:, title:, lang:, data-* and aria-*.