Skip to main content

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:

PositionFieldLengthMeaning & RuleExample
1 to 8State Registry Number8 digitsSequential number issued by the Public Safety Secretariat12345678
9Check Character1 charModulo 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. 1. Multiply the 8 digits by factors 2 to 9.
  2. 2. Sum all products.
  3. 3. Compute integer remainder modulo 11.
  4. 4. If remainder is 10, check digit is "X".
  5. 5. If remainder is 0, check digit is "0".
  6. 6. Otherwise, check digit equals the remainder.

Frequently Asked Questions (FAQ)