Chinese ID Card Number: Checksum, Region and Privacy Rules
A Chinese resident ID number is not a random string. The first six digits are an administrative region code, the next eight are the date of birth, digit 17 encodes gender, and the last digit is a weighted checksum. Here is what each part means and what it cannot tell you.
- An 18-digit Chinese ID splits into four parts: six region digits, eight birth-date digits, three sequence digits and one checksum digit
- The checksum is the sum of the first 17 digits multiplied by fixed weights, reduced modulo 11, and a remainder of 2 maps to the letter X
- Digit 17 encodes gender, odd for male and even for female, while in a 15-digit number that information sits in digit 15
- A passing checksum only proves the number is internally consistent, never that it was issued or belongs to the person presenting it
- The region code reflects where the number was issued, not where the holder lives now, and some historical codes have been retired
- An ID number is sensitive personal information, so it should never be pasted into public channels or written to application logs
#What the 18 digits encode
Every digit in a Chinese resident ID number has a fixed meaning, and an 18-digit number divides into a region code, a birth date, a sequence number and a checksum. The layout is:
| Digits | Length | Meaning |
|---|---|---|
| 1 to 6 | 6 | Region code, the county-level administrative division that issued it |
| 7 to 14 | 8 | Date of birth as YYYYMMDD |
| 15 to 17 | 3 | Sequence number, unique per region and birth date |
| 18 | 1 | Checksum, either 0 to 9 or the letter X |
Paste a number into ID Card Lookup and it parses the birth date, gender, age, zodiac sign, Chinese zodiac animal and region in one pass, validating the number locally as it goes.
Two positions are worth memorising on their own:
- Digit 17 encodes gender — odd numbers are assigned to males, even numbers to females
- Digits 7 to 14 are the birth date, which is why the zodiac sign and the Chinese zodiac animal can be derived without any extra input
The region code reflects where the number was issued, not where the holder lives today. Administrative divisions get merged, renamed and promoted over time, so codes embedded in older numbers may no longer appear in the current division table. The parser then maps them to the historical region the code stood for.
#How the checksum digit is calculated
The checksum takes two steps: multiply the first 17 digits by fixed weights and add them up, then take that total modulo 11 and look the remainder up in a mapping table. The rule comes from the GB 11643 standard and is what makes an 18-digit number self-verifying.
The weights are fixed, running from digit 1 to digit 17:
| Position | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Weight | 7 | 9 | 10 | 5 | 8 | 4 | 2 | 1 | 6 | 3 | 7 | 9 | 10 | 5 | 8 | 4 | 2 |
Divide the total by 11 and the remainder maps to the check character:
| Remainder | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
|---|---|---|---|---|---|---|---|---|---|---|---|
| Check digit | 1 | 0 | X | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 |
#A worked example
Take the number 11010519491231002X. Multiplying the first 17 digits by their weights:
digits 1 1 0 1 0 5 1 9 4 9 1 2 3 1 0 0 2
weights 7 9 10 5 8 4 2 1 6 3 7 9 10 5 8 4 2
products 7 9 0 5 0 20 2 9 24 27 7 18 30 5 0 0 4
total = 167
167 = 15 x 11 + 2, remainder 2 maps to XSo the final character is X. Change that character to anything else and the number fails validation, which is exactly what happens when someone retypes a digit without recomputing the last one.
You do not need to memorise the whole mapping table. The one entry that trips people up is that remainder 2 maps to X. Remainder 10 gives check digit 2 and remainder 1 gives check digit 0 — those two are also easy to transpose.
#Upgrading a 15-digit number to 18 digits
Upgrading a 15-digit number takes exactly two edits: insert 19 in front of the birth date, then compute the checksum and append it.
Walking the same example through both formats:
15 digits: 110105 491231002
region birth date (2-digit year) + sequence
upgrade: 110105 19 491231002
18 digits: 11010519491231002 + checksum X
result: 11010519491231002XThree differences matter, and mixing them up is where mistakes come from:
| Item | 15 digits | 18 digits |
|---|---|---|
| Birth date | 6 digits, two-digit year | 8 digits, full four-digit year |
| Checksum | None | Final digit, 0 to 9 or X |
| Gender digit | Digit 15 | Digit 17 |
China stopped issuing 15-digit numbers in October 1999, and first-generation ID cards stopped being valid on 1 January 2013 — but plenty of legacy systems still store 15-digit records. ID Card Lookup accepts both lengths.
The upgrade rule always assumes the 20th century, so a 15-digit number can only ever describe a 19xx birth date. If your data contains anyone born after 2000, their number cannot be in 15-digit form — treat such rows as dirty data rather than numbers waiting to be upgraded.
#What the parsed result does and does not prove
A passing checksum proves only that the first 17 digits and the last digit belong together. It catches transcription errors, and nothing more.
The boundary breaks down like this:
- Provable: date of birth, gender, and the region the code stands for — all fixed by the encoding rules
- Not provable: whether the number was ever issued, whether it belongs to the person submitting it, or where the holder lives
- Time-dependent: age and zodiac sign change with the current date, so the tool computes them for today
When you need to check numbers in bulk, first extract candidates by format with the Regex Tester, then validate them one by one. That beats scanning a spreadsheet by eye.
#Handling ID numbers without leaking them
An ID number is sensitive personal information, so it should stay out of public channels, application logs and analytics events no matter which tool processes it.
A few ground rules worth adopting:
- Never paste one into public chat groups, ticketing systems, shared online sheets or screenshots
- Never write one into application logs, error traces or monitoring payloads
- Mask before display — a common pattern keeps the first 3 and last 4 characters and replaces the rest with asterisks
- Use synthetic numbers in test environments instead of real records
- Ask whether the original number is needed at all, and store only the validation result when it is not
To mask in bulk, match 18-digit runs with the Regex Tester and rewrite them with Find and Replace. Do this before the data is written to storage or sent anywhere — retrofitting it afterwards means the values already leaked once.
Numbers copied out of a PDF or a scanned document add one more trap: the digits may be full-width characters. They look identical but fail validation, so convert them with the Full-width Converter first.
Everything described here runs locally in your browser, and the number is never uploaded. That only settles the transport question, though. Before handing a sensitive number to any online service, confirm that the service genuinely needs the original value — if it can be processed offline, keep it offline.
#Frequently asked questions
#Is a checksum of X normal?
Yes. The check character has 11 possible values, 0 to 9 plus X, and X represents remainder 2. It is part of the standard rather than a placeholder or an error. Watch the case when entering numbers into legacy systems: the standard uses uppercase X while some older systems only accept lowercase x.
#Can a 15-digit ID number still be used?
Not as an identity document. China stopped issuing 15-digit numbers in October 1999, and first-generation cards became invalid on 1 January 2013. Legacy databases still hold 15-digit records, though — enter one directly and the tool parses the birth date, gender and region using the same rules.
#Why does the parsed region differ from the address on the card?
The region code records the household registration location at the time of issue, which may differ from the current address or the place the card was collected. Administrative divisions also change: after a county becomes a district or two divisions merge, the same code can map to a different name, and the oldest codes may no longer exist in the current table.
#Does a valid checksum mean the number is real?
No. The checksum only guarantees that the first 17 digits and the final character are mathematically consistent, and anyone can construct a number that passes while belonging to nobody. Its value is catching transcription mistakes and dropped characters; verifying identity requires an authoritative source.
#Is it safe to check an ID number with an online tool?
It depends on where the computation happens. A tool that parses in your browser never sends the number anywhere, so it stays on your device. A tool that submits the number to a server hands sensitive data to a third party, which is a much larger risk. Open your browser developer tools and check the network panel if you want to confirm no request is made.
#What is the first step when cleaning a spreadsheet full of ID numbers?
Mask first, validate second. Match 18-digit runs with a regex, replace the middle with asterisks, confirm the copy you are about to store or send contains no complete numbers, and only then run format validation and deduplication on it. Reverse the order and the full numbers have already passed through your tools and logs.