esc
Brazil tools

CNPJ generator:
numeric and alphanumeric

Generate valid CNPJ numbers, numeric or alphanumeric, to test systems.

How to use CNPJ generator

  1. 01Choose the formatNumeric or alphanumeric.
  2. 02GenerateValid test numbers.
  3. 03CopyOne or all of them.
Front and back of an ID card on one sheet of paper

Ready for the alphanumeric CNPJ.

Each number has a random root, branch 0001 and check digits worked out with module 11. Switch on Alphanumeric to test systems for the CNPJs with letters issued since July 2026.

A CNPJ identifies a company in Brazil: an 8-character root, a 4-digit branch number (0001 for the head office) and two check digits. This generator makes random CNPJs with valid check digits for testing software, in the classic numeric format or the alphanumeric format the Receita Federal began issuing in July 2026.

The alphanumeric CNPJ

Normative Instruction RFB 2.229/2024 allows letters in the first 12 characters of new CNPJs from July 2026. Existing numeric CNPJs keep working. Systems that store CNPJs as numbers, or check them with digits-only code, need updating, and test numbers with letters help find those places.

Switch on Alphanumeric to get numbers such as AB.12C.D34/0001-XX, where the root can contain letters A to Z. The check digits are still two digits.

How the check digits are calculated

  1. Turn each of the first 12 characters into a value: its ASCII code minus 48. Digits keep their value, and A becomes 17, B 18, up to Z at 42.
  2. Multiply the values by 5, 4, 3, 2, 9, 8, 7, 6, 5, 4, 3, 2 and add them. A remainder of 0 or 1 after dividing by 11 gives 0; otherwise the digit is 11 minus the remainder.
  3. Repeat over 13 characters with the weights 6, 5, 4, 3, 2, 9, 8, 7, 6, 5, 4, 3, 2 for the second check digit.

Use them only for testing

A random CNPJ may match a real company by chance. Use generated numbers only in test environments, never on real invoices, contracts or registrations.

At a glance

Price
Free. No sign-up, no watermark.
Privacy
Your text stays in your browser. Nothing is uploaded.
Works in
Chrome, Edge, Firefox and Safari, on phones and computers

Questions

Are these real companies?

They are random numbers with valid check digits. One may match a real company by chance, so use them only for testing.

How are letters counted in the check digits?

Each character counts as its ASCII code minus 48, so 0–9 stay 0–9 and A is 17, B is 18 and so on. The weights and module 11 are the same as before.

Is anything sent to a server?

No. Numbers are generated in your browser.

Why is the branch always 0001?

0001 is the head office, the most common case. You can change the branch digits by hand, but then the check digits must be recalculated: paste the new number into the Validate tab to see them.

Does the alphanumeric format replace numeric CNPJs?

No. Existing CNPJs stay as they are. Only new registrations can receive letters.

Can I validate a CNPJ here too?

Yes. Open the Validate tab, or use our CNPJ validator page.