Skip to content

pt_BR: support new alphanumeric CNPJ format (Serpro, effective July 2026) #2401

Description

@moohbr

The pt_BR provider's cnpj() and company_id() still generate the old numeric-only CNPJ. Brazil's new alphanumeric CNPJ format is not supported. The first 12 characters can now be alphanumeric (0-9, A-Z); only the 2 check digits remain numeric.

Steps to reproduce

  1. from faker import Faker
  2. fake = Faker("pt_BR")
  3. fake.cnpj()

Expected behavior

cnpj() should be able to produce alphanumeric CNPJs following the official Serpro algorithm, e.g. 12.ABC.345/01DE-35. Check digits still computed via mod-11 over each character's value (ASCII - 48).

Reference: "Cálculo dos dígitos verificadores de CNPJ alfanumérico"

Actual behavior

cnpj() only ever returns numeric values, e.g. 12.345.678/0001-95. There is no way to generate the new alphanumeric format.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions