Building a signup form or proofreading imported records — knowing how an 18-digit ID number is constructed makes both tractable. This article covers structure and format validation only; it does not encourage looking up other people's information.
The Four Segments
- Digits 1-6: address code — province, city, county administrative codes.
- Digits 7-14: birth date as yyyymmdd, instantly checkable.
- Digits 15-17: sequence code for people born the same day in the same area; digit 17 is odd for male, even for female.
- Digit 18: checksum — 0-9, or the Roman numeral X standing for 10.
That Trailing X Is Not an English Letter
The final digit is computed from the first 17 by the national standard (ISO 7064 MOD 11-2), catching transcription errors: mistype one digit and the checksum no longer matches, so the system can flag the number as invalid. When the remainder is 10 there is no room for two characters, so the Roman numeral X takes the seat — unrelated to the letter X.
Two Levels of Validation
- Format level: 18 digits, valid birth date, correct checksum — instant with a tool, ideal for forms and spot checks.
- Identity level: a format-valid number proves nothing about existence or ownership; real-name verification must go through licensed official channels.
Recommended Tools
ID Card Validator
Validate Chinese resident ID checksums and extract birth date, gender and province.
Regex Tester
Test regular expressions live with match list and highlighting.
Free online, images never leave your browser
FAQ
Are old 15-digit numbers still usable?
First-generation IDs are long retired; current cards all carry 18 digits. Legacy 15-digit records (two-digit year, no checksum) can be upgraded by rule, but trust official renewal documents.
Does a passing checksum mean the ID is real?
No. The algorithm is public; a valid format only means 'possibly genuine'. Real verification requires official or licensed identity services.