Skip to content

CURP Generator - Test Mexican ID Codes for Development

Generate random 18-character CURP codes in the official Mexican RENAPO format, complete with a valid check digit, for software testing and database seeding.

Generate a random, syntactically valid sample CURP with a correct check digit.

Loading calculator...
📚

Documentation

What is a CURP generator?

A CURP generator creates a random sample CURP, the 18-character code Mexico uses to identify residents and citizens. The output has the correct structure and a correctly calculated check digit, but it is not linked to a real person. Developers use tools like this to test software without exposing anyone's real personal data.

What is a CURP?

CURP stands for Clave Única de Registro de Población, or Unique Population Registry Code. It is issued by RENAPO (Registro Nacional de Población e Identidad), Mexico's national population registry. Almost every resident of Mexico has one. It appears on school enrollment forms, tax records, medical paperwork, and voter registration. The code is built from parts of a person's name, birth date, sex, and state of birth, plus two extra characters that help tell apart people who would otherwise share the same code.

CURP structure and format

A CURP always has 18 characters, all uppercase letters or digits. Each position has a fixed meaning.

PositionMeaning
1First letter of the paternal surname
2First internal vowel of the paternal surname (the first vowel after the first letter)
3First letter of the maternal surname
4First letter of the given name
5–6Last two digits of the birth year
7–8Birth month (01–12)
9–10Birth day (01–31)
11Sex: H for Hombre (male), M for Mujer (female)
12–13Two-letter code for the state of birth, such as DF for Mexico City or JC for Jalisco
14First internal consonant of the paternal surname
15First internal consonant of the maternal surname
16First internal consonant of the given name
17A digit for people born before 2000, or a letter for people born in 2000 or later
18A check digit calculated from the first 17 characters

Mexico has 32 state codes in this scheme, one for each of the 31 states plus Mexico City.

How to calculate the CURP check digit

The 18th character catches typing and copying errors. It is calculated from the first 17 characters using this method:

  1. Look up each of the first 17 characters in the alphabet 0123456789ABCDEFGHIJKLMNÑOPQRSTUVWXYZ. Its position in this list, starting at 0, is its value. So 0 has value 0, A has value 10, R has value 28, and Z has value 36.
  2. Multiply each character's value by a weight. The weight starts at 18 for the first character and drops by one for each character after it, ending at 2 for the 17th character.
  3. Add the 17 products together to get a sum, S.
  4. The check digit is (10 − (S mod 10)) mod 10.

Worked example

Consider a fictional person, Juan Pérez Ramírez, born male on March 15, 1985, in Jalisco.

  • Position 1: P, first letter of "Pérez"
  • Position 2: E, first internal vowel of "Pérez" (the letters after the first one are E, R, E, Z, so the first vowel is E)
  • Position 3: R, first letter of "Ramírez"
  • Position 4: J, first letter of "Juan"
  • Positions 5–10: 850315, for 1985-03-15
  • Position 11: H, male
  • Positions 12–13: JC, Jalisco
  • Position 14: R, first internal consonant of "Pérez"
  • Position 15: M, first internal consonant of "Ramírez"
  • Position 16: N, first internal consonant of "Juan"
  • Position 17: 0, a digit, because the birth year is before 2000 (real records use a fixed rule to pick which digit; this example uses 0)

The first 17 characters are PERJ850315HJCRMN0. Running the formula above on this string gives a sum of 2342. Since 2342 mod 10 = 2, the check digit is (10 − 2) mod 10 = 8. The full CURP is PERJ850315HJCRMN08.

How this generator works

The tool builds a sample CURP in a few steps: it picks random letters for the name portion, a random calendar-valid birth date between 1940 and the current year, a random sex, and a random state code. It then adds the internal-consonant characters, chooses a letter or digit for position 17 based on whether the random birth year is 2000 or later, and calculates the check digit with the formula above. The result is a syntactically correct CURP that is not tied to any real person.

Common uses for generated CURPs

Software teams use generated CURPs to test registration forms, database fields, and validation logic before launching a product for Mexican users. Because the codes are random, they can be created in bulk for load testing or seeding a development database, without using or storing anyone's real identifying information.

History of the CURP system

Mexico introduced CURP in 1996 to replace a patchwork of identification systems that different government agencies used separately, which made it hard to match records for the same person across databases. Since then, CURP has become a requirement for many government interactions, including school enrollment, tax filing, and applying for a passport. RENAPO later began assigning a letter instead of a digit in position 17 for people born from 2000 onward, because the supply of remaining digit combinations for the older date ranges was running low.

How CURP compares to other national ID systems

CountrySystemFormat
MexicoCURP18 characters, letters and digits
United StatesSocial Security Number9 digits
CanadaSocial Insurance Number9 digits
BrazilCPF11 digits
IndiaAadhaar12 digits
SpainDNI/NIE8 digits plus a check letter

Unlike a purely sequential number, CURP embeds readable information: birth date, sex, and state. That makes it possible to check whether the encoded date is a real calendar date, which is one of the checks this tool performs when generating a sample code.

Frequently asked questions

What is a CURP generator used for?

It creates a random code in the same format as a real CURP, for use in software testing, database seeding, and checking that validation logic works correctly.

Are generated CURPs linked to real people?

No. Every character is chosen at random or calculated from other random values. The result is not connected to any real person, living or dead.

Can a generated CURP be used on an official form?

No. Only RENAPO can issue a valid CURP for a real person. Using a generated code on a government form, tax filing, or any official document would be fraudulent.

Why do some CURPs end in a letter and others in a digit at position 17?

Position 17 tells apart people who would otherwise have identical CURPs. RENAPO uses a digit for people born before 2000 and a letter for people born in 2000 or later.

Does this tool store the CURPs it generates?

No. The code is generated in the browser using JavaScript. Nothing is sent to a server or saved.

How is the check digit calculated?

Each of the first 17 characters is converted to a number based on its position in a fixed 37-character alphabet, multiplied by a weight from 18 down to 2, and summed. The check digit is (10 − (sum mod 10)) mod 10. See the worked example above.

References

  1. SEGOB (Secretaría de Gobernación), CURP official portal.
  2. RENAPO (Registro Nacional de Población e Identidad), Instructivo Normativo para la Asignación de la CURP.