CPF/CNPJ Formatter
JSON →A utility for formatting Brazilian CPF and CNPJ document numbers. Version 1.0.6 is the latest stable release. It automatically detects the document type based on input length (≤11 digits for CPF, >11 for CNPJ) and applies the standard formatting masks (XXX.XXX.XXX-XX for CPF, XX.XXX.XXX/XXXX-XX for CNPJ). The package removes non-numeric characters and limits input size. It includes TypeScript type definitions and has optional peer dependencies for React Hook Form integration. Unlike validation-focused libraries, it purely handles formatting without validation of check digits.
Resources
packagecpf-cnpj-formatter ↗
API endpoints
full doc /v1/registry/cpf-cnpj-formatter