# Phone Numbers in E.164: Format and Validate | ZafeConnect

> How to store and validate phone numbers for messaging: the E.164 format, country codes, leading zeros, and why a number check before sending saves money.

Canonical URL: https://www.zafeconnect.com/blog/phone-numbers-e164-format-and-validation
Language: en
Last modified: 2026-11-09

## Phone numbers in E.164: format and validate before you send

URL: https://www.zafeconnect.com/blog/phone-numbers-e164-format-and-validation

Published: 2026-11-09

A messaging system is only as good as its phone numbers. Storing them in one international format and checking them before you send prevents a whole class of failures.

Key takeaways:
- E.164 is the international format: a plus sign, the country code and the number, with no spaces or punctuation.
- National numbers often start with a zero that must be dropped when you add the country code.
- Format checking and number lookup answer different questions.
- Validate at sign-up, not only when you send.

### What E.164 looks like
E.164 is the international numbering standard. A number is written as a plus sign, the country code and the national number, up to 15 digits in total, with no spaces, dashes or brackets. A Danish mobile number becomes +45 followed by its eight digits.

Use this one format everywhere in your database. It is what messaging APIs expect, and it removes guesswork about where a number comes from.

### The mistakes that cause most failures

- Keeping the national leading zero after the country code
- Storing numbers as integers, which drops leading zeros and the plus sign
- Letting users type spaces, dashes or brackets and saving them as typed
- Assuming the country from the user’s location instead of asking
- Sending to landlines, which cannot receive text messages

### Format check or number lookup?
A library such as libphonenumber can tell you whether a number is plausible for a country and can format it, without any network call. That catches typos and wrong lengths.

A number lookup goes further. It can tell you whether the number is a mobile or a landline and which network it belongs to. Use the first at sign-up and the second where the cost of a failed message or a fraud attempt justifies it.

### Where to validate

- In the sign-up form, with a country selector and instant feedback
- On the server, never only in the browser
- Again before large campaigns, to remove numbers that are clearly wrong
- When a number changes, since people also change numbers

### How ZafeConnect fits
ZafeConnect offers Numbers Lookup as a product, and its SMS API takes recipient numbers in international format. The API documentation lists the fields and the error responses.

FAQ:
Q: What is E.164?
A: The international standard for phone numbers: a plus sign, the country code and the number, up to 15 digits, with no spaces or punctuation.

Q: Why do I drop the leading zero?
A: In many countries the national number starts with a zero that is used only for calls inside the country. It is not part of the international number.

Q: Can I tell a mobile number from a landline?
A: Often yes, with a number lookup. A format check alone cannot always tell them apart.
