Phone Number Extractor
Paste any block of text and pull out every valid, deduplicated phone number in common formats.
About the Phone Number Extractor
A pattern matcher scans your pasted text for number-shaped sequences, whether they use spaces, dots, dashes, parentheses or a country code, then keeps only the ones with 7 to 15 digits and drops repeats automatically. It all happens locally, so you can paste in a raw contact list without sending it anywhere.
One regex, built to match several real-world formats at once
The extraction pattern is built from four optional-to-required pieces chained together: an optional leading + and 1-3 digit country code, an optional area code that may or may not be wrapped in parentheses, a 3-4 digit exchange group, and a final 3-4 digit line-number group, with spaces, dots, or dashes allowed as separators between any of them. That combination is flexible enough to match (555) 123-4567, 555.123.4567, +1 555 123 4567, and 5551234567 all with the same expression, without needing a separate pattern per format style.
Boundary checks on both ends stop it from grabbing a slice out of a longer digit run
The regex opens with a negative lookbehind, (?<!\d), which refuses to start a match at any position immediately preceded by another digit, and it closes with a word boundary, \b, which likewise refuses to end a match immediately before another digit continues. Together those two checks mean the pattern won't pull a phone-number-shaped chunk out of the middle of a much longer number, like an order ID, tracking number, or credit card number — it only matches digit sequences that actually start and end where the surrounding text does too.
Why matches are re-validated by digit count after the regex runs
Matching the shape of a phone number isn't the same as confirming it's plausible length-wise, so after the regex finds candidates, each match has its punctuation stripped down to bare digits and is only kept if that count falls between 7 and 15. The lower bound covers the shortest number of digits a real local number can meaningfully have; the upper bound of 15 matches the maximum length defined by the ITU's E.164 international numbering standard, which every valid phone number in the world — with its country code included — fits within.
Duplicates are detected by digits, not by exact formatting
Deduplication happens against the stripped digit string, not the original matched text, so 555-123-4567 and 555.123.4567 appearing twice in the same paste are correctly recognized as the same number and collapsed to a single entry — even though their punctuation differs. The version kept and shown in the results is whichever formatting was encountered first in the text, not a normalized or reformatted version.
An honest limitation: it's a pattern matcher, not a validator
The tool has no awareness of real national dialing plans, area code assignments, or carrier data — it can't tell a genuinely assigned phone number from a plausible-looking but nonexistent one, since it isn't backed by a library like libphonenumber. It will also occasionally flag a false positive on any other digit sequence that happens to fall into a phone-shaped format, such as certain invoice or reference numbers. It's built for fast, bulk extraction from pasted text, not for verifying that any given number is real or reachable.
Why the area-code group accepts anywhere from 2 to 4 digits
Area codes aren't a fixed length worldwide — North American numbers typically use a 3-digit area code, but many other countries use codes as short as 2 digits or as long as 4. Rather than hard-coding a single length and missing valid formats from other regions, the regex's area-code segment is written as \d{2,4}, letting it flex across that whole range while the surrounding optional parentheses and separator characters stay the same regardless of how many digits fall inside them.
Frequently Asked Questions
Does this tool verify that an extracted number is a real, working phone number?
No. It only recognizes text shaped like a phone number based on digit count and formatting — it doesn't check against any national dialing plan or verify the number is actually assigned or reachable.
Why did it skip a long number, like a credit card or order ID, in my text?
The pattern is built to avoid matching a slice out of the middle of a longer digit sequence — it only matches digit runs that start and end where the surrounding text does, not partial chunks of something longer.
Will the same number listed twice with different formatting show up as two entries?
No. Duplicate detection compares the underlying digits after punctuation is stripped away, so 555-123-4567 and 555.123.4567 are recognized as the same number and only the first-seen formatting is kept.
What's the shortest and longest number of digits it will accept as valid?
Between 7 and 15 digits. The upper limit matches the maximum length defined by the international E.164 phone numbering standard, which every valid number, including its country code, fits within.
Is my pasted text sent to a server for processing?
No. Extraction runs entirely in your browser using JavaScript — nothing is uploaded, which makes it safe to paste in a raw contact list or exported data.
What format does the downloaded file use?
A plain .txt file with one extracted phone number per line, generated locally as a downloadable Blob with no server round-trip involved.