How to Generate a Test Medicare Number for Software Testing
Any Australian health, insurance, or government-adjacent app eventually has a Medicare number field, and the moment you try to test it you hit the obvious problem: you shouldn't be typing a real person's Medicare card number into a staging database. A Medicare number is sensitive health-related identity data. What you want for testing is a number that passes the card's built-in check but belongs to nobody.
The Medicare number has a check digit
A Medicare card number is 10 digits as printed (often shown as a 9-digit base plus a checksum, with an extra individual reference number for each person on the card). The first digit is between 2 and 6. The validity test is a weighted checksum on the first 8 digits:
- Multiply the first 8 digits by the weights
1, 3, 7, 9, 1, 3, 7, 9. - Sum the products.
- The 9th digit is the check digit — it equals that sum mod 10.
So the 9th digit isn't free; it's determined by the eight before it. A number where the 9th digit doesn't match the computed remainder is invalid, which is exactly what your validation should be catching.
Why a random 10-digit number fails
Pick ten random digits and the odds the 9th happens to equal the checksum of the first eight are one in ten. Worse, if the first digit isn't in the 2–6 range, it's invalid before you even reach the checksum. A generator sidesteps both: it chooses a valid leading digit, fills the base digits, then computes the check digit so the number passes by construction.
Test data, not a real card
A generated Medicare number is for software testing — form validation, QA fixtures, demos, seeding a dev database. It is not a real, issued card number, and it carries no entitlement. Using a fabricated Medicare number to claim a benefit, access a service, or misrepresent identity is unlawful. The generator exists so you never have to put a real card number at risk in a non-production environment.
The individual reference number
Real Medicare cards list each family member with a 1-digit reference number next to their name. If your form captures that too, remember it's a separate single digit (typically 1–9) and isn't part of the card-number checksum — so generate it independently rather than trying to fold it into the 10-digit value.
Try it
The Australian Medicare Number Generator & Validator generates valid-format test Medicare numbers and validates any number against the official check-digit algorithm, entirely in your browser with nothing sent to a server. For the other Australian identifiers, there's the TFN generator and the ABN generator.
Hanuman Singh · built snaptxt.app · hanumansingh.dev