RG-SP Format Validator
Validate the format of a São Paulo RG ID (8-9 digits plus check digit, including X). Useful for checking documents in forms and sign-ups.
São Paulo RG: the one state RG with a documented mod-11 check digit
The RG issued in São Paulo comes from the IIRGD (Instituto de Identificação Ricardo Gumbleton Daunt), the SSP-SP identification institute. Its layout is 8 base digits plus a verifying digit, written NN.NNN.NNN-D. SP is notable because, unlike most states, it uses a well-documented mod-11 check digit — and that digit can be the letter X when its value is 10. This tool validates the SP format/mask; the algorithm below is what a full validator would additionally compute.
The SP mod-11 algorithm
- Weights: multiply the 8 digits by
2,3,4,5,6,7,8,9(left to right). - Sum & mod 11: add the products, take the remainder modulo 11.
- Check digit:
(11 − remainder) mod 11; a result of 10 is written X, and 11 becomes 0. - Example: this is why SP RGs legitimately end in
Xwhile a CPF never does.
Where it shows up
- Onboarding & KYC: SP-issued IDs in banking, telecom and HR forms.
- Public services: Poupatempo, Detran-SP and state systems key off the RG.
- Document pairing: official records cite it as
RG 12.345.678-9 SSP/SP. - Mock data / testing: generating mask-valid SP RGs for form QA and synthetic fixtures.
Gotchas
- Format vs full check: this page validates the mask; the mod-11 digit is the extra layer for a strict SP validator.
- The X is real, uppercase, last: never strip it as if it were noise — it carries the value 10.
- Not portable to other states: the SP algorithm does not validate an RG issued by RJ, MG, etc.
- Migrating to CIN: new São Paulo identity cards are CPF-keyed under the national CIN; the legacy RG number stays valid.
FAQ
Why can an SP RG end in X? Its mod-11 check digit can equal 10, which is written as the Roman numeral X to fit one character — exactly like ISBN-10.
Is the SP check digit the same as the CPF's? No. The CPF uses two mod-11 digits with different weights; the SP RG uses a single mod-11 digit over 8 digits.
Does this validator compute the check digit? It checks the SP mask. Use the algorithm above if you need to also verify the mod-11 digit.
Related Tools
Date Format Validator (ISO/Common)
Check if a date is in ISO 8601 or common formats (YYYY-MM-DD, DD/MM/YYYY, MM/DD/YYYY). Auto-detects format.
US TIN Format Validator
Validate the format of a US TIN, either an SSN (individuals) or EIN (businesses). Check American tax identification numbers in your records.
Canada SIN Format Validator
Validate the format of a Canadian SIN (Social Insurance Number) in the 3-3-3 digit pattern. Useful for forms, sign-ups and data validation in Canada.
MAC Address Validator
Validate MAC addresses in colon (xx:xx:xx:xx:xx:xx), hyphen, Cisco (xxxx.xxxx.xxxx) or no-separator formats. Identifies unicast/multicast and local/universal. Everything in your browser.
Bank Branch Validator
Validate the format of a Brazilian bank branch number (4 digits, with an optional check digit). Useful for sign-ups, bank slips and checking banking data.
RG-RJ Format Validator
Validate the format of a Rio de Janeiro RG ID (8 digits plus check digit). Useful for checking documents in forms and sign-ups.