Get started with libphonenumber-js CDN

MIT licensed

JS port of Googles Libphonenumber: phone formatting, parsing, validation.

Tags:
  • javascript
  • telephone
  • phone
  • number
  • input
  • mobile
  • android
  • iphone
  • international
  • libphonenumber

Stable version

Copied!

How to start using libphonenumber-js CDN


// Include the library via CDN
const Phonenumber = require('libphonenumber-js')(window);

// Phone number to be formatted
const phoneNumber = '+1 (650) 253-0000';

// Parse the phone number
const parsedNumber = new Phonenumber(phoneNumber, 'US');

// Format the phone number
const formattedNumber = parsedNumber.formatNational();

// Validate the phone number
const isValidNumber = parsedNumber.isValidForRegion('US');

console.log('Formatted phone number:', formattedNumber);
console.log('Is valid number for US:', isValidNumber);
Copied!
Copied!

All versions

0.2.10 0.2.11 0.2.12 0.2.13 0.2.14 0.2.15 0.2.16 0.2.17 0.2.18 0.2.19 0.2.20 0.2.21 0.2.22 0.2.23 0.2.24 0.2.25 0.2.26 0.2.27 0.2.28 0.2.29 0.2.3 0.2.30 0.2.31 0.2.4 0.2.5 0.2.6 0.2.7 0.2.8 0.2.9 0.3.0 0.3.1 0.3.10 0.3.11 0.3.12 0.3.13 0.3.14 0.3.15 0.3.2 0.3.3 0.3.4 0.3.5 0.3.6 0.3.7 0.3.8 0.3.9 0.4.0 0.4.1 0.4.10 0.4.11 0.4.12 0.4.13 0.4.14 0.4.15 0.4.16 0.4.17 0.4.18 0.4.19 0.4.2 0.4.20 0.4.21 0.4.22 0.4.23 0.4.24 0.4.25 0.4.26 0.4.27 0.4.28 0.4.29 0.4.3 0.4.30 0.4.31 0.4.32 0.4.33 0.4.34 0.4.35 0.4.36 0.4.37 0.4.38 0.4.39 0.4.4 0.4.40 0.4.41 0.4.42 0.4.43 0.4.44 0.4.45 0.4.46 0.4.47 0.4.48 0.4.49 0.4.5 0.4.50 0.4.51 0.4.52 0.4.6 0.4.7 0.4.8 0.4.9 1.0.0 1.0.1 1.0.10 1.0.11 1.0.12 1.0.13 1.0.14 1.0.15 1.0.16 1.0.17 1.0.18 1.0.19 1.0.2 1.0.21 1.0.22 1.0.23 1.0.24 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.0.9 1.1.0 1.1.1 1.1.10 1.1.11 1.1.2 1.1.3 1.1.4 1.1.5 1.1.6 1.1.7 1.1.8 1.1.9 1.10.0 1.10.1 1.10.10 1.10.11 1.10.12 1.10.13 1.10.14 1.10.15 1.10.16 1.10.17 1.10.18 1.10.19 1.10.2 1.10.20 1.10.21 1.10.22 1.10.23 1.10.24 1.10.26 1.10.28 1.10.3 1.10.30 1.10.31 1.10.32 1.10.33 1.10.34 1.10.36 1.10.37 1.10.38 1.10.39 1.10.4 1.10.40 1.10.41 1.10.42 1.10.43 1.10.44 1.10.45 1.10.46 1.10.47 1.10.48 1.10.49 1.10.5 1.10.50 1.10.51 1.10.52 1.10.53 1.10.54 1.10.55 1.10.56 1.10.57 1.10.58 1.10.59 1.10.6 1.10.60 1.10.61 1.10.62 1.10.63 1.10.64 1.10.7 1.10.8 1.10.9 1.11.0 1.11.1 1.11.2 1.11.3 1.11.4 1.11.5 1.11.6 *** 1.11.7 1.2.0 1.2.1 1.2.10 1.2.11 1.2.12 1.2.13 1.2.14 1.2.15 1.2.16 1.2.17 1.2.18 1.2.19 1.2.2 1.2.20 1.2.21 1.2.22 1.2.23 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 1.3.0 1.3.1 1.3.2 1.4.0 1.4.1 1.4.2 1.4.3 1.4.4 1.4.5 1.4.6 1.4.7 1.4.8 1.4.9 1.5.0 1.5.1 1.5.2 1.6.0 1.6.1 1.6.2 1.6.3 1.6.4 1.6.5 1.6.6 1.6.7 1.6.8 1.6.9 1.7.0 1.7.1 1.7.10 1.7.11 1.7.12 1.7.13 1.7.14 1.7.15 1.7.16 1.7.17 1.7.18 1.7.19 1.7.2 1.7.20 1.7.21 1.7.22 1.7.23 1.7.24 1.7.25 1.7.26 1.7.27 1.7.28 1.7.29 1.7.3 1.7.30 1.7.31 1.7.32 1.7.33 1.7.34 1.7.35 1.7.37 1.7.38 1.7.39 1.7.4 1.7.40 1.7.41 1.7.42 1.7.43 1.7.44 1.7.45 1.7.46 1.7.47 1.7.48 1.7.49 1.7.5 1.7.50 1.7.51 1.7.52 1.7.53 1.7.54 1.7.55 1.7.56 1.7.57 1.7.58 1.7.6 1.7.7 1.7.8 1.7.9 1.8.0 1.8.1 1.8.2 1.8.3 1.8.4 1.8.5 1.8.6 1.8.7 1.9.0 1.9.1 1.9.10 1.9.11 1.9.12 1.9.13 1.9.14 1.9.15 1.9.16 1.9.17 1.9.18 1.9.19 1.9.2 1.9.20 1.9.21 1.9.22 1.9.23 1.9.24 1.9.25 1.9.26 1.9.27 1.9.28 1.9.29 1.9.3 1.9.30 1.9.31 1.9.32 1.9.34 1.9.35 1.9.36 1.9.37 1.9.38 1.9.39 1.9.4 1.9.40 1.9.41 1.9.42 1.9.43 1.9.44 1.9.46 1.9.47 1.9.48 1.9.49 1.9.5 1.9.50 1.9.51 1.9.52 1.9.53 1.9.6 1.9.7 1.9.8 1.9.9