DeskKit

Regex library

Regular expression for US phone numbers

A practical NANP regex for US numbers, with optional +1 and common separators. Area codes starting with 0 or 1 fail.

^(?:\+1[-.\s]?)?(?:\(?[2-9]\d{2}\)?[-.\s]?)[2-9]\d{2}[-.\s]?\d{4}$

Runs 100% in your browser. Nothing you paste is uploaded, stored, or sent to a server.

Flags

Highlighted matches

    How to use

    1. Scan the pre-filled pattern and the sample. Hits are highlighted; misses stay plain.
    2. Toggle flags if you need global or case-insensitive matching. The pattern is JavaScript / ECMAScript.
    3. Paste your own corpus. Nothing is sent to a server.
    4. Read the notes below before you drop the pattern into production — several of these are intentionally incomplete.

    North American numbers are ten digits: a 3-digit area code, a 3-digit exchange, and four subscriber digits. Area codes and exchanges do not start with 0 or 1, which is why 123-555-2671 fails here.

    This is still not a substitute for a real SMS or voice verify. People invent numbers that match the shape.

    What this pattern will not do

    Extensions (x123) are not included.

    Country codes other than +1 are rejected.

    FAQ

    Does this accept 555 numbers?

    Yes, 555 is a valid exchange pattern in fiction and in some reserved blocks. The regex does not implement the full NANP allocation list.

    What about letters like 1-800-FLOWERS?

    Not matched. Normalize letters to digits first if you need that.

    Is the sample text uploaded?

    No. The tester compiles the pattern with the browser’s RegExp engine and stays on the device.

    DeskKit is a static site. Interactive tools require JavaScript.