All posts

How to Extract Phone Numbers From Text, a Web Page or a CSV

··2 min read

To extract phone numbers from text, use a matcher that checks each run of digits against the country's numbering plan, not a bare regex. Paste your text, HTML or CSV into the phone number extractor and pick the default country: you get every number once, in E.164, with dates, prices and order numbers left out. It runs in your browser, so the text isn't uploaded.

Extract phone numbers from text →

Extract them with the tool

  1. Open the phone number extractor.
  2. Pick the default country: the one most local numbers in the text belong to.
  3. Paste the text, or upload a CSV, TSV or TXT file. Email signatures, page source and spreadsheet exports all work.
  4. Press Extract numbers. Each number is converted to E.164 and counted once, however it was written.
  5. Download the CSV or copy the list into your CRM or dialer.

Do it by hand in Python

We used a three-line test file:

Call Dana on (212) 555-0147 or her cell 212.555.0199.
Invoice 2024-10-15, total $1,234.56, order #48213377.
London office: +44 20 7946 0958. Fax 555-1234.

A regex catches the date and cuts off the bracket:

grep -oE '\+?[0-9][0-9 ().-]{7,}[0-9]' notes.txt
# 212) 555-0147
# 212.555.0199
# 2024-10-15
# +44 20 7946 0958

Google's libphonenumber has a findNumbers function for exactly this, and its Python port is phonenumbers (pip install phonenumbers; we used version 9.0.43 on 8 November 2026):

import sys, phonenumbers

text = open(sys.argv[1]).read()
seen = set()
for m in phonenumbers.PhoneNumberMatcher(text, "US"):
    e164 = phonenumbers.format_number(m.number, phonenumbers.PhoneNumberFormat.E164)
    if e164 not in seen:
        seen.add(e164)
        print(e164, m.raw_string)
+12125550147 (212) 555-0147
+12125550199 212.555.0199
+442079460958 +44 20 7946 0958

The date, price and order number are skipped, and so is 555-1234: seven digits isn't a complete US number.

What the extractor won't do

  • Guess. A number with a missing digit or a typo in the area code is skipped. Check it in the phone number validator to see why.
  • Read images. Scanned PDFs and screenshots need to be turned into text first.
  • Prove a line is live. A valid format says nothing about whether the line is in service. See phone carrier lookup.

Next step: the emails in the same text

Text that has phone numbers usually has email addresses too. Upload them at /verify to check every mailbox without sending. The first 100 checks are free with a Google sign-in, no card.

Pro, $39 a month: Unlimited email verification.* Never metered, never cut off. Live phone lookups are a separate add-on with a monthly allowance. See pricing.

*Fair use: the first 100,000 checks a month at full speed, then slower, never cut off.

More: E.164 phone number format, clean phone numbers in a CSV.

Common questions

How do I extract phone numbers from text?

Paste the text into the phone number extractor, choose the country most local numbers belong to, and press Extract numbers. You get each number once in E.164 with a CSV download.

Why not just use a regex?

A digit pattern also matches dates, prices and order IDs, and splits on brackets. libphonenumber checks each match against the country's numbering plan.

Can it read numbers from other countries in the same text?

Numbers written with a + country code are read correctly. Local numbers without one are read as the default country, so run mixed text once per country.

Does it check the numbers work?

No. It checks the format and numbering plan only. Use a phone validator or live lookup to check line type and carrier.

Check your list before you send

Real mailbox checks over SMTP, and nothing is sent to the address. Sign in with Google and your first 100 email checks are free, no card. Plans for bigger lists are on the pricing page.