How to Extract Phone Numbers from Text (E.164 & Regex Guide)

Last updated: 17 October 2026
Extract Phone Numbers in Your Browser
Paste documents, customer inquiries, or contact directories to extract international and local phone numbers in clean E.164 format. Zero server uploads.
To extract phone numbers from text, paste your content directly into the online phone number extractor, which identifies domestic and international telecommunication patterns (ITU-T E.164 standards, parentheses, hyphens, and country prefixes) directly inside your web browser, allowing you to deduplicate, reformat, and export clean CSV contact tables without sending personal data to any external server.
Key definitions: ITU-T E.164, Country Code, NANP, Subscriber Number, Tel URI (RFC 3966)
Telecommunication numbering plans are governed by strict international treaties. Extracting phone numbers from unstructured text accurately requires understanding these global formats:
- ITU-T E.164 Recommendation: The international public telecommunication numbering plan established by the International Telecommunication Union (ITU). E.164 numbers are formatted with a leading plus sign (
+) followed by up to 15 decimal digits with no punctuation:+[Country Code][Subscriber Number](e.g.,+14155552671or+442079460958). E.164 is the global gold standard for SMS gateways, CRM databases, and telephony APIs. - Country Calling Code (CC): A 1- to 3-digit prefix assigned to geographical territories (e.g.,
1for North America,44for the United Kingdom,49for Germany,971for the United Arab Emirates). - National Destination Code (NDC) & Area Code: A numbering segment specifying geographical regions or mobile network operators within a country. In North America, area codes are strictly 3 digits; in the UK, area codes range from 2 to 5 digits.
- NANP (North American Numbering Plan): The telephone numbering system used across the US, Canada, and 18 Caribbean nations. NANP numbers follow the strict 10-digit format
NXX-NXX-XXXX, whereNis digits 2–9 andXis digits 0–9, preventing area codes or office codes from beginning with 0 or 1. - Tel URI (IETF RFC 3966): The uniform resource identifier standard for telephone numbers (e.g.,
tel:+1-201-555-0123) used in HTML<a href="tel:...">click-to-call links across mobile websites.
Why extracting phone numbers from raw text is difficult
Unlike email addresses, which have an unambiguous anchor character (@), phone numbers consist of digits intermixed with optional delimiters. This creates acute extraction challenges:
- The “Date, Price & IP” False Positive Trap: A naive regex pattern matching digit sequences with hyphens or dots (such as
[\d\-\.]{7,}) will catastrophically capture calendar dates (2026-10-17), IPv4 addresses (192.168.1.1), credit card numbers, order tracking IDs, and serial numbers. True phone number extractors must apply boundary heuristics and digit-density constraints. - Delimiter Permutations: A single phone number can be written in dozens of human styles:
(555) 234-5678(US Traditional)+1-555-234-5678(International Delimited)555.234.5678(Modern Dot Notation)+44 (0)20 7946 0958(UK National Trunk Prefix in Parentheses)030 12345678(German Local)
- Trunk Prefix Ambiguity: In many countries, domestic calls require a leading trunk prefix (such as
0in the UK, Australia, and Europe), but international callers must drop the zero when adding the country code (e.g., UK020 7946 0958becomes+44 20 7946 0958). Extractors must handle parenthetical notations like+44 (0) 20...without breaking. - Extension Tokens: Business phone listings often append internal routing extensions using markers such as
ext. 104,x402, or#12.
Step-by-step: how to extract phone numbers in your browser
Using the client-side EasyExtract Phone Number Extractor, you can extract and normalize numbers from unformatted text without writing regex or uploading customer lists:
- Open the Extractor: Visit the online phone number extractor in your browser.
- Paste Your Contact Data: Paste raw text from emails, resumes, CRM notes, or website footer scrapes into the text box.
- Select Output Formatting: Choose between keeping original delimiters or normalising all extracted values to clean international E.164 format (digits with leading
+). - Filter and Deduplicate: Keep the “Deduplicate” box checked to remove duplicate listings from recurring email signatures and headers.
- Export Contact Records: Click “Copy List” to paste numbers into an SMS dialer, or click “Download CSV” to save a structured contact sheet for import into Salesforce, HubSpot, or Google Contacts.
Production regular expressions for phone number extraction
For developers building text processing scripts, here are battle-tested regular expression patterns ranging from flexible extraction to strict standard formats:
| Target Scope | Regular Expression Pattern | Matches Examples | ReDoS / False-Positive Risk |
|---|---|---|---|
| Flexible Global Extraction | (?:\+?\d{1,3}[-.\s]?)?\(?\d{2,4}\)?[-.\s]?\d{3,4}[-.\s]?\d{3,9} |
+1 (555) 234-5678, 020 7946 0958 |
Low (Balanced length bounds) |
| Strict ITU-T E.164 | ^\+[1-9]\d{1,14}$ |
+14155552671, +442079460958 |
Zero false positives (Strict validation) |
| North American (NANP) | (?:\+?1[-.\s]?)?\(?[2-9]\d{2}\)?[-.\s]?[2-9]\d{2}[-.\s]?\d{4} |
(555) 234-5678, +1-555-234-5678 |
Zero (Enforces NANP [2-9] rule) |
| Tel URI Links | href=["']tel:([^"']+)["'] |
href="tel:+15552345678" |
Zero (Anchored to HTML tag) |
If you need to extract numerical measurements and financial figures rather than phone numbers, use our specialized number extractor from text.
Programmatic phone extraction: Python vs JavaScript implementations
When extracting phone numbers at scale, developers must choose between lightweight regex scanners and comprehensive metadata parsers (like Google’s `libphonenumber`).
Python: Regex extraction with False-Positive Filtering
import re
def extract_phone_numbers(text: str) -> list[str]:
# Pattern matching international and local formats with delimiters
phone_pattern = re.compile(
r'(?:(?:\+|00)[1-9]\d{0,2}[-.\s]?)?' # Optional country code
r'(?:\(?\d{2,5}\)?[-.\s]?)?' # Optional area code
r'\d{3,4}[-.\s]?\d{3,4}' # Main subscriber body
)
candidates = phone_pattern.findall(text)
valid_numbers = []
for candidate in candidates:
cleaned = re.sub(r'[\s\-().]', '', candidate)
# Exclude dates (e.g., 20261017) and numbers outside E.164 7-15 digit limit
if 7 <= len(cleaned) <= 15:
# Check not all identical digits (e.g., 00000000)
if len(set(cleaned)) > 1:
valid_numbers.append(candidate.strip())
return list(dict.fromkeys(valid_numbers))
# Test sample
text_block = "Contact sales at +1 (555) 234-5678 or direct dial 555.987.6543. Invoice date is 2026-10-17."
print(extract_phone_numbers(text_block))
# Output: ['+1 (555) 234-5678', '555.987.6543']
JavaScript: Client-Side Extraction
function extractPhonesFromText(input) {
const regex = /(?:(?:\+|00)[1-9]\d{0,2}[-.\s]?)?(?:\(?\d{2,5}\)?[-.\s]?)?\d{3,4}[-.\s]?\d{3,4}/g;
const matches = input.match(regex) || [];
const unique = new Set();
const results = [];
for (const match of matches) {
const digits = match.replace(/\D/g, '');
if (digits.length >= 7 && digits.length <= 15) {
const trimmed = match.trim();
if (!unique.has(trimmed)) {
unique.add(trimmed);
results.push(trimmed);
}
}
}
return results;
}
Phone number extraction vs phone verification & lookup APIs
Understanding the distinction between extraction and verification prevents costly mistakes in sales and operations pipelines:
- Phone Extraction (EasyExtract): Reads unstructured text, identifies strings that conform to telephone syntax, strips punctuation, and organizes them into structured lists. Extraction proves that a number exists in your text; it does not ping telecom networks.
- Phone Verification (Carrier / HLR Lookup): Queries telecommunication routing registries (Home Location Register - HLR) to determine whether a phone number is active, currently connected, assigned to a landline vs mobile carrier, or roaming.
- The Workflow Sequence: Always perform extraction first to isolate candidates from your emails and documents for free, deduplicate them locally, and then send only valid unique numbers to paid carrier verification APIs.
If you are extracting email addresses alongside phone numbers, read our companion guide on how to extract email addresses from text.
Extracting contact records from resumes, CRM exports, and web directories
Sales development representatives (SDRs), recruiters, and data analysts frequently encounter unstructured text blocks:
- Resume & CV Parsing: Candidates list contact numbers in document headers alongside addresses and LinkedIn links. When processing batches of PDF resumes, extract the text first with our PDF text extractor or DOCX text extractor, then run the phone extractor to capture phone numbers into an applicant tracking spreadsheet.
- Customer Service Logs: Support tickets in Zendesk or Freshdesk contain phone numbers typed into conversation threads. Extracting them enables automated callback queuing.
- Website Scraping & Directory Auditing: Extracting phone numbers from HTML source code allows webmasters to audit footer contact links. To extract accompanying email addresses, use our email extractor.
Master comparison: EasyExtract vs Python libphonenumber vs Excel formulas
| Extraction Method | Setup Required | E.164 Normalization | Privacy / Data Security | Best Use Case |
|---|---|---|---|---|
| EasyExtract Phone Extractor | Zero (In-browser) | Automated (One-click) | 100% Client-Side (Zero uploads) | Fast lead list cleaning, ad-hoc text parsing, instant CSV export |
| Google libphonenumber (Python) | pip install phonenumbers |
Comprehensive (Carrier metadata) | 100% Local | Backend enterprise data pipelines and international billing validation |
| Excel Formulas (REGEXEXTRACT) | Excel 365 / Google Sheets | Manual complex regex | Local / Cloud spreadsheet | Extracting numbers already structured in spreadsheet cells |
| Third-Party Cloud Scrapers | Account signup & API keys | Varies | High Privacy Risk (Uploads customer lists) | Not recommended for GDPR or confidential customer databases |
Privacy, GDPR, and telemarketing compliance (TCPA & CAN-SPAM)
Customer telephone numbers constitute Personally Identifiable Information (PII) under global data protection frameworks including the EU General Data Protection Regulation (GDPR) and California Consumer Privacy Act (CCPA). Furthermore, unsolicited calling and SMS messaging are strictly regulated by the US Telephone Consumer Protection Act (TCPA).
When handling customer telephone records, uploading lists of customer mobile numbers to unvetted cloud processing tools violates compliance mandates and creates corporate liability in the event of a third-party data leak.
EasyExtract executes all telephone extraction, delimiter stripping, and CSV generation entirely within your device's memory using client-side JavaScript. Disconnect your Wi-Fi connection and test the tool: it functions identically offline, ensuring complete compliance with enterprise data privacy directives.
Frequently asked questions
How do I extract phone numbers with country codes?
Paste your text into the EasyExtract Phone Extractor. The tool automatically detects international calling prefixes (such as +1, +44, +49, +971) and preserves them in standard ITU-T E.164 format.
Why does regex capture dates or IP addresses as phone numbers?
Dates (like 2026-10-17) and IP addresses share identical digit and punctuation patterns with phone numbers. EasyExtract applies specialized digit constraints and boundary rules to exclude dates and IP addresses from phone results.
Can this tool verify if a phone number is active or in service?
No. The extractor isolates validly formatted phone numbers from text. Confirming whether a number is currently assigned or active requires querying live telecom carrier databases (HLR lookup).
How do I export extracted phone numbers to Excel?
Once your numbers are extracted, click 'Download CSV'. This produces a clean, spreadsheet-ready file formatted for instant import into Microsoft Excel, Google Sheets, or CRM systems.
What is the E.164 international phone number format?
E.164 is the international standard defined by the ITU. An E.164 number begins with a plus sign (+) followed by the country code and national subscriber number, with a maximum length of 15 digits and zero spaces or dashes (e.g. +14155552671).
Can I extract phone numbers from a PDF document?
Yes. First, use our PDF text extractor to pull text out of your PDF document, then paste that text into the phone number extractor.
Are customer phone numbers uploaded to your servers?
No. All extraction executes 100% locally in your client web browser. No phone numbers, customer lists, or document text are ever uploaded, transmitted, or stored on external servers.
Sources & technical standards
- ITU-T Recommendation E.164 — The international public telecommunication numbering plan (International Telecommunication Union).
- IETF RFC 3966 — The tel URI for Telephone Numbers (H. Schulzrinne).
- North American Numbering Plan Administrator (NANPA) — NANP Numbering Formats and Area Code Specifications.
- Google libphonenumber — Google's common Java, C++ and JavaScript library for parsing, formatting, and storing international phone numbers.