Skip to main content
Skip to main content

CNS Validator

Validate CNS (National Health Card) numbers quickly and securely. Test.

About the CNS Validator

The CNS Validator checks if a National Health Card number is mathematically valid. The CNS has 15 digits and can be definitive (starts with 1, 2, 7, 8, or 9) or provisional (starts with 3, 4, 5, or 6).

Each type uses a different algorithm: the definitive uses the Luhn algorithm, while the provisional uses weighted sum. Our tool automatically identifies the type and applies the correct validation.

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)