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.
Full International Dialing Directory
Browse every country calling code, local number format, and dialing guide on our dedicated phone reference site.
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)
Could not parse phone number โ check format
Format Types Explained
+14155552671International standard used by APIs, databases, and SMS gateways. Always starts with + and country code. No spaces or dashes.
+1 415 555 2671Human-readable international format with spaces. Used in correspondence and UI display.
(415) 555-2671Local format without country code. Correct for domestic display within the country.
tel:+14155552671URI 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-js2. 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()); // true3. 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"); // false5. 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/minto reduce bundle size by ~40 %. - โDisplay nationally. When showing a number to a user in their own country, use
NATIONALformat. For cross-border, useINTERNATIONAL. - โ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.
| Flag | Country | ISO | Dial Code | Example Number |
|---|---|---|---|---|
| ๐ฆ๐ซ | Afghanistan | AF | +93 | 0701234567 |
| ๐ฆ๐ฑ | Albania | AL | +355 | 0661234567 |
| ๐ฉ๐ฟ | Algeria | DZ | +213 | 0551234567 |
| ๐ฆ๐ฉ | Andorra | AD | +376 | 312345 |
| ๐ฆ๐ด | Angola | AO | +244 | 923123456 |
| ๐ฆ๐ท | Argentina | AR | +54 | 91123456789 |
| ๐ฆ๐ฒ | Armenia | AM | +374 | 077123456 |
| ๐ฆ๐บ | Australia | AU | +61 | 0412345678 |
| ๐ฆ๐น | Austria | AT | +43 | 0664123456 |
| ๐ฆ๐ฟ | Azerbaijan | AZ | +994 | 0401234567 |
| ๐ง๐ญ | Bahrain | BH | +973 | 36001234 |
| ๐ง๐ฉ | Bangladesh | BD | +880 | 01812345678 |
| ๐ง๐ช | Belgium | BE | +32 | 0470123456 |
| ๐ง๐ฏ | Benin | BJ | +229 | 90011234 |
| ๐ง๐น | Bhutan | BT | +975 | 17123456 |
| ๐ง๐ด | Bolivia | BO | +591 | 71234567 |
| ๐ง๐ฆ | Bosnia & Herzegovina | BA | +387 | 061123456 |
| ๐ง๐ผ | Botswana | BW | +267 | 71123456 |
| ๐ง๐ท | Brazil | BR | +55 | 11961234567 |
| ๐ง๐ณ | Brunei | BN | +673 | 7123456 |
| ๐ง๐ฌ | Bulgaria | BG | +359 | 0881234567 |
| ๐ง๐ซ | Burkina Faso | BF | +226 | 70123456 |
| ๐ฒ๐ฒ | Myanmar | MM | +95 | 09212345678 |
| ๐ง๐ฎ | Burundi | BI | +257 | 79561234 |
| ๐ฐ๐ญ | Cambodia | KH | +855 | 091234567 |
| ๐จ๐ฒ | Cameroon | CM | +237 | 671234567 |
| ๐จ๐ฆ | Canada | CA | +1 | 5062345678 |
| ๐จ๐ป | Cape Verde | CV | +238 | 9911234 |
| ๐จ๐ซ | Central African Republic | CF | +236 | 70012345 |
| ๐น๐ฉ | Chad | TD | +235 | 63012345 |
| ๐จ๐ฑ | Chile | CL | +56 | 221234567 |
| ๐จ๐ณ | China | CN | +86 | 13123456789 |
| ๐จ๐ด | Colombia | CO | +57 | 3211234567 |
| ๐จ๐ฉ | Congo (DRC) | CD | +243 | 0991234567 |
| ๐จ๐ท | Costa Rica | CR | +506 | 83123456 |
| ๐ญ๐ท | Croatia | HR | +385 | 0921234567 |
| ๐จ๐บ | Cuba | CU | +53 | 51234567 |
| ๐จ๐พ | Cyprus | CY | +357 | 96123456 |
| ๐จ๐ฟ | Czech Republic | CZ | +420 | 601123456 |
| ๐ฉ๐ฐ | Denmark | DK | +45 | 20123456 |
161 countries shown
Continue your localization implementation
Connect this reference to the format, validation, and testing guidance used elsewhere on the site.
Locale-aware numbers
Separators, grouping, currency precision, and Intl.NumberFormat patterns.
Localization testing
Pseudolocalization, test matrices, native review, and regional release gates.
Address and phone standards
UPU S42, E.164, adaptive forms, storage, parsing, and validation.
I18n architecture
Messages, Unicode, RTL, locale services, fallbacks, and delivery workflow.
Currency reference
ISO 4217 codes, symbols, minor units, and implementation examples.
Address formats
Country templates, field order, and accessible international forms.
Compare locales
Inspect the same numeric value across several country formats.
Interactive tools
Try number, address, and phone formatting in your browser.