Testing an NHS form often needs an identifier with the right shape. Using a real patient’s NHS number outside an appropriate clinical system is not an acceptable shortcut.
The Invalid NHS Number Generator creates ten-digit values which look plausible but are guaranteed to fail the official checksum.
Validity lives in the tenth digit
An NHS number contains nine source digits followed by a check digit. Each source digit is multiplied by a descending weight from 10 to 2. The sum is divided by 11, and the remainder determines the required final digit.
The generator creates a random nine-digit prefix and performs that calculation. Once it knows the correct check digit, it deliberately appends a different one. If a prefix produces the forbidden check value of 10, any appended digit will already be invalid.
The generated number is not merely unlikely to be real. The checksum makes sure it cannot pass validation.
Explain the failure
The interface shows the number in a familiar 000 000 0000 format and explains which check digit should have been present.
That explanation makes the tool more useful during QA. A tester can see why the value is safe, while a developer can verify that an error state is caused by checksum validation rather than formatting.
It also avoids a common test-data weakness: a realistic-looking value that nobody can confidently trace or classify.
Small tools can carry serious safeguards
The entire project is a single HTML file. There is no account, database or server. Generation happens in the browser and nothing is transmitted.
That simplicity is part of the safety model. There is no store of generated identifiers, no external dependency at runtime and very little surface area to maintain.
The project is intentionally narrow. It solves one awkward task and states exactly what guarantee it provides. For healthcare tooling, that can be more valuable than adding another layer of features.