Chinese ID Cards

Pretty much every Chinese person has a government-issued ID card (身份证). They serve the roles of American social security cards (and sometimes driver’s licenses, for non-driving-related ID purposes). These ID cards are necessary for all kinds of everyday procedures and thus indispensible in daily Chinese life, although in some cases the ID number on the card is all that is needed.

Recently I became interested in the structure of the ID numbers on these cards. I was trying to sign up with an online Chinese bulletin board. I ran into a problem, however, because a Chinese ID number was a mandatory part of registration. I wondered: did the number really need to be valid? Was this important?

I googled 身份证 to determine the appropriate number of digits, and then entered a random number. My application was denied. Invalid ID number. Ah, so they won’t take just any old number.

But, I reasoned, they couldn’t possibly be checking the number I input with a central database of the ID numbers of all Chinese citizens, now, could they? I figured the ID number had information encoded in it, which was checked against the other registration information I provided in my application (such as date of birth).

I googled for an image of a 身份证 and found one. Some basic analysis was all that was required to invent an ID number that the automatic form would accept. Soon after, however, I decided that an account involving a fraudulent ID number could possibly get me into real trouble, and I cancelled my application.

Just recently I came across a related entry on the excellent Chinese blog GiE: 身份证号都代表什么意思? (what do the digits of an ID number mean?). Here’s a simple summary of the information provided on GiE in Chinese:

  • Chinese ID numbers are arranged left to right, composed of 17 ID digits plus 1 validation digit, for a total of 18 digits.
  • The first 6 digits are the address code of the owner’s place of legal residence.
  • The next 8 digits are the owner’s birthdate: year (4), month (2), day (2).
  • The next 3 digits are a “sequential code” for distinguishing people of identical birthdate and birthplace. Odd numbers for males, even numbers for females.
  • The final validation digit is based on a formula which, quite honestly, I don’t understand at all. (If you can read the original Chinese and explain it, I’d be very interested.)

The above system applies to new (since 2000, maybe?) 身份证. In the examples below, you can see some changes over the years:

You’ll also notice on these ID cards that 民族 (ethnic group) is listed on the card. Most Chinese people are Han Chinese (). You may notice that in the examples above, the last guy is not (although you wouldn’t know looking at him).

I’ve always thought it would be funny to get a fake Chinese ID card (these are easy to acquire, I understand) with my real picture and Chinese name on it, that said I was 汉族 (Han Chinese). But then I doubt the PSB have much of a sense of humor about that kind of thing, so I never went through with it.

Note: I wondered briefly if it was kosher to write about this kind of thing online, but the blog entry on GiE that I linked to was public and written in Chinese, and all the 身份证 pictures I linked to were found through Baidu Image Search, which is known to wholly comply with the Chinese government.

31 Comments to “Chinese ID Cards

  1. John B says:

    The instructions for how to figure the checksum number on the page you’ve linked to kind of suck, but I figured it out.

    Basically, you have two number strings, one of which is the first 17 numbers of the ID card and the second is a fixed string of weights (the “7 9 10 5 8 4 2 1 6 3 7 9 10 5 8 4 2″). Loop through them both, multiplying the digit from the ID card with the corresponding digit in the weight string. Keep a running sum of those results.

    Once you’ve done that, get the modulus of that sum and 11. That is the index of the number from the second fixed set of numbers (the “1 0 X 9 8 7 6 5 4 3 2″), with the first digit being index 0.

    In PHP, it looks like this (using the ID number from the second-to-last photo you linked):

    <?

    $idnum = “413001196606230525″;
    $weight = Array(7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2);
    $valcode = Array(1, 0, “X”, 9, 8, 7, 6, 5, 4, 3, 2);
    for ($i = 0; $i > $sum += $idnum[$i] * $weight[$i];

    }
    $checksum = $valcode[$sum % 11];

    ?>

    It works for that number and my girlfriend’s (the only two numbers I have access to right now), but I’m pretty sure I got the formula right.

    Now if you’ll just validate my Nerd Pass I’ll be on my way…

  2. Micah says:

    I ran across this a while ago when I was looking at some weird Perl modules on CPAN. It looks like Lin Dao used the same info you found to write a Perl module that will verify whether a number is a valid ID number.

    It shouldn’t be too hard to generate one using this same algorithm, as long as you know valid codes for any place of residence, and are sure that the “sequential code” doesn’t have any logic behind it.

  3. Andrew says:

    The information is definitely public domain: BLU’s 一年纪阅读教程第二册 also has a little article on how to break down a Chinese ID card number…

  4. gie says:

    你好,又见面了:) 提个小小的建议,虽然上面的图片都是从百度搜索出来的,不过我个人觉得还是对图片上的头像和姓名等信息作一些马赛克处理,这样或许会好一点。

  5. John says:

    [Gie writes that it would probably be better not to link directly to real people's unmasked ID cards.]

    Gie,

    Yes, I see your point, but I don’t think many Chinese people in China read my English blog. If they do, then their English is probably pretty good, and they’re not criminals.

    I don’t think foreigners in China who read my blog are going to see this as some kind of 身份证 scam opportunity either.

    Lastly, I can only assume that these people willingly put images of their real ID cards online, and the images are not even hotlink protected. If any of these people cares enough to e-mail me and ask me not to link to their ID card, I will remove the link.

  6. John says:

    John B,

    Wow, pretty impressive. Yes, that explanation will do nicely. Nerd Pass valiated.

    (Ironically, you’re the one that recommended Markdown to me, but you’re the first person to ever have problems with it. With a bit of tweaking I got your PHP code to look semi-OK.)

  7. John says:

    Ah, Micah, king of “I saw it elsewhere first.” Looks like there’s definitely some copying and pasting going on. Thanks for the link.

  8. Kaili says:

    The interesting thing about the cards having the ethnic group on it is that people must choose one ethnic group when they register. For instance, I have a friend that’s half Tibetan and half Qiang, but his ID is Tibetan. It’s quite interesting sociologically, because he always says “we Tibetans do this” and “we Tibetans are like that” — but in actual fact, he hardly ever saw his Tibetan father who travelled a lot, he lives in a Qiang village, his mother is Qiang and in general he doesn’t really know a lot about Tibetan traditions. But because he is identified offically as a Tibetan he kind of has to model himself after Tibetan characteristics. I’d love to do a big study on this — on how much your registered ethnic group impacts on your identity and behaviour.

    In fact, ethnic identity isn’t even the right word, because ethnicity has to do with subjective identities (where do you feel that you belong?) rather than purely ancestry as such. John getting an ID with Han Chinese may not be valid, but I read a case of a Canadian girl whose parents brought her up in China during the revolution, and she went to North America for the first time in the 80s and couldn’t speak a word of English. American customs wouldn’t believe her, she had a Chinese passport, and looked obviously caucasian — yet with a Chinese looking translator! What is her ethnic identity? Well, ancestry-wise she’s Canadian/Caucasian — but she’s fully Han in terms of upbringing! ANyway that’s not strictly relevant, but it would be interesting to find out what these labels do to people’s subconcious identification…

  9. gie says:

    关于Kaili提到的民族问题,其实据我所知,父亲和母亲属于不同民族的时候,孩子一般按父亲的民族登记,当然也不是绝对。其实我觉得现在中国的民族观念已经比较淡薄了,很多少数民族和汉族已经看不出什么区别,可以说基本实现了民族的大融合,当然也有很多民族还保留着本民族特色的东西。 还有一点必须提到的是,中国对于少数民族有很多特殊的优惠政策,所以有时候汉族人会挺羡慕少数民族的。:)

  10. Steve Ehring says:

    When I was a bouncer in college, I learned all about the different U.S. state’s ID numbers and what they meant when translated to number (i.e. third letter of the last name, first vowel in first name, etc.).

    It was the number one way to spot fake ids, which (begin the devious and poor college kid I was) were sold back to the owner for $5. An extra $20 would get you in, anyway. I got fired after 6 months.

    Stupid job.

  11. JFS says:

    Kaili:

    A few years ago I had a colleague who was identified as Man (Manchu). Her father, I believe, was Man and her mother was Han. She did not speak Man, only Chinese; she did not feel like she was a Man, only a Han, but the government, in order to keeps up some quota on minority ethnicity identifies her as a Man. I suspect her children (Child, but she may be entitled to more due to her minority status) will also be identified as Man, even though her husband (to be) is a Han. In her case, she would rather have been identified as Han, because everything she identifies with is really Han (going back to how you identify ethnicity). The old (I do not know about the present) birth certificates in Canada identified the child by ethnicity of the parents (my grandmother was identified by father Scots and mother English). Caucasian is not really an ethnicity, although most White people have lost what an ethnos really is, probably because the ethnos has disappeared from Western Europeans, North Americans.

  12. Kaili says:

    JFS, I think the parents actually get to choose the ethnicity of the kids, although some allow their kid to choose. There are some benefits to being identified as a minority — lower grades to get into university for example. However, that’s kind of counterbalanced by the fact that if your hukou says you are a minority group, your prospective employers may assume you didn’t really make the grade.

    Hmm, good point that caucasian is not an ethnicity! I guess ‘Anglo-saxon’ probably is for much of the ex-Brit colonies. I think you’re right in saying the relevance of ethnicity has kind of been lost on a lot of the Western world, which is mostly English-speaking and hollywood-watching.

    Sorry qie, my current computer is too old to read Chinese (I just get a whole lot of boxes, and Kaili) , and I probably can’t read enough to know what you said anyway. Any translations?

  13. Dan Maas says:

    qie wrote: When one’s parents come from different ethnic groups, one usually registers under the father’s group, although there are exceptions. In any case the differences between ethnic groups have been disappearing slowly. It bears mentioning that China has preferential policies towards ethnic minorities which Hans sometimes envy.

  14. Dan Maas says:

    Also – I find it interesting that the “normal” Chinese ID system goes beyond even the most extreme (privacy-wise) ideas for a U.S. national ID, yet apparently without any strong objections. Chalk it up to differing cultural values I guess.

  15. Hui Mao says:

    Traditionally the ethnicity of a person in China usually followed that of the father. But in the last couple of decades, this has changed because of various special benefits allowed for minority ethnic groups so now people tend to just choose whichever ethnicity that has the greatest benefits when it came to college entrance exams, family-planning restrictions, etc. I know several friends who actually changed their official registered ethnicity for the college entrance exams.

  16. Todd says:

    Dan, it’s not only China, A LOT of countries have a national ID system.

    John, I don’t see any logical reason why a Chinese criminal might not have a high level of English — indeed it would probably be a great asset to a hacker to be able to read English material. On a completely unrelated note, I think quite a lot of Chinese probably read this blog.

    I would assume that if a website validated your Éí·ÝÖ¤ at all, it would just validate the checksum digit, not address code and probably not even d.o.b. At it’s core, that checksum algorithm is used widely all over the world — I would say that if a serial number sometimes ends in “X” then it is probably using this algorithm. But usually the weights are just [1 2 3 4 ... etc] and the checksum digit is just the modulus itself or X for 10. This variation for Éí·ÝÖ¤ seems to just be needless obfuscation.

  17. John says:

    Todd,

    True, Chinese hackers would be expected to have a decent reading level in English. But then a Chinese hacker is certainly going to be familiar with this information in its original Chinese, which also contains more information a hacker would need.

    According to my referrer logs, only a fairly small proportion of my visitors are from China, and I know a lot of those are expats.

  18. Pink Panther says:

    Thank you for this valuable information John. Using this entry as a guide to creating a fake ID, I was able to purloin several priceless gems, diamonds, and art work throughout China over the last few days.

  19. Kay says:

    My mom is Manchurian, and my father is Han and I do have some Manchurian traits.. But I registered as Han when I was born, until I changed it to Man at the age of 16, because I can automatically add 10 points in the National Entrance Exam for college and as a teenager, I felt “cool” be a minoroty because there are too many Han people anyways :p My mom had to talk the police into changing it, she talked with them the whole afternoon and handed them cigarettes then the police agreed to do it for me, of course my mother is a 100% Manchurian. I can’t speak a single Manchurian word, but I’m still Man, and I don’t personal know another Manchurian who can speak this language.

  20. ernie says:

    2 out of my 3 closest Chinese friends eventually opened up to me that their ids were faked when they entered school, because their parents wanted them to start a year early. So they were both really a year younger than their id stated.

  21. J says:

    Actually from my own experience there are very little Manchurians who can speak their ethny’s language. It seems that the language progressively got marginal as the Manchurians got integrated into the Empire as some sort of ‘leading ethny’ – which they were during the Qing dynasty. BTW 五一节快乐 to all!

  22. Justin says:

    Disclaimer: I used ’413001196606230525′ from http://www.southcn.com/news/gdnews/sz/sfz/dtxw/200403200408_386248.jpg to register for a Chinese game. Hope that guy doesn’t mind. I had no choice because I am from Singapore and the game wouldn’t let me register unless I enter a valid 身份证 number. Do you guys think it is alright?

  23. TC says:

    I would like to create a 身份证 in order to play a chinese game online, and i dont understand how.. can any of yall help me?

  24. Hesi says:

    Is it possible to either apply and/or renew this 身份证 online instead of appearing in person?

    Does anyone have any knowledge how this can be accomplished?

    I’m oversea, and my 身份证 issued in year 2001 is due for renewal.

  25. Steve says:

    I used my old Motorola Commerce ID number and my birthdate in their format (for characters 7-14), plus random numbers at the end to post my resume to the ‘Welcome to Join Motorola’ Chinese website.

    Wait’ll they get a load of this (my resume is about 68 kB in Word)!

    Hey, it could work! They sure aren’t hiring here. Maybe work in Taiwan for a while and lead a ‘Free Taiwan’ movement!

    (Yeah…like this doesn’t have ‘international incident’ written all over it.)

    I say, “Screw the frickin’ commies” if they can’t take a joke!

  26. Alex 'admLoki' Zinchenko says:

    So, what i got with that : First 6 numbers is a code of province . Next 8 numbers is a date of birth . Next 2 numbers unknowned . Next 1 number is a sex of ID owner(1 – male, 2 – female) Last number is for validation.

    So, you can make your own id without any generators, example : 413005198905080215 .

    Check your ID here – http://flash.chinaren.com/ip/id.php

  27. Gabriel says:

    Abuot the checksum algorithm: I have done some modulo calculation. Here is the resulted C code for(i=0,sum=-1;i<17;i++)sum+=id[i]<<(17-i);

    chk=(sum<<5)%11;
    

    It works without weight and valcode arrays. The elements of the weight array are powers of 2. e.g. 128%11=7, 64%11=9, 32%11=10. The tags sum=-1 and sum<<5 eliminate the necessity of valcodes.

  28. Meli says:

    Hmmm, wow, this really helped… I want to play a Chinese game, but I cant actually read any chinese, and I dont have an ID… but with your guide, I made one up! XD I just put 110107 as my area thing (after getting an example of acceptible ones from other sources), and put in the rest of my personal information… I didnt know what to do about the last digit, but seeing as it is only one digit, I just did guess and check until it let me register! Thanks!

  29. shijilal says:

    can any one plz help me register in this chineese game site

    http://member.joyzone.com.cn/member/register/register_01.show

    I tried to use the citizen id given here, after submiting its giving an error which i cant read. the image of the error you can view here

    http://i280.photobucket.com/albums/kk161/shijilal/Misc/err.jpg

    Plz help me register in the game site.

  30. Visitor says:

    So, where DO you get these fake cards? Your admission that they are easy to acquire piqued my interest, and I think it would be funny to have one too. Not sure if I’d have the guts to do it either, but I want to look into it, for adventure’s sake. Do you have any tips? (The link didn’t work for me).

    Thanks!

  31. Vanna Kjyshy says:

    Tough cookie these Adult ID’s. I’d like to play Aion Chinese Open Beta,but dayum, the website keeps rejecting any and all of the ID’s that somehow appear to be working on the link someone posted earlier.

    I’d need two ID’s generated, gender doesn’t matter, but need to work 100%, willing to give a small donation via paypal to anyone smarter than my simple self.

Leave a Reply

Sinosplice and all material found herein © 2002-2014, John Pasden. All rights reserved.
Sinosplice is happily hosted by WebFaction. Design by Dao By Design