How to Generate a Test IRD Number for Testing (New Zealand)
If you're building anything that touches New Zealand tax or payroll, you'll need to test an IRD number field — and, as with every government identifier, the right test data is a number that passes Inland Revenue's check without belonging to a real taxpayer. Here's how the IRD number is structured and how to generate valid dummy ones for QA.
The IRD number checksum
An IRD number is 8 or 9 digits. The last digit is a check digit computed from the ones before it using a weighted algorithm, mod 11:
- Take the base digits (the first 8 of a 9-digit number).
- Multiply them by the weights
3, 2, 7, 6, 5, 4, 3, 2. - Sum the products and take the remainder mod 11.
- The check digit is
11 − remainder(with remainder 0 giving check digit 0).
There's one wrinkle: if that calculation produces a check digit of 10, the number is invalid and Inland Revenue applies a secondary set of weights to resolve it — or the candidate is simply rejected. A good generator handles this by discarding any base that lands on the invalid case and trying again.
Why you can't just invent one
Only about one in eleven random numbers satisfies the mod-11 check, so hand-typed "fake" IRD numbers almost always fail validation — which means your test proves nothing. Generating one correctly means fixing the base digits and computing the check digit so the number passes by construction, then skipping the invalid-check-digit cases.
Valid format ≠ registered
A generated IRD number clears the checksum. It is not registered with Inland Revenue and confers nothing. Use it for form validation, QA fixtures, demos, and dev databases — never to file a return, claim anything, or represent yourself to IRD. Format testing and real-world verification are different jobs; keep generated numbers inside your test environment.
Try it
The New Zealand IRD Number Generator & Validator generates valid-format test IRD numbers and validates any number against Inland Revenue's weighted algorithm, all in your browser with nothing sent to a server. For other New Zealand identifiers, see the NZBN generator and the NZ bank account validator.
Hanuman Singh · built snaptxt.app · hanumansingh.dev