Auto Format Phone Number in Power Apps Form [###-###-####]

When you collect phone numbers in a Power Apps form, users type them in all kinds of ways – with spaces, without spaces, dashes, brackets, or sometimes just a random mix. That looks messy and is harder to use later.

In this tutorial, we’ll build a phone field in Power Apps that auto‑formats the number as ###-###-#### while the user types and saves a clean value back to the SharePoint list.

What we’ll build

We are going to create a phone number input that:

  • Let users type digits normally.
  • Automatically formats the number as 123-456-7890.
  • Stores either the formatted value or just the digits in your table, as you prefer.
Auto Format Phone Number in Power Apps Form

Assumptions:

  • You already have a Power Apps form (Edit/New) connected to a data source (SharePoint list).
  • Your SharePoint list already has a Phone (or similar) column.

Auto Format Phone Number in Power Apps Form

So let’s get started. Follow the instructions below.

Step 1: Add the Phone field to the Power Apps form

  1. Select your Power Apps Edit form or New form control (I have used the Modern form control below).
  2. From the Fields pane, add your Phone column to the form if it is not already there.
  3. Select the Phone data card and note the data card name (e.g. Phone_DataCard).

Inside this card, there will be a text input control (something like DataCardValue4). Rename it txt_Phone so it is easier to work with.

Auto Format Phone Number in Power Apps

Step 2: Use a Power Apps variable for the formatted number

We’ll use a Power Apps variable to store the formatted phone number and bind the text input to it.

  1. Select the Power Apps screen that contains the form.
  2. Set the OnVisible property of the screen:
Set(formattedPhone, "");
  1. Now select the txt_Phone control.
  2. Set its Value property to:
formattedPhone
Power Apps Phone Number Validation Regex with Auto Formatting

This means whatever we put in formattedPhone will appear in the text box.

Step 3: Format as ###-###-#### on change

Now we want to take whatever the user types, remove non‑digits, and format it as ###-###-#### much as possible.

Select txt_Phone and set its OnChange property to:

// Remove all non-digit characters
Set(
varPhoneRaw,
Concat(
MatchAll(
Self.Value,
"\d"
),
FullMatch
)
);
// If there are exactly 10 digits, format as ###-###-####
// Otherwise, show what the user typed
If(
Len(varPhoneRaw) = 10,
Set(
formattedPhone,
Text(
Value(varPhoneRaw),
"000-000-0000"
)
),
Set(
formattedPhone,
Self.Value
)
);

What this does:

  • MatchAll(Self.Text, "\d") gets only digits from the input.
  • Concat(..., FullMatch) joins those digits into a single string.
  • When we have 10 digits, Text(Value(varPhoneRaw), "000-000-0000") turns it into 123-456-7890.
  • If it is not 10 digits yet, we show the user’s raw text so they can continue typing.
Power Apps Phone Number Validation and Auto Formatting

If you don’t want any length check and always want to format whatever is there (assuming it is 10 digits), you can simplify to:

Set(
formattedPhone,
Text(
Value(
Concat(
MatchAll(Self.Text, "\d"),
FullMatch
)
),
"000-000-0000"
)
);

Step 4: Tell the Power Apps Data card what to save

The user now sees the formatted phone number, but we also need to control what is saved in the SharePoint list.

Decide one of these:

  • Save the formatted string: 123-456-7890.
  • Save only digits: 1234567890.

Option 1: Save formatted string (123-456-7890)

  1. Select the Phone data card (the parent card).
  2. Set its Update property to:
formattedPhone
Power Apps Phone Number Format ###-###-#### with Validation

Now the SharePoint list will store the number exactly as ###-###-####.

Option 2: Save only digits (1234567890)

If you want only digits in the table:

  1. Select the Phone data card.
  2. Set its Update property to:
Concat( MatchAll(formattedPhone, "\d"), FullMatch )

This strips the dashes and sends just the numeric string to the data source.

Step 5: Handle existing values in Edit mode

If your form can edit existing records, you probably already have phone numbers stored. We need to show them in the same ###-###-#### format when the user opens the record.

We’ll assume:

  • The underlying column stores only digits or a simple numeric string.

Select txt_Phone datacard value and update its Default property to:

If(
IsBlank(Parent.Default),
formattedPhone,
Text(
Value(Parent.Default),
"000-000-0000"
)
)

Explanation:

  • If there is no existing value, it shows formattedPhone (used for new entries).
  • If there is a stored number, it formats it as 123-456-7890 before showing.

If your table already stores values in ###-###-#### format, you can simply use:

If(
IsBlank(Parent.Default),
formattedPhone,
Parent.Default
)

Step 6: Show a simple validation message (optional)

You might want to enforce exactly 10 digits and display a small error if the user enters fewer or more than 10.

  1. Insert a Power Apps Label below txt_Phone.
  2. Set its Text property to:
"Please enter a 10-digit phone number in the format 123-456-7890."
Power Apps Phone Number Validation Using Regex
  1. Set the label’s Visible property to:
!IsBlank(txt_Phone.Value) && Len(
    Concat(
        MatchAll(
            txt_Phone.Value,
            "\d"
        ),
        FullMatch
    )
) <> 10
Power Apps Phone Number Validation with Auto Format Example

This shows the message only when there is some input and the total count of digits is not 10.

I hope this article helped you learn how to validate a Power Apps Phone number regex with auto-formatting, step by step, using a simple example.

Also, you may like some more Power Apps tutorials:

>

Build a High-Performance Project Management Site in SharePoint Online

User registration Power Apps canvas app

DOWNLOAD USER REGISTRATION POWER APPS CANVAS APP

Download a fully functional Power Apps Canvas App (with Power Automate): User Registration App

Power Platform Tutorial FREE PDF Download

FREE Power Platform Tutorial PDF

Download 135 Pages FREE PDF on Microsoft Power Platform Tutorial. Learn Now…