Powered by libphonenumber-js

Phone Number Formats by Country

Parse, validate, and format international phone numbers using libphonenumber-js โ€” a lightweight port of Google's libphonenumber. Supports E.164, International, National, and RFC3966 formats for 200+ countries.

200+Countries
4Format Types
ITU-TValidation
E.164Standard
Other Databases

Full International Dialing Directory

Browse every country calling code, local number format, and dialing guide on our dedicated phone reference site.

Visit countrycalling.codes

Live Phone Number Formatter

Type a phone number and select a country to see all output formats in real time.

๐Ÿ‡บ๐Ÿ‡ธUnited States +1

Enter in national format (e.g. 0712345678) or international (e.g. +44 7700 900123)

Formatted Output

Could not parse phone number โ€” check format

Format Types Explained

E.164+14155552671

International standard used by APIs, databases, and SMS gateways. Always starts with + and country code. No spaces or dashes.

International+1 415 555 2671

Human-readable international format with spaces. Used in correspondence and UI display.

National(415) 555-2671

Local format without country code. Correct for domestic display within the country.

RFC3966tel:+14155552671

URI format for HTML href='tel:...' links and SIP protocol.

Implementation Guide

Install libphonenumber-js once, then use it anywhere in your Next.js app.

1. Install

npm install libphonenumber-js

2. Parse a phone number

import { parsePhoneNumber } from "libphonenumber-js";

const phone = parsePhoneNumber("+14155552671");
console.log(phone.country);          // "US"
console.log(phone.nationalNumber);   // "4155552671"
console.log(phone.isValid());        // true

3. Format output types

import { parsePhoneNumber } from "libphonenumber-js";

const phone = parsePhoneNumber("+14155552671");

phone.format("E.164");          // "+14155552671"
phone.format("INTERNATIONAL"); // "+1 415 555 2671"
phone.format("NATIONAL");      // "(415) 555-2671"
phone.format("RFC3966");        // "tel:+14155552671"

4. Validate

import { isValidPhoneNumber } from "libphonenumber-js";

isValidPhoneNumber("+14155552671");      // true
isValidPhoneNumber("+14155552671", "US"); // true
isValidPhoneNumber("0412345678", "AU");  // true
isValidPhoneNumber("123", "US");         // false

5. API Route (Next.js)

// app/api/validate-phone/route.ts
import { isValidPhoneNumber, parsePhoneNumber } from "libphonenumber-js";
import { NextResponse } from "next/server";

export async function POST(req: Request) {
  const { phone, country } = await req.json();

  if (!isValidPhoneNumber(phone, country)) {
    return NextResponse.json({ valid: false }, { status: 400 });
  }

  const parsed = parsePhoneNumber(phone, country);
  return NextResponse.json({
    valid: true,
    e164: parsed.format("E.164"),
    international: parsed.format("INTERNATIONAL"),
    national: parsed.format("NATIONAL"),
    country: parsed.country,
  });
}

6. React validation hook

// hooks/use-phone-validation.ts
"use client";
import { isValidPhoneNumber, parsePhoneNumber, CountryCode } from "libphonenumber-js";

export function usePhoneValidation(value: string, country: CountryCode) {
  const isValid = value.length > 3 && isValidPhoneNumber(value, country);
  const parsed = isValid ? parsePhoneNumber(value, country) : null;
  return {
    isValid,
    e164: parsed?.format("E.164") ?? null,
    international: parsed?.format("INTERNATIONAL") ?? null,
    national: parsed?.format("NATIONAL") ?? null,
  };
}

Implementation tips

  • โ€”Store as E.164. Always store phone numbers in E.164 format in your database. It is the only unambiguous, globally unique representation.
  • โ€”Use the min bundle. Import from libphonenumber-js/min to reduce bundle size by ~40 %.
  • โ€”Display nationally. When showing a number to a user in their own country, use NATIONAL format. For cross-border, use INTERNATIONAL.
  • โ€”Server-side validation. Never trust client-side validation alone. Validate E.164 format server-side before saving. The API route example above is the recommended pattern.

Country Dial Codes Directory

All ITU-T assigned country calling codes with example national numbers.

FlagCountryISODial CodeExample Number
๐Ÿ‡ฆ๐Ÿ‡ซAfghanistanAF+930701234567
๐Ÿ‡ฆ๐Ÿ‡ฑAlbaniaAL+3550661234567
๐Ÿ‡ฉ๐Ÿ‡ฟAlgeriaDZ+2130551234567
๐Ÿ‡ฆ๐Ÿ‡ฉAndorraAD+376312345
๐Ÿ‡ฆ๐Ÿ‡ดAngolaAO+244923123456
๐Ÿ‡ฆ๐Ÿ‡ทArgentinaAR+5491123456789
๐Ÿ‡ฆ๐Ÿ‡ฒArmeniaAM+374077123456
๐Ÿ‡ฆ๐Ÿ‡บAustraliaAU+610412345678
๐Ÿ‡ฆ๐Ÿ‡นAustriaAT+430664123456
๐Ÿ‡ฆ๐Ÿ‡ฟAzerbaijanAZ+9940401234567
๐Ÿ‡ง๐Ÿ‡ญBahrainBH+97336001234
๐Ÿ‡ง๐Ÿ‡ฉBangladeshBD+88001812345678
๐Ÿ‡ง๐Ÿ‡ชBelgiumBE+320470123456
๐Ÿ‡ง๐Ÿ‡ฏBeninBJ+22990011234
๐Ÿ‡ง๐Ÿ‡นBhutanBT+97517123456
๐Ÿ‡ง๐Ÿ‡ดBoliviaBO+59171234567
๐Ÿ‡ง๐Ÿ‡ฆBosnia & HerzegovinaBA+387061123456
๐Ÿ‡ง๐Ÿ‡ผBotswanaBW+26771123456
๐Ÿ‡ง๐Ÿ‡ทBrazilBR+5511961234567
๐Ÿ‡ง๐Ÿ‡ณBruneiBN+6737123456
๐Ÿ‡ง๐Ÿ‡ฌBulgariaBG+3590881234567
๐Ÿ‡ง๐Ÿ‡ซBurkina FasoBF+22670123456
๐Ÿ‡ฒ๐Ÿ‡ฒMyanmarMM+9509212345678
๐Ÿ‡ง๐Ÿ‡ฎBurundiBI+25779561234
๐Ÿ‡ฐ๐Ÿ‡ญCambodiaKH+855091234567
๐Ÿ‡จ๐Ÿ‡ฒCameroonCM+237671234567
๐Ÿ‡จ๐Ÿ‡ฆCanadaCA+15062345678
๐Ÿ‡จ๐Ÿ‡ปCape VerdeCV+2389911234
๐Ÿ‡จ๐Ÿ‡ซCentral African RepublicCF+23670012345
๐Ÿ‡น๐Ÿ‡ฉChadTD+23563012345
๐Ÿ‡จ๐Ÿ‡ฑChileCL+56221234567
๐Ÿ‡จ๐Ÿ‡ณChinaCN+8613123456789
๐Ÿ‡จ๐Ÿ‡ดColombiaCO+573211234567
๐Ÿ‡จ๐Ÿ‡ฉCongo (DRC)CD+2430991234567
๐Ÿ‡จ๐Ÿ‡ทCosta RicaCR+50683123456
๐Ÿ‡ญ๐Ÿ‡ทCroatiaHR+3850921234567
๐Ÿ‡จ๐Ÿ‡บCubaCU+5351234567
๐Ÿ‡จ๐Ÿ‡พCyprusCY+35796123456
๐Ÿ‡จ๐Ÿ‡ฟCzech RepublicCZ+420601123456
๐Ÿ‡ฉ๐Ÿ‡ฐDenmarkDK+4520123456

161 countries shown