Refer following links:




Use case at hand is to show partial mobile number to user: Like 'Continue with mobile number ending with * * * * * * 1 2 3 4'

Problem is we might have last 4 digit colide due to users have choice to select last 4 digit of mobile and we are showing multiple such options so to uniquely identify option we need some other mechanism.

Options I am thinking are:

Option 1 - display 1,2 and last two digits ' 1 2 * * * * * * 3 4'

Option 2 - display 5th, 6th, last two digits ' * * * * 1 2 * * 3 4'

Option 3 - display alternate digits ' 1 * 2 * 3 * 4 * 5 *'

Option 4 - display last 4 digits ' * * * * * * 1 2 3 4'

Problem in option 4 for our country/target market there is high collision for a given user as he can choose last 4 digits.


In my use case, in UI plan to display multiple options to customer to use one of previously done registration.

Something like this: 1. Use your account with mobile number 5647 234 4567. 2. Use your account with mobile number 7868 456 7891. 3. Use your account with mobile number 4321 321 1989.

But instead of showing full mobile number on screen we want to show tail or partial number. The question here is to what partial the best option to display it to user, so if we go by option 1 i.e. display first and last two and mask others. It will look like this.

enter image description here

  • 2
    You forgot to mention the country. Phone numbering scheme depends on country numbering plan. What is useful and clear for one country (first two digits) may be unclear for other. And what is secure for one country may be a bad idea for other (as hidden numbers are easily suggestable). Commented Jan 9, 2019 at 10:16
  • 1
    So, does the user see for example 4 options where 1 mobile phone number is his and 3 others are randomly generated or such? Can you perhaps explain the use case more in detail?
    – Kevin M.
    Commented Jan 9, 2019 at 14:40
  • Hi Kevin M, sorry for delayed update from my end, but please have a look, I have added more description.
    – Ankur
    Commented Jan 19, 2019 at 7:19
  • Why not have them login with a password and then give them the option to view the entire number? Commented Jan 19, 2019 at 11:48
  • 1
    Why do you want to display partial number? Is it managed by user/customer only?
    – NB4
    Commented Jan 30, 2019 at 13:42

6 Answers 6


The reason to show the user the number he could use to continue is to request if its the number he wants to use. So your goal is to let the user know if its the correct number and for this goal he has to classify it correctly. I guess the most users would classify the mobile phone numbers based on the local code behind the country code. E.g. in Germany the country code is +49 and the local codes are 015x, 106x, 107x. So many users would know which number that is if they see +49 163 **** only. You can maybe increase this experience with the last base numbers because some users maybe have multiple connected mobile phones with the same country and local numbers. The result would be +49 163 *** ** 91.

  • Still doesn't actually solve the problem - where local code and last 2 digits are same. Commented Feb 7, 2019 at 3:52

Some assumptions:

a) The target country is India.

b) User can choose last four digits.

c) The possibility of the first 4 digits to be the same is very high, if the sim card/number is purchased during a certain time period/location. The first four digits identify the network operator and the telecom circle.

Now strictly going by the 4 options in the question:

Option 4 and Option 1 have high probability to fail. Among Option 2 and Option 3, Option 2 can be easier for a user since the digits at 5th and 6th positions are shown and has less chances of occurring in multiple phone numbers of a single user.

P.S. I found this question interesting since a person in my family has two phone numbers of this fashion: ABCD 3 UWXYZ and ABCD 0 UWXYZ. If that person were using this product, Option 1 and Option 4 would have failed.


For some reason, your user is seeing multiple mobile numbers and you want to obfuscate them. To me best strategy is to compare the options you are going to show to user and obfuscate accordingly.

See this example in Python: http://tpcg.io/WlwN71

def obfuscateNumbers(num1, num2, showDigits):
    num1_obfus = '';
    if(num1[len(num1)-showDigits:len(num1)] != num2[len(num2)-showDigits:len(num2)]):
        for dig in num1[0: len(num1)-showDigits]:
            num1_obfus += '*';
        mismtachFound = 0;
        for idx in range(len(num1)-showDigits):
            if(num1[idx] == num2[idx] or mismtachFound == 1):
                num1_obfus += '*';
                num1_obfus += num1[idx];
                mismtachFound = 1;

    num1_obfus += num1[len(num1)-showDigits:len(num1)];
    return num1_obfus;

num1 = '123456789';
num2 = '123456769';
num3 = '124356789'
secret = obfuscateNumbers(num1, num2, 2);
print num1 + ' changed to ' + secret;
secret = obfuscateNumbers(num1, num3, 3);
print num1 + ' changed to ' + secret;

Method takes 2 cell numbers (make sure are of same length), and also takes a number representing the last x digits that must be shown in output.

Example 1 - Say you passed: 123456789 & 123456769 and want last 2 digits to always be there (num1 & num2 in example). Code checks if last 2 digits are already different. Which is the case here - so num1 is obfuscated as: *******89

Example 2 - Say you passed 123456789 and 124356789 and Last Digits to show as 3. Now both numbers have same last 3 digits. So logic now tries to find the first place where the 2 numbers differ and then obfuscates accordingly as: **3***789

  • Make sense..and solves the problem, but would not be consistent for the user and hence would look for right solution further.
    – Ankur
    Commented Jan 23, 2019 at 3:58
  • This solution was what I came here to suggest
    – exp
    Commented Feb 1, 2019 at 12:21

For mobile numbers in India, I read that the first 4 numbers are the operators (phone company's) code and the last 6 numbers refer the number assigned to the user account.

In India, if each user typically uses the same phone company for all accounts, then showing any of the first four numbers is irrelevant and showing the last 6 digits is appropriate. "... mobile number ending in 123456"

Remember that (1) the first article advocates that the general public not use websites that showed partial phone numbers; and (2) the screen banking app is password protected and in banking apps the user is logged out after a few minutes of non-use.


I'd go with showing the first 2 and last 2 digits, so option 1.

Usually, I'd recommend going with showing the last 4 digits, but you mentioned that users can pick their own numbers. Generally speaking, the first few digits of a phone number are related to the telecom carrier, meaning these numbers hold less importance than the last 4 digits because they're the same for a lot of people. In your case, I'd argue they're both equally important. Some people have both a work phone and a personal phone, so it's imperative that they can tell which number it is without causing privacy concerns, especially if they're both from the same telecom carrier. A scenario where people intentionally always keep the same 4 digits for each of their phone numbers isn't unlikely, so you need to show some digits that they cannot pick themselves. Option 1 covers that the best.

Option 2 and 3 aren't as user friendly because people tend to remember their phone number in a set sequence. They'll have to mentally list off all digits in order to recognize their own number if it's formatted this way. It's a bit more effort and not proven to be safer.


It seems that the scenario you are describing might be just one of many that could arise when a user faces multiple options, where only part of the information is visible. The more numbers you conceal, the highest the risk of errors becomes. So, you could decide to show the numbers in the combination that best avoids number coincidence, but always keep in mind the context in which this happens for all users.

In the end, the optimal way is the one that causes the user less anxiety as a result of getting it wrong. So in the scenario that the user has to choose between multiple numbers and there's a risk of getting it wrong, the following outcomes are possible:

  • That they picked the wrong one and aren't aware of it
  • That they picked the wrong one, they are aware and can't correct it
  • That they picked the wrong once, they are aware and can fix it

Make sure that whatever option you decide to go with, will take into account the possible outcomes, especially if one will increase the risk of errors. If you increase that, make sure to also increase the ease in which a user can solve the problem. They could become aware of the mistake if you set up an SMS confirmation step, for example. Hope this helps!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.