Skip to main content

NHS Number Validator

Validate UK National Health Service numbers. Excellent for your tests.

How NHS validation works

The validator checks if the input is exactly 10 digits. It calculates the weighted sum of the first 9 digits using weights from 10 to 2.

If the division remainder indicates a check digit of 10, the number is rejected as invalid. A remainder of 11 maps to check digit 0, and other values must match the 10th digit.

Anatomy & Structure of NHS Number (10 Digits)

The National Health Service patient identifier consists of 10 numeric digits:

PositionFieldLengthMeaning & RuleExample
1 to 9Patient Identifier9 digitsUnique sequential patient index in NHS England and Wales943476591
10Check Digit1 digitModulo 11 checksum digit (numbers resulting in 10 are discarded)9

NHS Number Validation Algorithm (Modulo 11)

The official NHS formula weights the first 9 digits from 10 down to 2:

CheckDigit = 11 - (sum(d_i * (11 - i)) % 11)
  1. 1. Multiply each of the first 9 digits by weights: [10, 9, 8, 7, 6, 5, 4, 3, 2].
  2. 2. Compute the total sum of all products.
  3. 3. Compute remainder: Remainder = Sum % 11.
  4. 4. Compute check digit: CheckDigit = 11 - Remainder.
  5. 5. If CheckDigit == 11, final check digit is 0.
  6. 6. If CheckDigit == 10, the NHS number is INVALID by regulation and rejected.

Frequently Asked Questions