Taiwan ID specimen - front
Taiwan ID specimen - back
Checking validity of a Taiwanese ID 𝒃𝒚

To validate a Taiwanese ID you will need to check following criteria

  • length [10 characters]
  • 1st letter is area code [A-Z]
  • 2nd letter is gender & nationality status [1,2,A,B,C,D]
  • 3rd to 9th character are ID numbers [0-9]
  • 10th character is a check digit
Taiwan ID schema

The initial letter depends on the place of one's first household registration.

Allowed are all characters of the English alphabet [A-Z].

  • A Taipei City(臺北市)
  • B Taichung City(臺中市)
  • C Keelung City(基隆市)
  • D Tainan City(臺南市)
  • E Kaohsiung City(高雄市)
  • F New Taipei City(新北市)
  • G Yilan County(宜蘭縣)
  • H Taoyuan City(桃園市)
  • I Chiayi City(嘉義市)
  • J Hsinchu County(新竹縣)
  • K Miaoli County(苗栗縣)
  • L Taichung County(臺中縣) no longer issued
  • M Nantou County(南投縣)
  • N Changhua County(彰化縣)
  • O Hsinchu City(新竹市)
  • P Yunlin County(雲林縣)
  • Q Chiayi County(嘉義縣)
  • R Tainan County(臺南縣) no longer issued
  • S Kaohsiung County(高雄縣) no longer issued
  • T Pingtung County(屏東縣)
  • U Hualien County(花蓮縣)
  • V Taitung County(臺東縣)
  • W Kinmen County(金門縣)
  • X Penghu County(澎湖縣)
  • Y Yangmingshan Management Bureau(陽明山管理局) no longer issued
  • Z Lienchiang County(連江縣)

The second letter is used to encode gender and the nationality status. Many implementations fail to accept non numeric values, discriminating against non Taiwanese nationals.

Taiwanese national with household registration
  • 1male
  • 2female
National without household registration (NWOHR)
  • Amale
  • Bfemale
Alien Resident (ARC/APRC)
  • Cmale
  • Dfemale

The check digit is a weighted sum of the digits, modulo 10, with different weights for each number position.

Letters

The first character (and sometimes the second) are not numeric and the summand of the weighted sum is calculated differently. The letters have a specific value assigned to them.

Letters I and O (which could be interpreted as 1 and 0) were pushed back to the end of the alphabet in an attempt to avoid them. Letter Z also has been shifted.

The easiest way to implement this is to get the index of the letter in the following string and add 10 to it. You will get the assigned number.

Then use following formula for the area code:

In case the gender code is not numeric use following formula:

Numbers

For all numbers calculate the summand of the weighted sum with following formula:

The last step is to compute the check digit:

Compare the calculated check digit and the last number in the ID.