Thursday, December 22, 2016

How To Calculate an IMEI from a MEID/ESN (Luhn's Algorithm)

This is a short article on how to get an IMEI number from a MEID or ESN, which should be the same. For a lot of people, this can be found within the device. But there will be times when a device will just not show this information.

Why Do I Need This?
As stated above, most of the time an IMEI can be easily found in your device settings. Other times you may even be able to find this printed on the back of a device. However, there will be times that neither provide an IMEI.

As for what it is needed for, most of us would have to give it to a carrier to register our device on a network before we can use the network. There may be other reasons, but this would be the most common.

For Me
I recently had an issue with a brand new LG G5 (US992) device that comes factory unlocked, but is branded for US Cellular. There was nothing on the back, and the settings only showed an MEID and ESN.

Reading through some forum threads, some people stated that popping in a GSM SIM card would allow me to see an IMEI in the settings if the device was on a CDMA network previously. The LG G5 had been on US Cellular for about two days, so maybe this was a simple solution. But after putting in a GSM SIM card, nothing changed...

Luhn's Algorithm
Math. Math is the solution here. If you have either the MEID or ESN, you have the ability to calculate your IMEI.

An MEID or ESN will be 14 digits, while an IMEI will be 15 digits. The IMEI will have the same first 14 digits as an MEID or ESN, with a final 15th digit called a check digit. Luhn's algorithm is a way to obtain that 15th digit. It is a public domain algorithm commonly used today for numerous devices.

The Math
I will give you a simple visual showing of how it is done. We will first write out our MEID:

12345678912345

You will then double every second digit of the MEID:

1 2 3 4 5 6   7 8   9 1 2 3 4 5  
1 4 3 8 5 12 7 16 9 2 2 6 4 10

Add up all the digits as though they were all single numbers:

1  4  3  8  5  12     7 16     9  2  2  6  4  10         
1+4+3+8+5+1+2+7+1+6+9+2+2+6+4+1+0=62

Now add to the summed number until it is divisible by 10 and results in a whole number:

62+8=70
70/10=7

The number that we added to the 62 is our check digit:

8

Our IMEI would then be:

123456789123458

This is just an example, but shows exactly how one would use a real MEID/ESN to calculate the 15th digit (to get the IMEI).

Does It Work?
I have used this during two occasions. The first was for my LG G5, and I was able to validate it through an IMEI checker, which did display the correct LG G5 variant--and was later sold to a customer with that IMEI, and who has not complained since our transaction.

The second occasion was during a job that required activating phones at times. I had an elderly customer who did not have the IMEI but provided the ESN to me. Following the formula above, I calculated his 15th digit and was able to confirm that his device was fully activated. 

6 comments:

  1. I can see that you are putting a lot of efforts into your blog. Keep posting the good work. Some really helpful information in there. Nice to see your site. For more information visit legal herbal empire for sale

    ReplyDelete
  2. More and more people are facing dire living conditions here and over seas. Over one billion people are literally starving to death. The threat of Global Pandemics is as real as it gets.guarantor loans

    ReplyDelete
  3. Very informative article for tech enthusiast.You can follow this blog and learn to calculate IMEI from a MEID.IMEI Check is the top site to check number of your mobile whether android or iphone.

    ReplyDelete
  4. have a great day.

    https://scienceleisure.blogspot.com/2018/04/biodiversity-hotspot-of-north-american.html

    ReplyDelete