Snipget.ai

Format and clean phone numbers

Exact
phone_format

Deterministic and authoritative — the canonical answer for this input.

Format a phone number in a chosen style: 'numeric' (digits only), 'dashed' (555-123-4567), 'parentheses' ((555) 123-4567), 'e164' (+15551234567), or 'international' (+1 555-123-4567). The first three styles honor add_country_code=True to prepend the detected country code. Parses ambiguous non-E.164 input using country_hint. Processing multiple inputs? Use `phone_format_batch` to do up to 1000 in one call.

Parameters

valuestringrequired

Phone number to format.

stylestringoptional

Output style: 'numeric' (digits only), 'dashed' (555-123-4567), 'parentheses' ((555) 123-4567), 'e164' (+15551234567), or 'international' (+1 555-123-4567).

country_hintstringoptional
add_country_codebooleanoptional

When true, prepend the country code to the formatted number for the numeric/dashed/parentheses styles. The e164 and international styles always include the country code.

Call it

curl -X POST https://api.snipget.ai/v1/phone/format \
  -H "Authorization: Bearer sk_live_..." \
  -H "Content-Type: application/json" \
  -d '{"value":"(212) 456-7890","style":"e164"}'

The Batch tab sends up to 1000 inputs in one call via /v1/phone/format/batch.

Example response

{
  "input": "(212) 456-7890",
  "style": "e164",
  "formatted": "+12124567890",
  "country_code": 1,
  "region_code": "US"
}

FAQ

Why not just clean up the phone number myself?

Phone formatting has a lot of fiddly rules per country, and language models are unreliable at it. This uses Google's libphonenumber under the hood to reformat any messy number into a clean, consistent style every time, so a column of mixed-up numbers comes out uniform.

What styles can I get?

Five: 'numeric' (digits only, 2124567890), 'dashed' (212-456-7890), 'parentheses' ((212) 456-7890), 'e164' (+12124567890), and 'international' (+1 212-456-7890). The first three honor add_country_code to prepend the country code, and e164 and international always include it.

Will it work for numbers outside the US?

Yes, but it assumes US by default. For a non-US number that does not start with a plus sign, pass country_hint with the two-letter country code (for example 'GB' or 'CA') so it parses in the right region. Numbers already in +country-code form are detected automatically.

Is the result exact?

Yes. Formatting is deterministic, so the same number and style always produce the same output. It is not a best guess.

What does it do with a number it cannot format?

An invalid or unrecognized number returns confidence 0 with formatted set to null and a reason (a billed data verdict). An unknown style name is different: that is a request mistake, so the call is rejected with an INVALID_INPUT error and not billed. This tool only reformats, it does not tell you whether a number is a real, dialable line; use the phone validate tool for that.

Related tools