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 assigned by Mexico's Secretaría de Gobernación through RENAPO, the national population registry. Under the 2018 Instructivo Normativo published in the Diario Oficial de la Federación, every CURP is an 18-character alphanumeric key given to Mexican nationals and to foreigners living legally in Mexico. Government agencies use it to identify people in their records. The code is built from parts of a person's name, birth date, sex, and place of birth, plus a character that tells apart people who would otherwise share the same code and a final check digit.

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
17Tells apart identical codes: 0–9 for births up to December 31, 1999, A–J for births from January 1, 2000
18A check digit calculated from the first 17 characters

The positions follow the table in the same Instructivo. The tool picks the state code from a list of 32 two-letter codes, one for each of the 31 states plus Mexico City (DF).

How to calculate the CURP check digit

The 18th character catches typing and copying errors. The Instructivo says only that it comes from an algorithm applied by the Secretaría de Gobernación. This tool calculates it from the first 17 characters with the weighted method below:

  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 start at 0 and count up only when two people share the first 16 characters)

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 makes up three short random names, each a letter, a vowel and a consonant, and takes positions 1–4 and 14–16 from them. If the first four letters spell a word on its built-in list of offensive words, it tries again. It then picks a random calendar-valid birth date between 1940 and last year, a random sex (H or M), and a random state code. For position 17 it picks a random digit if the birth year is before 2000, or a random letter from A to J if it is 2000 or later, following the Instructivo. Finally it calculates the check digit with the formula above. The result has the right shape but 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's federal government adopted the CURP through an agreement published in the Diario Oficial de la Federación on October 23, 1996. It said the CURP would be assigned to everyone living in Mexico and to Mexican nationals living abroad, with RENAPO in charge of assigning it. The current rules for building the code are set out in the 2018 Instructivo. In position 17, the switch from digits to letters marks the century of birth: digits for births in the 1900s, letters for births from 2000 on.

What the code reveals

Unlike a purely sequential number, a CURP embeds readable information: birth date, sex, and place of birth. The Instructivo notes that these parts, along with the first four letters, let anyone check whether a key was put together correctly. This tool checks that each generated birth date is a real calendar date in the past.

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 the Secretaría de Gobernación, through RENAPO, assigns a real CURP. A generated code belongs to no one and must not be used on any government form or official document.

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

Position 17 tells apart people whose first 16 characters are the same. Under the Instructivo it is a digit from 0 to 9 for people born up to 1999 and a letter from A to J for people born in 2000 or later. This generator follows the same rule: a digit for pre-2000 dates and a letter from A to J for post-2000 dates.

Why does a CURP sometimes have an X as its second character?

Because the first four characters would otherwise spell a word considered rude in Spanish. RENAPO replaces the second character with X in that case, so BUEI becomes BXEI.

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. Secretaría de Gobernación, Diario Oficial de la Federación. Instructivo Normativo para la asignación de la Clave Única de Registro de Población (June 18, 2018). sidof.segob.gob.mx — 18-character alphanumeric key; meaning of each position; position 17 is 0–9 up to 1999 and A–J from 2000; position 18 is a check digit from an algorithm.
  2. Secretaría de Gobernación, Diario Oficial de la Federación. Convenio de Coordinación con el Estado de Guanajuato sobre la CURP. sidof.segob.gob.mx — the agreement adopting the CURP was published in the DOF on October 23, 1996, assigning it to everyone living in Mexico and to nationals abroad.