# validation.nhs-number Checks the modulus 11 check digit of an NHS number (England, Wales and the Isle of Man) and returns it as ten plain digits and in the 3-3-4 form the NHS displays it in. A PASS IS NOT A PATIENT. The check digit catches a mistyped digit and most transpositions. Whether the number was issued, and to whom, is a Personal Demographics Service question. ## The check (NHS Data Dictionary, NHS NUMBER) Multiply the first nine digits by 10, 9, 8, 7, 6, 5, 4, 3 and 2 and add them up. Take the remainder on dividing by 11 and subtract it from 11. A result of 11 means a check digit of 0. A result of 10 means the number is invalid, and no tenth digit can rescue it: an implementation that folds 10 into 0 would wrongly accept "4000000080". Otherwise the result must equal the tenth digit. ## Beyond the Data Dictionary Numbers made of one repeated digit are refused as `placeholder`, even though 0000000000 and 1111111111 satisfy the arithmetic, because they are what people type to get past a mandatory field. This is the one rule here that the Data Dictionary does not state. Nothing else is refused by range. Scotland's CHI numbers and Northern Ireland's Health and Care numbers use the same ten-digit modulus 11 scheme, so they pass too; if you need England and Wales numbers only, check the issuing range yourself. Test numbers in the 999 range pass as well. ## Input and result ASCII spaces and hyphens are ignored anywhere. Any other character is `bad-character`. Validators answer rather than throw. | reason | meaning (checked in this order) | |---|---| | `empty` | nothing but separators, or not a string | | `bad-character` | a character other than a digit, space or hyphen | | `bad-length` | not ten digits | | `bad-check-digit` | the modulus 11 check fails, including the "10" case | | `placeholder` | all ten digits the same | ## Source NHS England, NHS Data Model and Dictionary, attribute "NHS NUMBER" (page published 15 July 2026, read 22 September 2026): https://www.datadictionary.nhs.uk/attributes/nhs_number.html