Voter ID Validator
Validate Brazilian Voter ID numbers quickly and securely. For testing.
About the Voter ID Validator
The Voter ID Validator checks if a number follows the official algorithm of the Superior Electoral Court (TSE). The Voter ID has 12 digits: 8 sequential, 2 for state code, and 2 verification digits.
Ideal for developers who need to validate the Voter ID format in registration systems. The validation is mathematical and does not query the TSE database.
Anatomy & Structure of Brazilian Voter ID
The Voter Registration card contains 12 decimal digits in 3 segments:
| Position | Field | Length | Meaning & Rule | Example |
|---|---|---|---|---|
| 1 to 8 | Sequential Number | 8 digits | Sequential voter identity registration number | 04399701 |
| 9 & 10 | State Code (UF) | 2 digits | State code (01 for SP, 02 for MG up to 28 for TO and 29 abroad) | 01 |
| 11 & 12 | Check Digits | 2 digits | Dual Modulo 11 check digits with specific TSE remainder rules | 59 |
Official Voter ID Algorithm (TSE Modulo 11)
The Electoral Court calculates check digits taking into account the state code and remainders 0 and 10:
CD1 = (Sum1 % 11); CD2 = ((d[8]*7 + d[9]*8 + CD1*9) % 11)
- 1. Multiply first 8 digits by weights 2 to 9.
- 2. Evaluate remainder modulo 11.
- 3. If remainder is 10, CD1 is 0. If 0 and state is 01 (SP) or 02 (MG), CD1 is 1; else 0.
- 4. Multiply state digits by 7 and 8, and CD1 by 9.
- 5. Evaluate remainder modulo 11 with same state 01/02 rule.
- 6. Compare with digits 11 and 12.