The China Resident Identity Card number (居民身份证号码, standard GB 11643-1999) is the primary national identifier for Chinese citizens. This validator checks every structural rule defined in the standard, verifies the ISO 7064 MOD 11-2 check character, and decodes the province, date of birth, and gender that are embedded in the number — all in your browser, with no data uploaded anywhere.
How it works
The 18 characters of a second-generation Resident ID follow a fixed layout:
| Positions | Segment | Meaning |
|---|---|---|
| 1–2 | Province | Two-digit code per GB/T 2260 (e.g. 11 = Beijing) |
| 3–4 | Prefecture | Sub-division of the province |
| 5–6 | County | Sub-division of the prefecture |
| 7–10 | Birth year | Four-digit year YYYY |
| 11–12 | Birth month | Two-digit month MM |
| 13–14 | Birth day | Two-digit day DD |
| 15–17 | Sequence | Unique within area + birth date; 17th digit encodes gender |
| 18 | Check char | ISO 7064 MOD 11-2 value — a digit 0–9 or the letter X |
The validator applies six rules in sequence and marks each as pass or fail:
- Length — exactly 18 characters after stripping spaces and hyphens.
- Character set — positions 1–17 are decimal digits; position 18 is a digit or X.
- Province code — the first two digits match the official GB/T 2260 division registry.
- Birth date — digits 7–14 form a real calendar date (including month-length and leap-year checks) that is not in the future.
- Sequence number — digits 15–17 are not the reserved value
000. - ISO 7064 MOD 11-2 check character — the recomputed check value equals the 18th character.
How the check character is computed
The algorithm multiplies each of the 17 data digits by a fixed weight, sums the products, takes the remainder modulo 11, and maps the result to a character:
weights =
[7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2]sum = d₁×7 + d₂×9 + d₃×10 + … + d₁₇×2
check =
"10X98765432"[sum mod 11]
The lookup string "10X98765432" maps each possible remainder (0–10) to its check
character. Remainder 2 produces X because the value 10 cannot be represented in a
single decimal digit; X is the conventional ISO symbol for that case.
Worked example
The following number is obviously fictitious (sequential area code, round birth date, low sequence) and is provided solely to illustrate the structure:
1 1 0 1 0 1 1 9 9 0 0 3 0 7 0 0 3 8
└─────┬─────┘ └──────┬──────┘ └─┬─┘ └── check char
address birth seq
110101199003070038
- Province
11→ Beijing (北京) - Address code
110101 - Date of birth
19900307→ 7 March 1990 - Sequence
003; gender digit3(odd) → Male (男) - Weighted sum = 158, remainder 158 mod 11 = 4 → check char
"10X98765432"[4]=8✓
You can paste 110101199003070038 directly into the tool above to see the full
step-by-step breakdown. Do not use this number for any real purpose — it is a
structural demonstration only.
Formula note
The weight sequence [7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2] is not
arbitrary: each weight equals 2^(17−i) mod 11 where i is the zero-based position
index. Because 11 is prime the powers of 2 cycle with period 10, which is why the
sequence repeats at positions 10–16. The mapping table "10X98765432" satisfies the
MOD 11-2 property that re-appending the check character to the original number and
running the same algorithm on all 18 digits always yields a fixed value (1 for this
variant), making the algorithm self-checking.