RG Generator

REPÚBLICA FEDERATIVA DO BRASIL

Estado de São Paulo

Carteira de Identidade

Generated RG

Action

Status

902182079

Not copied

830903975

Not copied

158269615

Not copied

Need to check an existing RG?

Validate RG

Meet the RG Generator

A free tool that generates random General Registry (RG) numbers for you to use during software development and testing, or any other projects.

Main features of the RG Generator:

  • Generate RG with or without punctuation (dots and hyphen).
  • Generate multiple RGs at once!

Refresh the page to generate new RG numbers or click "Generate RG" to quickly create RG numbers.

What is an RG?

The General Registry (RG), also known as an Identity Card, is a national civil identification document in Brazil. It is issued by the Public Security Secretariat (SSP) of each state and is essential for proving a citizen's identity in various situations.

RG Structure and Validation

The RG, especially in the standard adopted by states like São Paulo, consists of 9 characters: 8 numbers followed by a check digit. The check digit can be a number from 0 to 9 or the letter 'X' (which represents the number 10).

For example, the number 123456789 is formatted as 12.345.678-9.

Important Rules:

- The logic for generating and validating the RG may vary slightly from state to state in Brazil. Our tool uses the official algorithm of SSP-SP (São Paulo).

- The check digit ensures that the generated number meets the mathematical rules for document validity.

What is the RG issuing agency?

The issuing agency (órgão expedidor or órgão emissor in Portuguese) is the state institution that issued the RG. Almost every form that asks for an RG number also asks for it, along with the state (UF) and the issue date.

Where it appears on the document

The old RG has no line labeled "órgão expedidor". The state and the agency are in the header on the front, above the photo, and some models print the acronym directly, such as SSP/SP. On the National Identity Card (CIN), the issuing agency is a mandatory field (Decree 10,977/2022, art. 11).

Most common acronyms

SSP is the Secretaria de Segurança Pública (state public security department), usually followed by the state code (SSP/SP, SSP/BA). PC is the Polícia Civil, and DETRAN is the state traffic department, which issues the RG in Rio de Janeiro. Some states use their identification institute, such as IIRGD in São Paulo and IGP in Rio Grande do Sul. The list varies by state and by when the RG was made, so what is printed on your document is always the reference.

How to fill it in a form

  • With two fields (agency and UF): the acronym in one and the state code in the other, such as SSP and SP.

  • With a single field: acronym and state together, such as SSP/SP.

  • If the field is a dropdown: look for the acronym printed on the document. If it is not listed, pick the closest one (SSP or PC) or "Others".

  • To test with the RGs from this generator, which follow the São Paulo standard, use SSP/SP.

What the CIN prints as the issuing agency

On the CIN, the general registration number is the CPF. The issuing agency field is still there, and each state's text is standardized by a federal table. That is why it varies: Bahia prints SSP/BA, Rio de Janeiro prints DETRAN RJ and Minas Gerais prints the full name of the Polícia Civil.

Text printed in the CIN issuing agency field, by state
UFPrinted on the CIN
ACINSTITUTO DE IDENTIFICAÇÃO RAIMUNDO HERMÍNIO DE MELO - IIRHM
ALINSTITUTO DE IDENTIFICAÇÃO DEL. MÁRIO PEDRO DOS SANTOS
AMINSTITUTO DE IDENTIFICAÇÃO ADERSON CONCEIÇÃO DE MELO - IIACM
APPOLÍCIA CIENTÍFICA DO AMAPÁ
BASSP/BA
CEPERÍCIA FORENSE DO ESTADO DO CEARÁ COORDENADORIA DE IDENTIFICAÇÃO-CIHPB
DFINSTITUTO DE IDENTIFICAÇÃO PCDF
ESINSTITUTO DE IDENTIFICAÇÃO / PCIES
GOPOLÍCIA CIVIL DE GOIÁS - SIH
MAINSTITUTO DE IDENTIFICAÇÃO DO MARANHÃO
MGPOLÍCIA CIVIL DO ESTADO DE MINAS GERAIS
MSINSTITUTO DE IDENTIFICAÇÃO GONÇALO PEREIRA - IIGP
MTINSTITUTO DE IDENTIFICAÇÃO/MT POLITEC
PADIRETORIA DE IDENTIFICAÇÃO ENÉAS MARTINS
PBPOLÍCIA CIVIL DO ESTADO DA PARAÍBA
PEINSTITUTO DE IDENTIFICAÇÃO TAVARES BURIL
PIINSTITUTO DE IDENTIFICAÇÃO DIGITAL "FÉLIX PACHECO" - IIDFP
PRINSTITUTO DE IDENTIFICAÇÃO DO PARANÁ
RJDETRAN RJ
RNITEP/RN
ROINSTITUTO DE IDENTIFICAÇÃO ENGRÁCIA DA COSTA FRANCISCO - IICCECF/PCRO
RRINST. DE IDENTIFICAÇÃO ODÍLIO CRUZ SECRETARIA DE SEGURANÇA PÚBLICA DE RR
RSINSTITUTO-GERAL DE PERÍCIAS/RS
SCPOLÍCIA CIENTÍFICA DE SANTA CATARINA (PCISC)
SEINSTITUTO DE IDENTIFICAÇÃO DE SERGIPE PAP. WENDEL DA SILVA GONZAGA - IIWSG
SPINSTITUTO DE IDENTIFICAÇÃO RICARDO GUMBLETON DAUNT - IIRGD
TOINSTITUTO DE IDENTIFICAÇÃO SSPTO

Source: Cefic Resolution No. 24, of September 8, 2025 (Diário Oficial da União), Table 2, "Representação na CIN" column. Checked on 2026-11-21.

Why there is no national RG standard

The RG has never had a single number across the country. Each state numbered and issued its own, so the format changes from one state to another, and the same person could hold RGs with different numbers in different states. São Paulo's is the only one whose check digit rule we found documented, and it is the one this generator uses. For the other states, a validator can check length and characters, but not the digit.

How the São Paulo RG check digit is calculated

A São Paulo RG has 8 digits and a check digit. Multiply the 8 digits by the weights 9, 8, 7, 6, 5, 4, 3 and 2, in that order, and add them up. The check digit is the remainder of dividing that sum by 11. Example with 12.345.678:

Weights from 9 to 2 applied to 12345678
DigitValueWeightProduct
1199
22816
33721
44624
55525
66424
77321
88216
Sum156

The sum is 156, and 156 divided by 11 leaves a remainder of 2. The check digit is 2, and the full RG is 12.345.678-2.

When the remainder is 10, the digit is the letter X, as in 10.000.006-X (sum 21, remainder 10). When the remainder is 0, the digit is 0. This gives the same result as the version many guides teach, with weights from 2 to 9 left to right and the digit equal to 11 minus the remainder, where 10 becomes X and 11 becomes 0.

RG and CIN: what changes for your tests

The National Identity Card (CIN) adopts the CPF number as the national general registry number (Decree 10,977/2022, art. 3). With it, a person has a single number across the country instead of one RG per state. The old RG remains valid until February 28, 2032. In practice, a system must accept both: the state RG, with its own format and sometimes an X, and the CIN, where the general registry number is the 11 digits of the CPF.

Sources: Decree 10,977/2022 and the Questions and Answers on the new National Identity Card from Brazil's Ministry of Management and Innovation in Public Services (gov.br). Checked on 2026-11-21.

What to test with a generated RG

Mask and the X digit

Check that the field accepts an X at the end and that the 00.000.000-0 mask does not drop it. A number-type field, or a digits-only regex, rejects RGs that end in X.

Leading zero

Because the first 8 digits are drawn, some RGs start with zero. A numeric field or integer column strips that zero and changes the number. Store the RG as text.

RG field with the CIN

On the CIN, the general registry number is the CPF. Check that the form accepts 11 digits in that field and does not force the state format with a check digit.

Duplicates and state

Since each state numbers its own RG, the number alone does not guarantee nationwide uniqueness: it comes with the issuing agency and the state. Test two sign-ups with the same number and different states.

Frequently Asked Questions about the RG Generator

Answers about the generated numbers and what this tool actually provides.