Extract Phone Numbers
Extract phone numbers from text.
About this tool
Paste text and press Run to list sequences of digits that look like phone numbers, with optional country code, brackets, spaces, dots or hyphens. Treat the output as a candidate list that you check by eye.
How to use
How it works
The pattern accepts an optional country code, an optional area code in brackets, then two groups of three or four digits separated by a space, dot or hyphen, with at least 6 digits in total. It does not know country formats, so it also matches other digit runs such as order or reference numbers.
Worked example
Phones mixed with an order number
- Input
- Call +1 415-555-0132 or (020) 7946 0958. Order 123456789 shipped 2024-05-01.
- Output
- +1 415-555-0132 (020) 7946 0958 123456789
- Walkthrough
- The two phone numbers are found. The order number 123456789 is also returned because it has nine digits, and the date is not matched.
Limitations
- False positives: any run of 7 or more digits can match.
- Does not validate numbers against country rules.
- Numbers written with words or unusual separators may be missed.
Questions
How do I extract phone numbers from text?
Why did it return an order number?
Does it check if a number is valid?
Features
- Loose phone-number pattern
- Country code and brackets
- Runs in your browser
Related resources
Guides and videos from around the web—opens on YouTube or the publisher’s site.
Learn Regular Expressions - Crash Course
freeCodeCamp.org
Regex powers many find/replace and clean-text workflows.
Watch on YouTubeHTML in 100 Seconds
Fireship
Quick HTML mental model next to text transform tools.
Watch on YouTube
- Unicode Normalization Forms
Unicode
Why seemingly identical characters break equality checks.
- Regular expressions
MDN
Pattern matching used in advanced text cleaners.