Good JS code for normalizing phone numbers into E164 format?

  • 1
  • Question
  • Updated 4 years ago
  • Answered
I'm writing an app where users are asked to input a phone number to send SMS to.  I'd like to store that number in a standard format like E164, without the suer having to type in dashes, brackets, and country codes.  Is there a piece of JS code that someone can share?  Thanks.
Photo of DL Mozart

DL Mozart

  • 120 Points 100 badge 2x thumb

Posted 4 years ago

  • 1
Photo of Anton Nikitin

Anton Nikitin, Official Rep

  • 3,024 Points 3k badge 2x thumb
There are two options I know of.

1. Use Google libphonenumber ( - it has JS port.

2. RingCentral has an API to parse/format phone numbers. But it will require you to send request to server every time you need E.164 number from user input. If you want to explore this option I can share documentation with you.