@box4dev/validador-br
The Complete Library for Validating Brazilian Documents. Ideal for QA.
Install the NPM package @box4dev/validador-br and validate CPF, CNPJ, CNH, PIS, CNS, Voter ID, Certificate, State Registration and more, with 100% tested algorithms.
Why use @box4dev/validador-br?
Native TypeScript
Written in TypeScript with full type support, providing autocomplete and real-time checking.
Complete Coverage
Validates CPF, CNPJ, Alphanumeric CNPJ, CNH, CNS, PIS, Voter ID, Certificate, State Registration and Credit Card.
High Performance
Algorithms optimized for fast execution on server or browser, with 100% test coverage.
Open Source
Native support for ESM, CommonJS and UMD. Developed and maintained by the community. Contribute on GitHub.
What does @box4dev/validador-br validate?
Personal Documents
- ✓CPF
- ✓CNH
- ✓CNS (National Health Card)
- ✓PIS/PASEP
- ✓Voter ID
- ✓Certificate (Birth, Marriage, Death)
Company Documents
- ✓CNPJ (Numeric)
- ✓Alphanumeric CNPJ (new standard)
- ✓State Registration (27 states)
Financial
- ✓Boleto
- ✓Credit Card (Luhn Algorithm)
Frequently Asked Questions
Does the package have production dependencies?
No. @box4dev/validador-br is completely independent, with no external dependencies.
Are the functions synchronous?
Yes. All validation functions are synchronous and return true or false directly.
Where can I find the complete documentation?
The complete documentation is available on this site, in the @box4dev/validador-br Documentation section.
What are the ways to use the API?
The package offers two APIs: named exports (isValidCpf, isValidCnpj, etc.) recommended for tree-shaking, and the centralized object validate.cpf(), validate.cnpj(), etc.