The IMEI format, in full

What each digit is for, how the checksum works, and where the neighbouring identifiers differ.

Fifteen digits, four fields

An IMEI is 15 decimal digits: a 14-digit body plus a check digit. Written out with separators it takes the form AA-BBBBBB-CCCCCC-D, which has been the standard layout since the format was revised in 2004.

FieldDigitsExampleMeaning
Reporting Body Identifier235The GSMA-approved body that allocated the TAC
Rest of the TAC6491503Together with the RBI, identifies the device model
Serial number6847266Assigned by the manufacturer within that model
Check digit19Luhn checksum over the preceding 14 digits

The first eight digits together are the Type Allocation Code. Every handset of a given model shares a TAC; the six digits after it distinguish individual units. Six digits caps a single TAC at a million devices, which is why popular models hold several.

The Reporting Body Identifier

The leading two digits name the certification body that issued the TAC, assigned by the Global Decimal Administrator. Three you will see constantly:

  • 01 — PTCRB, covering North America
  • 35 — BABT, covering the UK and Europe
  • 86 — TAF, covering China

Others exist for other regions and bodies. The RBI is the reason a random 15-digit number rarely looks convincing: real IMEIs cluster on a small set of leading pairs, so the generator draws from that set rather than picking two digits at random.

The check digit

The last digit is a Luhn checksum, the same algorithm used on payment card numbers. It is deliberately simple, and it exists to catch human error rather than to prevent forgery — any single wrong digit, and nearly every transposition of two adjacent digits, changes the result.

Calculating it

  1. Take the 14-digit body.
  2. Starting from the rightmost digit of that body, double every second digit — the 1st, 3rd, 5th and so on counting from the right.
  3. If a doubled value exceeds 9, subtract 9 from it (equivalently, add its two digits together).
  4. Sum every digit, doubled and untouched alike.
  5. The check digit is whatever brings that sum up to the next multiple of ten.

Worked through with 35491503847266:

  • Digits that get doubled, from the right: 6, 2, 4, 3, 5, 9, 5 → 3, 4, 8, 6, 1, 9, 1 → 32
  • Digits left alone: 6, 7, 8, 0, 1, 4, 3 → 29
  • Total 61; the next multiple of ten is 70; the check digit is 9

Giving 354915038472669. To verify rather than compute, run the same doubling over all 15 digits — starting the doubling one position further left — and confirm the total is divisible by 10.

In code

// Check digit for a 14-digit body.
function checkDigit(body) {
  let sum = 0;
  for (let i = 0; i < body.length; i++) {
    let d = Number(body[body.length - 1 - i]);
    if (i % 2 === 0) {              // every second digit from the right
      d *= 2;
      if (d > 9) d -= 9;
    }
    sum += d;
  }
  return (10 - (sum % 10)) % 10;
}

// Validate a complete 15-digit IMEI.
function isValid(imei) {
  const digits = imei.replace(/\D/g, "");
  if (digits.length !== 15) return false;
  return String(checkDigit(digits.slice(0, 14))) === digits[14];
}

Note the off-by-one that catches people out: when you validate all 15 digits you double the even positions from the right, because the check digit occupies the position that was odd when you computed it. Getting this backwards produces a routine that rejects every valid IMEI — the validator is a quick way to sanity-check your own implementation.

IMEI, IMEISV, MEID and ESN

IdentifierLengthNotes
IMEI15 digits14-digit body plus Luhn check digit
IMEISV16 digitsSame 14-digit body, but the check digit is replaced by a two-digit software version number. No checksum
MEID14 hex charactersCDMA equivalent; hexadecimal, so it can contain A–F
ESN8 hex charactersThe older CDMA identifier that MEID replaced

If a field in your system accepts "the device identifier", decide early which of these it means. A validator that assumes 15 decimal digits will reject every MEID it is handed, and a 16-digit IMEISV will fail a checksum test that was never applicable to it.

A dual-SIM handset carries two IMEIs, one per radio. Systems that assume one identifier per device tend to discover this late, usually in a support ticket.

Where the IMEI is used

Networks read the IMEI to identify the equipment itself, independently of the SIM. That separation is what makes it useful for blocking: report a handset stolen and the identifier can be added to an Equipment Identity Register, and onward to the GSMA's Central Equipment Identity Register, which participating carriers consult. A blocked handset stays blocked when the SIM is swapped, and increasingly when it crosses a border.

To read your own, dial *#06#. It is also printed on the SIM tray or the back of most devices, and shown under the device information screen in settings.

Changing the IMEI stored in a handset is a criminal offence in the United Kingdom under the Mobile Telephones (Re-programming) Act 2002, and is similarly prohibited in India, Australia and elsewhere. Generated numbers are for test data in software you control. They have no application to a physical device.

Using generated IMEIs sensibly

  • Keep them out of production. A fixture value that reaches a live device registry is a data-quality bug that is tedious to unpick later.
  • Vary the TAC across your fixtures. If every test record shares one TAC you will never catch a grouping or partitioning bug.
  • Test the invalid cases too. A 14-digit number, a 16-digit IMEISV, a letter in the middle, and a number one digit off from valid all belong in the suite.
  • Do not treat validity as existence. If your product's behaviour depends on a device being real, checksum validation is not the check you need.