OA
OpsAgent

Format Phone Number

Last updated 3 weeks ago

The Format Phone Number workflow action cleans, validates, and reformats a phone number into a consistent format -- ready for telephony integrations, SMS tools, or simply keeping your CRM data tidy.

How It Works

Add the Format Phone Number action to any contact, company, deal, or ticket workflow. When a record reaches this step, the app takes the phone number you specify, strips out unwanted characters, applies the correct country code, and returns the formatted result in multiple formats.

Action Inputs

When adding the action to your workflow, you'll configure the following fields:

Field Required Description
Phone Number Yes The phone number to format
Country Code No Select the country for formatting (US, UK, DE, FR, AU, CA, ES, IT, JP, BR)
Output Format No Select the desired output format (E.164, National, or International)

Field Details

Available Countries:

  • United States (+1)
  • Canada (+1)
  • United Kingdom (+44)
  • Germany (+49)
  • France (+33)
  • Australia (+61)
  • Spain (+34)
  • Italy (+39)
  • Japan (+81)
  • Brazil (+55)

Output Format Options:

  • E.164 Format -- digits only with a + prefix, no spaces or punctuation (e.g. +14155551234). This is the standard for APIs and telephony systems.
  • National Format -- the number as it would be dialed locally, with conventional grouping (e.g. (415) 555-1234 for US numbers).
  • International Format -- the full number with country code and spaces for readability (e.g. +1 415 555 1234).

Action Outputs

After the action runs, the following output values are available for use in subsequent workflow steps:

Output Type Description
Formatted Phone Text The phone number in whichever output format you selected
E.164 Format Text The number in E.164 format, regardless of which output format you chose
National Format Text The number in national (local) format
International Format Text The number in international format with country code
Country Code Text The two-letter country code that was used for formatting (e.g. "US", "DE")
Is Valid Yes/No Whether the phone number passed length validation for the selected country
Success Yes/No Whether the formatting completed without errors
Error Message Text When formatting fails, this contains a human-readable explanation

Tip: To learn how to use these output values in later workflow actions (e.g., copy to a property, use in branching logic), see Using workflow action outputs in the HubSpot Knowledge Base.

How the Formatter Processes Numbers

Understanding the formatting steps helps you predict the output:

  1. Cleaning -- all non-numeric characters are removed (spaces, dashes, parentheses, dots, extension markers). A leading + is preserved.
  2. Country detection -- if the number starts with + followed by a recognized dial code, the app uses that country's rules automatically, even if you selected a different country.
  3. Trunk prefix removal -- for countries that use a leading zero in local numbers (most of Europe), the zero is stripped before adding the country code. This is controlled by the Remove Leading Zero setting.
  4. Country code prepended -- if the number doesn't already have a country code, the selected (or default) dial code is added.
  5. Length validation -- the final number is checked against the expected length for the country. Numbers that are too short or too long are flagged as invalid.
  6. Formatting -- the validated number is formatted into all three output styles (E.164, national, and international).

Usage Examples

Standardizing a European CRM Database

Your German sales team enters phone numbers in many formats: 0151 1234 5678, (030) 123-456, +49 151 1234 5678. Set the default country to Germany (+49) with Remove Leading Zero enabled. The action normalizes all of these into +491511234567 (E.164) for your telephony integration.

Cleaning Import Data Before Outreach

After importing a lead list, phone numbers contain dashes, parentheses, and spaces. Add the Format Phone Number action to a workflow that triggers on list membership. Branch on the "Is Valid" result: valid numbers proceed to your calling sequence, invalid numbers get routed to a manual review list.

Multi-Country Formatting

Your business operates in both the US and UK. Create two workflow branches based on the contact's country property, each using a Format Phone Number action with the appropriate country selected. Both branches output E.164 numbers that work with your global SMS provider.

Tips

  • Always use E.164 for integrations. Most telephony APIs, SMS gateways, and calling tools expect E.164 format. Use national or international format only when displaying numbers to humans.
  • Check the "Is Valid" result. Not every phone number in your CRM will be valid. Build a branch to handle invalid numbers gracefully instead of letting them silently fail downstream.
  • Numbers with existing country codes are handled automatically. If a contact already has +44 20 7946 0958 stored, the app recognizes the UK country code and formats correctly, even if you selected Germany as the country.
  • Test with a small batch first. Enroll a handful of records to verify the output before running the action across your entire database.
Previous
Use Cases