RG (ID) Generator
Generate structurally valid General Registry (RG) numbers. QA testing.
Waiting for generation...
About the RG Generator
The General Registry (RG) Generator creates random numbers in the traditional format used in most Brazilian states. Although the RG lacks a unified national validation formula, this tool generates numbers consistent with common masks.
This tool is ideal for filling out test forms and validating input masks in applications that don't require strict state-specific checksum validation.
Anatomy & Structure of Brazilian RG
The traditional state RG comprises 9 characters in 2 segments:
| Position | Field | Length | Meaning & Rule | Example |
|---|---|---|---|---|
| 1 to 8 | State Registry Number | 8 digits | Sequential number issued by the Public Safety Secretariat | 12345678 |
| 9 | Check Character | 1 char | Modulo 11 checksum character (allowing X when remainder equals 10) | X |
Official RG Checksum Algorithm (SSP Modulo 11)
The RG check character computation uses weights from 2 to 9 left to right:
Rem = Σ (d[i] * (i + 2)) % 11; if Rem == 10 -> CD = "X"; if Rem == 0 -> CD = "0"; else CD = Rem
- 1. Multiply the 8 digits by factors 2 to 9.
- 2. Sum all products.
- 3. Compute integer remainder modulo 11.
- 4. If remainder is 10, check digit is "X".
- 5. If remainder is 0, check digit is "0".
- 6. Otherwise, check digit equals the remainder.