RG generator and validator
Generate valid RGs to use in tests or check whether an RG is valid.
A valid RG is generated when the page opens. Choose the quantity and the format, or click "Generate RG" to create another one.
How it works
- The RG is generated on the server and is not stored anywhere.
- Each state issues the RG its own way, so the generator follows the São Paulo rule, the one most systems use: 8 digits and a check digit.
- The check digit can be an X, which stands for 10.
- The number is for testing only and does not belong to any real person.
- The latest generated values are listed below the button until you leave the page.
How to use the API
You can integrate the RG generator into your app through our REST API.
Endpoint
GET /api/generators/rg
Query parameters
- quantity
- Optional. From 1 to 50. When set, the response has the "rgs" list instead of "rg".
- formatted
- Optional. "false" generates it without punctuation. Default: "true".
curl example
curl "https://devtools.vmotta.dev/api/generators/rg?quantity=2&formatted=false"
Response
{
"rgs": [
"905566610",
"39541250X"
]
}Enter an RG and click "Validate RG" to find out whether it is valid.
How it works
- Validation runs on the server and nothing is stored.
- The validator checks the check digit using the São Paulo rule. RGs from other states may have a different format and show up as invalid.
- The RG can be entered with or without punctuation (12.345.678-X or 12345678X).
- The result shows up right below the field.
How to use the API
You can integrate the RG validator into your app through our REST API.
Endpoint
POST /api/validators/rg
Request body
- rg
- Required. The number, with or without punctuation.
curl example
curl -X POST https://devtools.vmotta.dev/api/validators/rg \
-H "Content-Type: application/json" \
-d '{"rg":"39.541.250-X"}'Example body
{
"rg": "39.541.250-X"
}Response
{
"isValid": true
}