Skip to main content

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):

PositionFieldLengthMeaning & RuleExample
1Identifier Category1 digit1 or 2 for Permanent registration; 7, 8 or 9 for Temporary registry1
2 to 14User Registry13 digitsUnique health record sequence assigned by DATASUS2345678901234
15Check Digit1 digitChecksum digit satisfying Modulo 11 weighted balance5

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. 1. Verify that first digit belongs to {1, 2, 7, 8, 9}.
  2. 2. Multiply each digit by descending positional weights from 15 to 1.
  3. 3. Compute total sum across all 15 products.
  4. 4. Evaluate remainder modulo 11.
  5. 5. The number is valid if and only if remainder equals 0.

Frequently Asked Questions (FAQ)