--- id: brazilnum version: "0.10.0" license: MIT license_treatment: permissive maintenance: active --- # brazilnum — Validate Brazilian CNPJ, CEI, CPF, PIS/PASEP, CEP, and municipal numbers License: permissive · Maintenance: active · Downloads: 337.6K/mo ## What it is and what it does Brazilnum is a validation and formatting library for Brazilian identification numbers used by individuals, businesses, and government systems. It handles CNPJ (corporate tax ID), CEI (business registration), CPF (individual tax ID), PIS/PASEP (social security), CEP (postal codes), and IBGE municipal codes. The library accepts both formatted strings and raw numeric input, auto-corrects missing leading zeros in integers, and treats missing values (None, NaN) as invalid rather than raising errors—useful for data pipelines with incomplete records. Beyond validation, it provides formatting functions to display identifiers in standard Brazilian notation, parsing functions to extract components (firm ID, establishment number, check digits), and utilities to clean formatting. It recently added support for alphanumeric CNPJ format introduced in 2026. The package has no external dependencies and supports Python 3.9 through 3.14, making it lightweight for integration into larger systems. Use it for: - Validate customer CNPJ or CPF during account registration or payment processing. - Parse CNPJ to extract firm and establishment identifiers for business lookup. - Format and clean Brazilian ID numbers from data imports or user input. - Validate CEP postal codes when processing Brazilian shipping addresses. - Batch-validate municipal codes from government or census data sources. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Validates and formats Brazilian identification numbers including CNPJ, CEI, CPF, PIS/PASEP, CEP, and municipal codes, with support for both numeric and alphanumeric formats. Yes. The package is actively maintained, has zero known vulnerabilities, imposes no dependency overhead, and solves a specific domain problem well. Install it if you work with Brazilian identification numbers in production systems or data pipelines. ## Install pip install brazilnum uv add brazilnum poetry add brazilnum ## Installing brazilnum Before you install: Low install friction with no runtime dependencies. Active maintenance: last release 21 days ago, repository shows ongoing development with 99 stars. License in practice: MIT license permits commercial and private use with minimal restrictions; suitable for most projects. Quickstart: pip install brazilnum from brazilnum.cnpj import validate_cnpj from brazilnum.cpf import validate_cpf validate_cnpj('02.558.157/0001-62') # True validate_cpf('968.811.342-58') # True Requires Python 3.9 or newer. Verify before relying: - Whether alphanumeric CNPJ support (added in version 0.9.0) is production-ready or still experimental. - Performance characteristics when validating large batches of identifiers. ## Package facts - License: MIT (permissive) - Python support: supports_current - Install friction: low - Maintenance: active - Downloads: 337.6K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags brazilian identification validation, cnpj cpf validation, brazil tax id checker, brazilian postal code parser, validate brazilian numbers, brazil-specific, data-validation [View on SkillFed](https://skillfed.io/packages/brazilnum) · [View on PyPI](https://pypi.org/project/brazilnum/)