Extract Phone Numbers

Extract phone numbers from text.

FreeNo accountOn your device

Runs in your browser. How to verify

Loading tool…

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

1
Step 1
Paste the text into Input.
2
Step 2
Press Run.
3
Step 3
Review the list and delete anything that is not a phone number.

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?
Paste the text, press Run and review the list.
Why did it return an order number?
The pattern matches digit runs by shape, not by meaning. Delete the extras.
Does it check if a number is valid?
No. It finds number-like patterns in the text but does not verify that a number is real or in service.

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 YouTube
  • HTML in 100 Seconds

    Fireship

    Quick HTML mental model next to text transform tools.

    Watch on YouTube