Zero Signup ToolsFree browser tools

Developer Tools

CPF and CNPJ Validator

Validate Brazilian CPF and CNPJ numbers by their mod-11 check digits and generate checksum-valid test numbers. Single and batch modes, no signup, no upload.

Document type

Dots, slashes, and dashes are ignored, so you can paste a formatted or raw number. Validation runs locally on your device; the number you paste never leaves your browser.

Sample numbers (click to load in single mode)

Result

Valid CPF

Type

CPF

Formatted

529.982.247-25

Masked

***.***.***-25

Digits

52998224725

Digit count

11

Check digits in number

25

Expected check digits

25

How the check works

  1. 1. Strip every non-digit character. A CPF should leave 11 digits and a CNPJ should leave 14 digits.
  2. 2. Take all but the last two digits as the base. Multiply each base digit by its mod-11 weight, sum the products, and take the remainder mod 11. A remainder below 2 means the check digit is 0, otherwise it is 11 minus the remainder.
  3. 3. Append the first check digit to the base and repeat with the second weight sequence to get the second check digit.
  4. 4. Compare the two computed digits against the last two digits of the number. They must match, and numbers made of a single repeated digit are always rejected.

A passing checksum proves the number is well-formed. It does not prove the person or company exists or is active with the Receita Federal. Always confirm a real registration through official channels.

How to use

  1. Choose Validate or Generate test numbers at the top.
  2. To validate, paste a CPF or CNPJ (formatted or just digits). Leave the type on Auto detect or pick CPF or CNPJ to force it.
  3. Read the verdict, the expected versus actual check digits, and the per-check pass or fail list.
  4. Switch to Batch list to check many numbers at once and copy only the valid ones.
  5. To generate, pick CPF or CNPJ, choose formatted or digits-only output, set how many, and click Generate, then copy the results.

About this tool

CPF and CNPJ Validator and Generator checks Brazilian taxpayer registry numbers and creates valid test numbers, entirely in your browser with nothing uploaded. CPF (Cadastro de Pessoas Fisicas) is the 11-digit number for individuals, printed as 000.000.000-00, and CNPJ (Cadastro Nacional da Pessoa Juridica) is the 14-digit number for companies, printed as 00.000.000/0000-00. Both end in two check digits computed with a mod-11 weighted sum, so a number can be verified offline without contacting the Receita Federal. Paste a formatted or raw number and the tool strips the dots, slashes, and dashes, detects whether it is a CPF or CNPJ from its length (or you can force a type), recomputes both check digits, and tells you exactly which check passed or failed: digit count, the check digits in the number versus the expected ones, and a rejection for repeated-digit values like 111.111.111-11 that would otherwise pass the raw math. A batch mode validates a whole list at once and lets you copy only the valid numbers, which is handy for cleaning a spreadsheet column of customer or supplier IDs. The generator builds random CPF or CNPJ numbers with correct check digits in formatted or digits-only form, useful for filling out forms in a staging environment, seeding a sandbox database, and writing automated tests for validation logic. A passing checksum proves the number is well-formed; it does not prove the person or company exists or is active, and generated numbers are placeholders only and must never be used to impersonate anyone or commit fraud. Everything runs locally, so the numbers you check or create never leave your device.

Free to use. Works in your browser. No signup, no login.

Related tools

You may also like

All tools
All toolsDeveloper Tools