Hong Kong HKID Validator
Validate Hong Kong Identity Card (HKID) numbers using official Modulo 11 check digit algorithm.
About Hong Kong Identity Card (HKID)
The HKID is the mandatory official identity card issued to residents of Hong Kong aged 11 and above.
It is widely used for e-Channel border clearance, public services, medical care, and banking.
Anatomy & Structure of Hong Kong HKID
Formatted as L(NNNNNN)C or LL(NNNNNN)C:
| Position | Field | Length | Meaning & Rule | Example |
|---|---|---|---|---|
| 1 (or 1 and 2) | Prefix | 1 or 2 letters | Letters (A-Z) representing issuance category or date era | A |
| 2 to 7 (or 3 to 8) | Serial Number | 6 digits | Sequential number allocated by the Immigration Department | 123456 |
| Final character | Check Character | 1 char | Modulo 11 check character (0-9 or letter "A" for value 10) | 3 |
Official Checksum Algorithm (Weighted Modulo 11)
Official formula defined by Hong Kong Immigration Department:
S = (c1 * 9) + (c2 * 8) + (d1 * 7) + (d2 * 6) + (d3 * 5) + (d4 * 4) + (d5 * 3) + (d6 * 2); Remainder = S mod 11; Check = (11 - Remainder) mod 11.
- 1. For single-letter prefixes, the first slot is an implicit space (value 36) multiplied by weight 9.
- 2. Letters A-Z map to values 10 through 35.
- 3. Multiply characters by descending weights [9, 8, 7, 6, 5, 4, 3, 2].
- 4. Sum the products and find remainder modulo 11.
- 5. Check character is (11 - Remainder) mod 11. If 10, it is represented as letter "A".