./prontouso.com
DEVELOPER TOOLS

CPF / CNPJ Generator & Validator

Generate valid CPF and CNPJ numbers with or without mask, select issuing state or branch type, generate batches up to 50 documents, and validate existing numbers with step-by-step audit.

Tool statusReady to use in your browser
Available
prontouso://dev/documentos-brCLIENT-SIDE COMPUTED

Configuration

Choose type and generate a sample or batch.

INPUT
Document type
11 digits · two check digits.
Format
Quantity
Validade matemática ≠ documento real. Mathematical validity ≠ real document. Generation satisfies only checksum algorithms.

Result

Consistent CPF for testing.

CPF
GENERATED DATANOT CHECKED IN REAL REGISTRIES
170.274.078-17
MASKEDRANDOM REGIONMODULO 11

Alphanumeric CNPJ

The first 12 positions can combine A–Z and 0–9; the final 2 verification digits remain numeric.

What is validated?

Structure, allowed characters, repeated trivial sequences, and Modulo 11 verification digits.

What is not validated?

Existence, ownership, tax standing, or any real government records.

How it works

  1. Enter your input

    Fill in the values, paste your text, or upload the file this tool works with.

  2. See results instantly

    Most tools update live as you type; a few use a single button. Either way, the result appears right on this page.

  3. Use your results

    Copy, download, or share what the tool produces — you're always in control of the output.

100% Private & SecureRuns locally in your browser. This tool does not upload your input.

What is CPF / CNPJ Generator & Validator?

A CPF, CNPJ, and alphanumeric CNPJ generator and validator for software testing. Generate valid numbers with or without a mask, choose a fiscal region or branch type, generate batches of up to 50 documents, and validate any document with a full mathematical audit trail.

ENTENDA A FERRAMENTA

How to generate and validate CPF, CNPJ, and the new alphanumeric CNPJ

Generate mathematically valid CPF and CNPJ numbers for testing — including the new alphanumeric CNPJ format —, or validate any existing document with a full step-by-step Modulo 11 breakdown.

The Modulo 11 algorithm, step by step

CPF and CNPJ both use two check digits computed the same way: every position in the document is multiplied by a weight, the products are summed, and the remainder of dividing by 11 gives the expected digit. The Validation tab shows every weight, every product, and the final sum, so you can manually spot exactly where a mistyped document diverges from what's expected.

CPF — weights
weight = position + 1 (counted from the end backward)
CNPJ — weights
weight = (position % 8) + 2, cyclic

The new alphanumeric CNPJ

Since Receita Federal's update, a CNPJ can contain letters as well as digits in its first 12 characters (the two check digits stay numeric). Each letter is turned into a numeric value by the official rule — its ASCII code minus 48 — before entering the same weighted-sum formula used for a traditional CNPJ. Pick 'Alphanumeric CNPJ' in the generator to create examples already in the new format.

The letter 'A''s value in the formula

'A' has ASCII code 65, so its numeric value in the sum is 65 − 48 = 17.

charCode('A') - 48 = 17

The CPF's fiscal region and the CNPJ's branch type

In a CPF, the 9th digit indicates the fiscal region where the document was issued — for example, 8 for São Paulo or 0 for Rio Grande do Sul. Choosing a region in the generator creates documents consistent with that criterion, useful for testing rules that depend on a CPF's origin.

In a CNPJ, digits 9 through 12 indicate the establishment's sequence number: 0001 for headquarters, and following numbers for branches. The generator lets you fix it to headquarters, a branch (a random number other than 0001), or leave it random between the two.

Batch generation for automated testing

Generate up to 50 documents at once, all mathematically valid, and copy the list or download it as a .txt file — useful for populating test spreadsheets, QA data sets, or automated test fixtures without typing each document by hand.

Why documents with all-identical digits are invalid

Sequences like 111.111.111-11 or 00.000.000/0000-00 could even produce mathematically consistent check digits in some cases, but Receita Federal's official rules explicitly invalidate any document with every digit repeated, as an extra safeguard against obvious fraud. The validator rejects these patterns even when the check-digit math works out.

Calculated locally, no real data involved

Every generation and validation runs in your browser via JavaScript — no typed or generated document is sent to a server. Generated documents are mathematically valid but fictitious: they don't belong to any real person or company and aren't checked against any database.

Frequently Asked Questions

What is the alphanumeric CNPJ, and when did it start existing?

It's the new CNPJ format defined by Receita Federal, which allows letters in the first 12 positions (the 2 check digits stay numeric). This tool already generates and validates documents in that new format, alongside the traditional numbers-only CNPJ.

Do the generated documents belong to real people or companies?

No. They're created algorithmically in your browser purely to satisfy the mathematical validation rule — the tool doesn't query or store any real registry.

Why is 111.111.111-11 invalid even though the digits look consistent?

Receita Federal's official rules explicitly invalidate any CPF or CNPJ with every digit identical, regardless of what the Modulo 11 math would otherwise produce, as an extra safeguard against obvious fraud.

How does a letter in an alphanumeric CNPJ enter the check-digit calculation?

Each character (digit or letter) is converted to a value using its ASCII code minus 48 — for example, '0' is worth 0 and 'A' is worth 17 — and that value enters the same weighted sum used to calculate a traditional CNPJ's check digits.

Can I generate CPFs from a specific fiscal region?

Yes — choose the state or state group in the region selector before generating. The resulting CPF's 9th digit will reflect the region you chose.

Can I use these documents in real registrations or production systems?

No. Use them only for software testing and development in controlled environments — using fictitious data to pass as a real document in commercial registrations or official systems can violate terms of use and applicable law.