Brazilian voter ID generator and validator

Generate and validate a Brazilian voter ID for tests, with the check digit algorithm shown with a worked example.

loading Brazilian voter ID generator and validator
About this tool

Brazilian voter ID: what it is and how to test it

The título de eleitor is the voter registration number of the Brazilian electoral court (TSE). It has 12 digits and, unlike other documents, carries the state of registration inside: positions 9 and 10. That makes it a good test of forms that cross-check the state with the number.

For tests only. These numbers have a correct format and check digit but belong to no real person or account. Never use them to deceive, to open accounts or to bypass a check. The numbers on this page come from the same generator as the tool, with a fixed seed so that the examples do not change; the tool creates new ones at every click.

Structure of the number

12 digits: 8 of sequence, 2 of the state (01 São Paulo to 27 Tocantins, 28 for voters abroad) and 2 check digits. The tool lets you choose the state, and the table below lists the code of each one as the service generates it.

The check digit, step by step

The first check digit weights the 8 sequence digits with 2 to 9, sums them and takes the remainder by 11. The second takes the two state digits times 7 and 8 plus the first check digit times 9. In both, a remainder of 10 becomes 0, and a remainder of 0 becomes 1 when the state is São Paulo (01) or Minas Gerais (02).

Worked example with 4453 8794 0779:

PositionCharacterValueWeightProduct
14428
244312
355420
433515
588648
677749
799872
844936

First digit: sum = 260; 260 mod 11 = 7, so the first check digit is 7. The state digits are 07 (CE). Second digit: 0 x 7 + 7 x 8 + 7 x 9 = 119; 119 mod 11 = 9, so the second check digit is 9.

State codes (positions 9 and 10)

The service generates the voter ID of each state with its code; ZZ is the code for voters abroad.

UFCodeUFCodeUFCodeUFCode
SP01MG02RJ03RS04
BA05PR06CE07PE08
SC09GO10MA11PB12
PA13ES14PI15RN16
AL17MT18MS19DF20
SE21AM22RO23AC24
AP25RR26TO27ZZ28

Valid examples

Five numbers generated by the tool with a fixed seed, each one accepted by its validator:

Example (formatted)Without maskValidator
4453 8794 0779445387940779valid
1543 4414 1210154344141210valid
9116 4346 1007911643461007valid
7997 5466 1783799754661783valid
1880 1308 0531188013080531valid

How the validator answers

The same first example, one with a changed ending and one truncated, checked by the validator:

ValueResultReason
4453 8794 0779valid-
445387940770invalidthe check digit should be 79
4453879407invalidneeds 12 digits

Common mistakes

  • A voter ID that fails only for São Paulo or Minas Gerais numbers usually has the special rule missing: a zero remainder gives 1 in those two states and 0 in the others.
  • The old 10- and 11-digit numbers are not the current format; the validator expects the 12 digits, so pad or fix the number before checking.

Frequently asked questions

Which digits of the voter ID are the state?

Positions 9 and 10, just before the two check digits. 01 is São Paulo, 02 Minas Gerais, 03 Rio de Janeiro and so on; the table on this page shows all of them.

Does a valid number prove that someone is registered to vote?

No: only the electoral court can confirm a registration. The digits prove the structure, nothing else.

Can I use a Brazilian voter ID number generated here in a real system?

No. A number such as 4453 8794 0779 has a correct format and check, but nobody was issued it, and it may coincide with a real holder by chance. Use it in test environments, demos and automated tests that never leave your control.

Report a problem