CNS Generator
Generate valid National Health Card numbers. Excellent for your tests.
Waiting for generation...
About the CNS Generator by Type
The Box4Dev National Health Card (CNS) Generator creates valid identification numbers for the SUS, with the option to specify the type: Beneficiary (starting with 1 or 2) or Professional (provisional, starting with 7, 8, or 9). Each generated number strictly follows the DATASUS validation algorithms.
This tool is indispensable for QA and development teams in the healthcare area, allowing testing of patient and professional registrations, electronic medical record systems, and other applications.
Anatomy & Structure of Brazilian National Health Card (CNS)
The CNS comprises 15 decimal digits organized into 4 blocks (NNN NNNN NNNN NNNN):
| Position | Field | Length | Meaning & Rule | Example |
|---|---|---|---|---|
| 1 | Identifier Category | 1 digit | 1 or 2 for Permanent registration; 7, 8 or 9 for Temporary registry | 1 |
| 2 to 14 | User Registry | 13 digits | Unique health record sequence assigned by DATASUS | 2345678901234 |
| 15 | Check Digit | 1 digit | Checksum digit satisfying Modulo 11 weighted balance | 5 |
National Health Card Checksum Algorithm (DATASUS Modulo 11)
A 15-digit CNS number must satisfy the linear Modulo 11 equation:
Sum(d[i] * (15 - i)) % 11 == 0; d[0] ∈ {1, 2, 7, 8, 9}
- 1. Verify that first digit belongs to {1, 2, 7, 8, 9}.
- 2. Multiply each digit by descending positional weights from 15 to 1.
- 3. Compute total sum across all 15 products.
- 4. Evaluate remainder modulo 11.
- 5. The number is valid if and only if remainder equals 0.