Developer

E.164 vs E.123 Phone Number Formats: What's the Difference?

Understand the difference between E.164 and E.123 phone number formats, when to use each, and how to convert between them for SMS APIs, databases, and display.

By Makeinfo Team
#e164 #phone-format #telecom #validation

Two ITU-T standards dominate phone number formatting: E.164 (for machines) and E.123 (for humans). Using the wrong one causes failed API calls, broken validations, and confused users.

Here’s the practical difference and when to use each.

Quick Comparison

E.164E.123
PurposeStorage & transmissionDisplay & print
Example+14155552671+1 415 555 2671
SpacesNoneYes (between groups)
Max length15 digits + +No strict limit
Used bySMS APIs, databases, telecom systemsBusiness cards, websites, documents
ITU-T StandardITU-T E.164ITU-T E.123

E.164 Format

E.164 is the machine-readable international phone number format defined by the International Telecommunication Union (ITU-T).

Rules

  1. Starts with +
  2. Followed by country code (1–3 digits, first digit non-zero)
  3. Followed by subscriber number
  4. Total digits: 7–15 (not counting the +)
  5. No spaces, dashes, parentheses, or other formatting

Examples

CountryE.164 FormatBreakdown
US+14155552671+1 (country) + 4155552671 (number)
UK+442071234567+44 (country) + 2071234567 (number)
India+919876543210+91 (country) + 9876543210 (number)
Germany+4930123456+49 (country) + 30123456 (number)
Japan+81312345678+81 (country) + 312345678 (number)
Australia+61412345678+61 (country) + 412345678 (number)

When to Use E.164

  • Database storage — always store numbers in E.164
  • SMS APIs — Twilio, Vonage, MessageBird all require E.164
  • CRM systems — Salesforce, HubSpot normalize to E.164
  • Comparisons and deduplication — one canonical format eliminates mismatches
  • Programmatic processing — no ambiguity for code to parse

E.123 Format

E.123 is the human-readable format designed for print and display. It adds spaces between logical groups to make numbers easy to read.

Rules

  1. International format starts with + and country code
  2. Groups separated by spaces
  3. National format can omit the country code
  4. Grouping varies by country’s numbering plan
  5. No strict maximum length

Examples

CountryE.123 InternationalE.123 National
US+1 415 555 2671(415) 555-2671
UK+44 20 7123 4567020 7123 4567
India+91 98 7654 3210098 7654 3210
Germany+49 30 123456030 123456
Japan+81 3 1234 567803-1234-5678

When to Use E.123

  • User-facing display — show formatted numbers on websites
  • Business cards and print — readability matters
  • Input fields — let users type in their local format
  • Documentation — written guides and manuals

Converting Between Formats

E.123 → E.164 (strip formatting)

function toE164(phone) {
  return phone.replace(/[\s\-\(\)\.]/g, '');
}

toE164('+1 (415) 555-2671'); // '+14155552671'
toE164('+44 20 7123 4567');  // '+442071234567'

E.164 → E.123 (add formatting)

This requires knowing the country’s numbering plan. Here’s a simplified approach for common countries:

function toE123(e164) {
  // US/Canada (+1)
  if (e164.startsWith('+1') && e164.length === 12) {
    const area = e164.slice(2, 5);
    const mid = e164.slice(5, 8);
    const last = e164.slice(8);
    return `+1 ${area} ${mid} ${last}`;
  }

  // UK (+44)
  if (e164.startsWith('+44') && e164.length === 13) {
    const area = e164.slice(3, 5);
    const part1 = e164.slice(5, 9);
    const part2 = e164.slice(9);
    return `+44 ${area} ${part1} ${part2}`;
  }

  // India (+91)
  if (e164.startsWith('+91') && e164.length === 13) {
    const part1 = e164.slice(3, 5);
    const part2 = e164.slice(5, 9);
    const part3 = e164.slice(9);
    return `+91 ${part1} ${part2} ${part3}`;
  }

  // Generic fallback: insert space after country code
  return e164.replace(/^(\+\d{1,3})(\d+)$/, '$1 $2');
}

Python

import re

def to_e164(phone: str) -> str:
    return re.sub(r'[\s\-\(\)\.]', '', phone)

def to_e123_us(e164: str) -> str:
    """Convert US E.164 to E.123"""
    if e164.startswith('+1') and len(e164) == 12:
        return f"+1 {e164[2:5]} {e164[5:8]} {e164[8:]}"
    return e164

Google Sheets

E.123 → E.164:

=REGEXREPLACE(A2, "[\s\-\(\)\.]", "")

E.164 → E.123 (US):

=IF(LEFT(A2,2)="+1",
  "+1 " & MID(A2,3,3) & " " & MID(A2,6,3) & " " & MID(A2,9,4),
  A2)

The Practical Rule

Store as E.164. Display as E.123.

User types:  (415) 555-2671        ← E.123 (human input)

You store:   +14155552671           ← E.164 (database)

You display: +1 415 555 2671       ← E.123 (UI)

API sends:   +14155552671           ← E.164 (Twilio/Vonage)

This pattern works for every country and every use case. The user never sees or cares about E.164 — but your systems always use it internally.

Validation Regex

E.164

^\+[1-9]\d{6,14}$

E.123 (loose — allows spaces)

^\+[1-9][\d\s]{6,20}$

Common Mistakes

1. Storing E.123 in Your Database

// Bad — inconsistent formats cause deduplication failures
"+1 415 555 2671"
"(415) 555-2671"
"14155552671"

// Good — one canonical format
"+14155552671"

2. Sending E.123 to SMS APIs

Twilio, Vonage, and MessageBird all require E.164. Sending +1 415 555 2671 (with spaces) will fail or behave unpredictably.

3. Displaying E.164 to Users

+14155552671 is hard to read. Always format for display using the national convention users expect.

4. Assuming All Numbers Are 10 Digits

Country codes range from 1–3 digits, and subscriber numbers vary from 4–12 digits. Don’t hardcode length assumptions.