How Brazilian CPF and CNPJ Checksum Algorithms and Format Validation Work

### Why Brazilian Tax ID Validators & Generators Are Essential for Software Developers

Building web applications, e-commerce checkouts, or financial software for the Brazilian market requires rigorous verification of national tax numbers. **CPF (Cadastro de Pessoas Físicas)** is an 11-digit number assigned to individuals for tax and identification purposes, while **CNPJ (Cadastro Nacional da Pessoa Jurídica)** is a 14-digit number assigned to companies and corporate entities. Both documents rely on strict mathematical **Modulus 11 checksum algorithms** to prevent fraudulent or mistyped entries. A Brazil CPF & CNPJ validator and test generator verifies checksum digits and creates valid test numbers instantly. Our browser-based tool processes validations locally in client memory without server uploads.

### How to Validate or Generate Brazilian IDs in 3 Easy Steps
  1. Select Document Type: Choose between CPF (Individual) or CNPJ (Corporate) mode using the top toggle buttons.
  2. Enter or Generate ID: Type an existing ID number to verify its checksum, or click Generate Valid Test ID to produce a fresh, working test number.
  3. Inspect Results: Instantly check whether the checksum digits match mathematical verification standards.
### Checksum Formula + Worked Example

Brazilian tax numbers use weighted multipliers descending from 9 or 10 down to 2, calculating remainders via Modulus 11:

Remainder = Sum(Digit * Weight) % 11  |  Check Digit = Remainder < 2 ? 0 : 11 - Remainder

Worked Example: Validating a 11-digit CPF string multiplies the first 9 digits by descending weights (10 down to 2), summing products to calculate the 10th and 11th verification check digits.

Brazilian Tax ID Standards, Formats & Rules (16 Rules)

Use this reference table to understand CPF and CNPJ structures, digit lengths, and formatting masks.

Document Type Total Digits Standard Formatting Mask
CPF (Individual Tax ID) 11 Digits 000.000.000-00
CNPJ (Corporate Tax ID) 14 Digits 00.000.000/0000-00
Modulus Base Modulus 11 Mathematical verification standard for Brazilian registry numbers
Client-Side Processing JavaScript Execution Zero Server Latency — 100% browser validation & generation
Browser Compatibility 100% Universal Runs smoothly on desktop & mobile web browsers
Data Privacy 100% Client-Side Memory Zero Server Upload — Private tax data stays secure

Need JSON validators, password generators, or word counters? Explore our companion tools:

Frequently Asked Questions

CPF is an 11-digit individual taxpayer registry number, while CNPJ is a 14-digit corporate taxpayer registry number assigned to businesses and organizations.
Modulus 11 algorithm! CPF validation multiplies the first 9 digits by descending weights from 10 down to 2, calculating remainders to verify the two trailing check digits.
Never. All validations and test generations run 100% locally inside your web browser using JavaScript. Your confidential data never leaves your computer.
Yes! This utility is 100% free with no registration or download requirements.