User Rating 0.0 β˜…β˜…β˜…β˜…β˜…
Total Usage 0 times
1 – 100 CNPJs per batch
Establishment identifier
    Is this tool helpful?

    Your feedback helps us improve.

    β˜… β˜… β˜… β˜… β˜…

    About

    A CNPJ (Cadastro Nacional da Pessoa JurΓ­dica) is a 14-digit identifier assigned by Brazil's Receita Federal to every registered legal entity. The first 8 digits form the company base registration, digits 9 through 12 encode the branch number (where 0001 denotes headquarters), and the final 2 digits are check digits computed via a weighted mod-11 algorithm. Using fabricated or structurally invalid CNPJs in development environments causes silent failures in fiscal APIs, payment gateways, and nota fiscal emission systems. This tool generates CNPJs that pass algorithmic validation but correspond to no real entity. They are intended exclusively for software testing, form validation, and database seeding.

    The generator produces numbers that satisfy the exact verification procedure defined by InstruΓ§Γ£o Normativa RFB. Note: generated CNPJs are mathematically valid but fictitious. Using them in official documents or tax filings constitutes fraud under Brazilian law (Lei 8.137/90). For bulk test suites, the tool supports batch generation of up to 100 numbers per run with optional formatting masks.

    cnpj generator cnpj validator brazil tax id cadastro nacional pessoa juridica test data generator brazilian company number

    Formulas

    The CNPJ check digits are computed sequentially. First, the 12-digit base (registration + branch) is multiplied element-wise by a weight vector, summed, and reduced modulo 11.

    S1 = 12βˆ‘i=1 di Γ— w1,i
    r1 = S1 mod 11
    C1 =
    {
    0 if r1 < 211 βˆ’ r1 otherwise

    The second check digit uses the same procedure over 13 digits (base + first check digit) with weight vector w2.

    S2 = 13βˆ‘i=1 di Γ— w2,i
    C2 =
    {
    0 if (S2 mod 11) < 211 βˆ’ (S2 mod 11) otherwise

    Where di is the i-th digit, w1 = [5,4,3,2,9,8,7,6,5,4,3,2], and w2 = [6,5,4,3,2,9,8,7,6,5,4,3,2]. The final CNPJ is the concatenation of base digits, branch digits, C1, and C2.

    Reference Data

    PositionDigitsDescriptionExample
    1-88Company base registration number11222333
    9-124Branch/establishment number (0001 = HQ)0001
    131First check digit (mod-11 with weights 5 - 2,9 - 2)8
    141Second check digit (mod-11 with weights 6 - 2,9 - 2)1
    Weight Sequences for Check Digit Calculation
    1st digit12 weights5, 4, 3, 2, 9, 8, 7, 6, 5, 4, 3, 2Applied to positions 1-12
    2nd digit13 weights6, 5, 4, 3, 2, 9, 8, 7, 6, 5, 4, 3, 2Applied to positions 1-13
    Mod-11 Remainder Rules
    Remainder< 2Check digit = 0remainder 0 or 1 β†’ digit 0
    Remainderβ‰₯ 2Check digit = 11 βˆ’ remainderremainder 4 β†’ digit 7
    Common Formatting Patterns
    Formatted18 charsXX.XXX.XXX/XXXX-XX11.222.333/0001-81
    Unformatted14 charsXXXXXXXXXXXXXX11222333000181
    Known Invalid Sequences (Reject List)
    00000000000000All zerosPasses mod-11 but rejected by Receita FederalMust be excluded
    11111111111111All onesPasses mod-11 but rejected by Receita FederalMust be excluded
    22222222222222All twosSame-digit sequences are invalidMust be excluded
    33333333333333 … 99999999999999All sameAll repeated-digit CNPJs are excludedMust be excluded

    Frequently Asked Questions

    No. The generator creates numbers that are algorithmically valid (they pass the mod-11 check digit verification) but correspond to no real legal entity. They are fictitious identifiers suitable for software testing, form validation, and database seeding. Using them on official documents or tax filings is a criminal offense under Lei 8.137/90.
    All 10 repeated-digit CNPJs (00000000000000 through 99999999999999) technically pass the mod-11 check digit algorithm. However, the Receita Federal explicitly rejects these sequences during validation. Any serious CNPJ validator must blacklist them. The generator follows this rule to produce numbers that pass real-world validation routines, not just the mathematical check.
    Digits 9 through 12 encode the establishment number. The value 0001 indicates the company headquarters (matriz). Branch offices (filiais) receive sequential numbers starting from 0002. The generator defaults to 0001 but supports random branch numbers for testing multi-establishment scenarios.
    The Luhn algorithm uses a fixed doubling pattern and mod-10 reduction. The CNPJ mod-11 algorithm uses variable weight vectors (5,4,3,2,9,8,7,6... cycling) and mod-11 reduction with a special rule: if the remainder is less than 2, the check digit is 0 rather than 11 minus the remainder. This prevents negative check digits and constrains results to the 0-9 range.
    Yes. The tool includes a validation mode. Enter any 14-digit CNPJ (with or without formatting) and the validator recomputes both check digits independently. It reports whether each digit matches, identifies the exact point of failure if invalid, and flags blacklisted repeated-digit sequences.
    No. The dots, slash, and hyphen are purely visual separators. The underlying 14-digit number is identical whether formatted or not. The formatting follows the standard pattern defined by the Receita Federal for printed documents and NFe (Nota Fiscal EletrΓ΄nica) fields.