pt_BR: support new alphanumeric CNPJ format (Serpro, effective July 2026)
Author: moohbrCreated Jun 29, 2026Updated Jun 29, 2026
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
from faker import Fakerfake = Faker("pt_BR")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.
Source: joke2k/faker