Converter tool

Phone Number Formatter for CSV

Clean a phone column into E.164, international, national or RFC 3966 format, with validity, line type and country for every row. The file stays in your browser.

Step 1

Your file

The country and number-type data (about 40 KB compressed) loads when you pick a file. Your rows are never uploaded; formatting happens on this page.

Step 3

Result

Load a file, choose the phone column and press Format numbers.

Phone Number Formatter for CSV and Excel

Operator: Abdulla Al Fahad. How tools are built and checked

A contact export rarely holds phone numbers in one style. One row says (650) 253-0000, the next 650.253.0000 ext 12, a third 07911 123456, and somebody typed call me. SMS platforms, CRMs and dialers want one strict form, usually E.164 (+16502530000), and they reject or silently drop the rest. This tool reads each number the way a phone would, writes it in the format you pick, and tells you which rows were not real numbers and why.

It uses libphonenumber-js, a JavaScript port of the numbering-plan data that Google's libphonenumber library is built on, in its full ('max') form so it can tell mobile numbers from fixed lines and toll-free numbers. The numbering-plan data is a separate download of about 40 KB compressed, fetched when you pick a file.

Key features

  • Choose the phone column, one default country or a country column, and the output format
  • Validity (yes or no), line type, ISO country code and name, calling code and extension as optional added columns
  • A Notes column giving the reason for every failure, such as Too short for United States, Unknown country calling code or Not a phone number
  • Retry rule for numbers that lost their +: 442079460958 and 0044 20 7946 0958 are read as international when they fail as national numbers
  • Fixes for common export damage: a trailing .0 from a numeric column is removed, and scientific notation such as 6.50253E+09 is flagged as lost digits
  • Summary counts by country, by line type and by failure reason, plus a paged list of invalid rows
  • Download the full result as CSV or XLSX, or just the invalid rows as CSV; in the XLSX the phone column is stored as text so the + survives

How numbers are read, validated and written out

Input is a .csv, .tsv, .txt or .xlsx file up to 25 MB, using the first worksheet of a workbook, with the header in the first row and up to 300,000 data rows. Pick the phone column; the page guesses from header words such as phone, mobile, tel or whatsapp, and otherwise from the column whose cells look most like numbers. Every other column is carried through untouched, as text, so IDs with leading zeros survive.

How a number is read depends on where it comes from. A number that starts with + carries its own country code and ignores your country setting. A national number such as (650) 253-0000 or 020 7946 0958 is read against a country: either one default for every row, or the value in a country column, which can hold two-letter codes (US, gb) or English names (United Kingdom, Germany, plus common short forms such as UK and USA). If a row's country cell is empty or unrecognised the fallback country is used and the Notes column says so. Without any country, a national number is reported as needing one rather than guessed.

The output formats are E.164 (+442079460958, no spaces), international (+44 20 7946 0958), national (020 7946 0958) and RFC 3966 (tel:+442079460958). An extension typed as x123, ext. 123 or # 123 is split off into its own Phone extension column; in international, national and RFC 3966 output the extension is also kept in the formatted text (ext. 12 or ;ext=12), while E.164 has no place for one, so use the extension column. Only valid numbers are formatted. A row that fails keeps its original text or becomes blank, whichever you choose.

Validity means the digits match a real numbering-plan pattern for that country: the right length and an allocated prefix. It does not mean the line is connected or belongs to anyone. The line type column reports Mobile, Fixed line, Toll free, Premium rate, VoIP and so on; for the United States and a few other plans mobile and fixed ranges cannot be told apart from the digits, so those show Fixed line or mobile. Numbers in the Channel Islands and the Isle of Man that share the +44 plan are shown as GB when your country is the United Kingdom.

How it works

Each cell is trimmed, a leading apostrophe left by Excel is dropped, and the text is handed to libphonenumber-js's parser along with the country for that row. The parser strips punctuation, recognises international prefixes such as 00 or 011 for the given country, extracts the extension, and picks the numbering plan from the calling code (and, for shared codes like +1, from the area code).

A parsed number is then checked against that plan's patterns. A valid result is formatted in your chosen style and given its type. An invalid one gets a reason: if the digit count alone is wrong the note says too short, too long or length not matching that country; otherwise it says the number is not valid for that country. When the Retry option is on and a digits-only value fails as a national number, the page tries it once more with a + in front before giving up.

Rows are processed in batches of 1,500 with a pause between them, so the page stays responsive and shows progress. Cancel stops the run and discards partial output rather than giving you a half-formatted file.

Common use cases

  • Preparing a customer list for an SMS or WhatsApp platform that only accepts E.164
  • Cleaning a trade-show lead sheet where reps typed numbers in six different styles
  • Splitting a contact list into mobile numbers (safe for SMS) and fixed lines or toll-free numbers before a campaign
  • Producing a list of rows to chase because the number is missing digits or is not a number at all
  • Normalising numbers before de-duplicating a CRM export, so +44 20 7946 0958 and 020 7946 0958 match

How to use this tool

  1. Choose a CSV or XLSX file, or press Use sample data.
  2. Check the phone column the page picked, and set the country: one default for every row, or the column that holds each row's country.
  3. Pick the output format and which extra columns you want. Leave Replace the phone column off if you want to keep the original beside the result.
  4. Press Format numbers and read the summary and the invalid rows.
  5. Download the CSV or XLSX, and the Invalid rows CSV if there is anything to fix by hand.

Example

Eleven sample rows, country read from a column, output format E.164

Ana Ruiz     +1 (650) 253-0000        US
Ben Okafor   020 7946 0958           United Kingdom
Chen Wei     07911 123456             GB
Dana Levi    030 123456               DE
Eli Martin   0612345678               France
Fay Nguyen   650-253-0000 ext. 12     US
Gus Holm     442079460958             (blank)
Hana Sato    800-555-0199             US
Ivo Petrov   12345                    US
Jo Park      (empty)                  US
Kim Lee      call me                  US

Formatted result: 8 valid, 2 not valid, 1 empty

+16502530000   Fixed line or mobile   US
+442079460958  Fixed line             GB
+447911123456  Mobile                 GB
+4930123456    Fixed line             DE
+33612345678   Mobile                 FR
+16502530000   Fixed line or mobile   US   extension 12
+442079460958  Fixed line             GB   a + was added
+18005550199   Toll free              US
(kept as 12345)  Too short for United States
(empty)
(kept as call me) Not a phone number (no usable digits)

Tips for best results

  • Use a country column when the list spans countries, and a default country when it does not. Setting the default wrongly is the usual reason a whole file comes back invalid.
  • Keep Retry with a + on for exports from systems that strip the plus sign, but check the Notes column afterwards: those rows were rescued by a guess, and the notes mark them.
  • Open the XLSX rather than the CSV in Excel. Excel reads +16502530000 in a CSV as a number and drops the +, while the XLSX holds it as text.
  • Sort the result by Phone valid, then work through the Invalid rows CSV. It repeats your full original row next to the reason, so you can fix the source and re-run.

Common pitfalls

Validity is a pattern check, not a lookup. A number can be valid and unassigned, disconnected or ported, and the line type is the type of the range it belongs to, not necessarily of the device today.

A phone number inside a longer text cell is picked out (Call Ana on 650 253 0000 gives the number), so an order ID or a postcode sitting next to a number in the same cell can confuse it. A cell holding two separate numbers is reported as not a phone number, so split those into two columns first.

Vanity numbers with letters (1-800-FLOWERS) are not converted; letters are ignored, usually leaving too few digits.

If Excel already damaged the column, the digits are gone. Numbers shown as 6.50253E+09 are flagged, and a leading zero removed by Excel is only recoverable when the country's numbering plan accepts the number without it, which most do.

Country names are matched in English only, and codes with three letters work only for a handful (USA, GBR, DEU and a few more). Anything unrecognised falls back to your fallback country and is noted.

Best practices

  • Run a small sample first and read the Notes column before processing the whole file.
  • Store phone numbers as text in every system that handles them, and keep E.164 as the canonical form with the display style generated from it.
  • For an SMS or dialer import, choose Leave the cell blank for invalid rows rather than Keep the original value; a half-cleaned value in the formatted column can still be accepted by a platform that skips validation.

Country codes, shared prefixes and the +1 plan

A calling code does not always name a single country. +1 covers the United States, Canada and a number of Caribbean nations, told apart by area code; +44 covers the United Kingdom plus Jersey, Guernsey and the Isle of Man; +7 covers Russia and Kazakhstan. The parser picks the country from the digits when it can, so a Toronto area code written without +1 and read with a United States default can come back as Canada. That is correct, and it is why the Country column is worth keeping.

The numbering-plan data is a snapshot that ships with the library. Countries change their plans (new mobile ranges, longer numbers) and the data is updated in new releases, so a number issued very recently may be reported as invalid until the data catches up.

What happens to rows that cannot be fixed

A row is counted as not valid when the text is not a phone number at all, when it is too short or too long for the country, or when the digits do not match any allocated range. Empty cells are counted separately and are not reported as errors. The summary groups failures by reason so you can see whether one cause, such as a wrong default country, explains most of them.

The Invalid rows CSV lists the data row number (the first data row is 1, not counting the header), your original columns and the reason, ready to send back to whoever owns the source list.

Frequently asked questions

Does this check that a phone number actually works?

No. It checks the number against the numbering plan for its country: the length and the allocated prefix. Whether the line is connected, assigned or reachable is not something the digits reveal.

Why does a US number show as Fixed line or mobile?

In the North American plan the same ranges are used for mobile and fixed lines, so the digits cannot tell them apart. The type column says Fixed line or mobile rather than guessing. Many other countries do separate them, and those rows show Mobile or Fixed line.

My numbers have no country code and my file covers several countries. What should I do?

Add a country column to the file, with codes like US and DE or English names, and choose Read it from a column. Rows whose country cell is empty use the fallback country you select.

Are my contacts uploaded anywhere?

No. The file is read and formatted in this tab. The page downloads the numbering-plan data from this site, which does not include anything from your file.