Complete Guide to Brazilian Identification Documents
Brazil has a complex system of identification documents, each with a distinct structure and purpose. This guide presents the main documents, how they are structured, and why their validation algorithms matter for developers.
CPF — Individual Taxpayer Registry
The CPF is Brazil's main tax identification number for individuals, managed by the Receita Federal. Created in 1965, the CPF has gone through several reforms and today is practically indispensable for any economic and social activity in the country — from opening a bank account to applying for an internship. The format is NNN.NNN.NNN-DV, with 11 total digits.
For developers, CPF is present in virtually all systems that serve individuals in Brazil: e-commerce, banking, HR, healthcare, education, government. CPF validation must be implemented both in the frontend (for immediate user feedback) and in the backend (to ensure data integrity). The algorithm uses modulus 11 with two check digits.
CNPJ — National Corporate Taxpayer Registry
The CNPJ identifies companies and other legal entities in Brazil. It has 14 digits in the format XX.XXX.XXX/XXXX-DV, where the first 8 identify the company (root), the next 4 identify the branch or establishment (0001 for headquarters), and the last 2 are check digits. The same company can have multiple CNPJs — one for each branch.
As of July 2026, the CNPJ becomes alphanumeric: the first 12 characters (excluding check digits) may include uppercase letters, significantly increasing the available number space. Developers working with CNPJ need to be aware of this change and adapt format validations — the check digit calculation algorithm remains the same.
RG and CNH — Identity and Driver's License
The RG (General Registry) is Brazil's most traditional identity document, issued by the states. Because it is state-issued, there is no single national format — each state has its own length and digit rules. São Paulo uses 9 digits with a verifier, Rio de Janeiro uses 7 digits, other states have different formats. This makes RG validation particularly challenging in national systems, which often accept any alphanumeric sequence within a reasonable range.
The CNH (National Driver's License) has 11 digits and is valid throughout Brazil. It has a single check digit calculated by a DENATRAN-specific algorithm. CNH is required in car rental systems, insurance, traffic fine systems, and any platform that needs to verify driving authorization.
RENAVAM, PIS/PASEP, and Voter Title
The RENAVAM (National Motor Vehicle Registry) identifies vehicles with 9 or 11 digits and a modulus 11 algorithm. It is essential in vehicle insurance, traffic fine, IPVA, and any fleet management application. PIS/PASEP identifies workers in the social security system: PIS for private employees and PASEP for public servants, both with 11 digits and a modulus 11 algorithm.
The Voter Title has 13 digits and includes the state of origin code (digits 9 and 10), making it interesting for applications that need to segment by state. The TSE uses a modulus 11 algorithm with two check digits calculated with different weights. Electoral systems, voter status verification, and party registration systems need to validate the Voter Title.
How developers use these documents
In Brazilian software development practice, each document type appears in specific contexts: CPF is ubiquitous in all B2C systems. CNPJ is fundamental in B2B systems, invoices, and Receita Federal integrations. CNH appears in car rentals, insurance, and mobility applications. RENAVAM is central in fleet management, insurance, and automotive services. Voter Title and AIH have more specialized uses in government and healthcare systems.
Help4Dev offers generators and validators for all these documents, allowing you to develop and test systems that use them without needing real data. Each tool implements the document's official algorithm, ensuring that the data generated passes any validation system that follows the correct rules.