Verifying a Moroccan Electronic National Identity Card (CNIE): Complete Guide in 4 Checks (MRZ, Security, Validity)

Verify a Moroccan Electronic Identity Card (CNIE): 4 Checkpoints

Article updated in February 2026 to reflect the latest developments in Moroccan national identity cards and online verification tools.

The Moroccan National Identity Card (CNIE) is an official document that allows any Moroccan citizen to prove their identity and, when valid, their Moroccan nationality.

Mandatory from the age of 16 (and issued earlier in some cases), the CNIE is now widely used in many contexts: KYC, banking, real estate, insurance, public administrations, online platforms, and digital services.

Like any identity document, it is also a frequent target of document fraud: expired cards, visual alterations, inconsistencies between data fields, MRZ tampering, or identity theft.

In 2026, it is now possible to carry out a first online verification using documentary analysis and automatic MRZ reading, before completing the process with a visual inspection of the document.

So, how can you verify a Moroccan electronic identity card and ensure that the document presented is authentic?

The answer is provided in this guide, through 4 essential verification checks.

Need more information on how to verify the authenticity of your ID documents ? Check out our comprehensive guide to verifying ID documents, which includes all the resources available !

Check 0: automatic verification of a Moroccan identity card

Before any visual inspection of a Moroccan CNIE, it is now possible to perform an initial automatic online verification.

This step notably allows:

  • automatic reading of the MRZ
  • validation of check digits
  • consistency checks across fields (name, date of birth, expiration date, nationality, personal number)
  • detection of common data entry errors or inconsistencies
  • generation of a timestamped PDF report

Some solutions, such as TrustDocHub, make it possible to perform this analysis from a simple image, directly through a web application.

⚠️ However, there is no official public database allowing the formal validation of a Moroccan CNIE. Verification therefore relies on documentary analysis and must be complemented by a visual inspection of the document.

Check 1: overall appearance when verifying a Moroccan identity card

The first step to verify a Moroccan identity card when you have access to the original document is its overall appearance: it must show no traces of cutting, peeling, modification, or any kind of correction.

Pay particular attention to the level and around the photo especially.

The new electronic identity card is in ID-1 format, the size of a bank card.

Check 2: Verify a Moroccan Identity Card by Cross-Checking Information

The second step to verify a Moroccan identity card online is to check the consistency of the information on the document.

Document Number

The document number can be found in two different places: at the top of the back side, and in the first line of the MRZ band.

Both must be identical:

Verify a Moroccan electronic identity card, document number
Verify a Moroccan electronic identity card, document number

Personal Number

The cardholder’s personal number can be found in two distinct places: in the middle of the front side of the card, and at the beginning of the second MRZ line in the format YYMMDD:

Verify a Moroccan electronic identity card, personal number front
Verify a Moroccan electronic identity card, personal number front

Verify a Moroccan electronic identity card, personal number back
Verify a Moroccan electronic identity card, personal number back

Date of Birth

The holder’s date of birth can again be found in two distinct places: in the middle of the front side of the card, and at the beginning of the second MRZ line in the format YYMMDD:

Verify a Moroccan electronic identity card, date of birth front
Verify a Moroccan electronic identity card, date of birth front

Verify a Moroccan electronic identity card, date of birth back
Verify a Moroccan electronic identity card, date of birth back

Surname and Given Names

Similarly, the surname and given names can be found on the front side of the card and in the third line of the MRZ band:

Verify a Moroccan electronic identity card, surname front
Verify a Moroccan electronic identity card, surname front

Verify a Moroccan electronic identity card, surname back
Verify a Moroccan electronic identity card, surname back

Card Expiry Date

Finally, the last element present twice on the card: the expiry date, found on the front side and in the second MRZ line in the format YYMMDD:

Verify a Moroccan electronic identity card, expiry date front
Verify a Moroccan electronic identity card, expiry date front

Verify a Moroccan electronic identity card, expiry date back
Verify a Moroccan electronic identity card, expiry date back


Individuals, do you occasionally need to verify one or more identity documents ?

Professionals, do you need to integrate proof of identity validation into one of your business processes, including all European identity cards and global passports ?


Check 3: Verify a Moroccan Identity Card Using the MRZ Band

The lower part of the new Moroccan identity card consists of three lines that repeat the information present on the card, with validation keys that prevent reading errors or falsifications.

Composition of the MRZ Band of the Moroccan Identity Card

First Line

Verify a Moroccan electronic identity card, MRZ line 1
Verify a Moroccan electronic identity card, MRZ line 1

  1. Document Type: 2 characters, code indicating the type of document, represented by the letters “I<” or “ID”.
  2. Issuing Country: 3 characters, the ISO 3166-1 alpha-3 code of the issuing country.
  3. Card Number: 9 characters, unique card number.
  4. Check Digit: 1 character, check digit for the unique card number.
  5. Personal Number: 8 characters, personal number of the cardholder.
  6. Line Ending: chevrons “<” to fill the line.

Second Line

Verify a Moroccan electronic identity card, MRZ line 2
Verify a Moroccan electronic identity card, MRZ line 2

  1. Date of Birth: 6 characters, year, month and day of birth in YYMMDD format.
  2. Check Digit: 1 character, check digit for the date of birth.
  3. Gender: 1 character, “M” or “F”.
  4. Expiration Date: 6 digits, card expiration date in YYMMDD format.
  5. Check Digit: 1 character, check digit for the expiration date.
  6. Country Code: 3 characters, ISO 3166-1 alpha-3 code of the cardholder’s nationality.
  7. Separator: 11 chevrons “<“.
  8. Check Digit: 1 character, check digit for the concatenation of characters from line 1 positions 6-15, line 2 positions 1-7, and line 2 positions 9-15.

Third Line

Verify a Moroccan electronic identity card, MRZ line 3
Verify a Moroccan electronic identity card, MRZ line 3

  1. Cardholder’s Surname and Given Names: surname and given names of the holder, starting with the surname followed by the given name. The surname and given name are separated by two “<” characters. If there is a compound surname, compound given name, or multiple given names, they are separated by the “<” character. Spaces and apostrophes are replaced by the “<” character, and the name is truncated to 30 characters if needed, with any accents on letters removed. The line is then completed with the “<” character.

Verify a Moroccan Identity Card Using the MRZ Check Digits

A Moroccan identity card has 4 check digits (or security keys) that validate the preceding information.

They help prevent transcription errors or modifications, intentional or not.

How Does the Algorithm Work?

The algorithm used to create and validate the check digits is common to all identity documents: characters have a weight, which is multiplied by a factor depending on their position in the string (7, 3, and 1).

Digits have their face value (“0” = 0, “1” = 1, …, “9” = 9), the chevron “<” has a value of 0, while letters start at 10 for “A”, 11 for “B” up to 35 for “Z”.

Example

Let’s take the check digit for the date of birth from the specimen above as an example.

The string to validate is: “831205”.

To calculate the check digit, proceed as follows:

– “8” has a weight of 8 and is in the first position, so multiply by 7: 8 * 7 = 56

– “3” has a weight of 3 and is in the second position, so multiply by 3: 3 * 3 = 9, add to previous 56: 9 + 56 = 65.

– “1” has a weight of 1 and is in the third position, so multiply by 1: 1 * 1 = 1, add to previous 65: 1 + 65 = 66.

– 2 * 7 = 14 and 14 + 66 = 80

– 0 * 3 = 0 and 0 + 80 = 80

– 5 * 1 = 5 and 5 + 80 = 85

We get a total of 85, from which we take modulo 10 (the remainder of the Euclidean division by 10), which keeps only the last digit, i.e., “5”.

Our check digit is therefore valid because 5 is indeed what appears on the document!

Check 4: Verify a Moroccan Identity Card with Its Physical Security Features

An identity document contains various elements that help validate its authenticity.

This is the final step to verify a Moroccan identity card online, as it takes the longest.

Security Features on the Front Side

There are various next-generation security devices to protect the front side of the card.

Verify a Moroccan electronic identity card CNIE, front protections
Verify a Moroccan electronic identity card CNIE, front protections

Security Features on the Back Side

The same applies to the back side of the card:

Verify a Moroccan electronic identity card CNIE, back protections
Verify a Moroccan electronic identity card CNIE, back protections

Conclusion

You now have all the keys to verify a Moroccan identity card online and ensure its authenticity!

No specialized equipment is needed: a little vigilance, some time, and you will be able to avoid most of the frauds that can be encountered daily!

To go further, it is also possible to use an online document verification solution to automate these checks.
For example, TrustDocHub allows you to verify a Moroccan identity card in just a few seconds from an image, with results available directly in the application and as a PDF report.


Individuals, do you occasionally need to verify one or more identity documents ?

Professionals, do you need to integrate proof of identity validation into one of your business processes, including all European identity cards and global passports ?


FAQ – Verification of the Moroccan National Identity Card (CNIE)

Shopping Cart
Scroll to Top