# Chinese Taiwan Identity Card Number (Resident Identity Card) Validator

## To Check an Chinese taiwan Resident ID number Easily and quickly.

#### How to validate Taiwan Identity Card Number?

```Identity Number ::= <location_code>  <gender_code>  <serial_number>  <checksum>
<location_code> ::= 1*UPALPHA
<gender_code>   ::= 1 | 2
<serial_number> ::= 7*DIGIT
<checksum>      ::= 1*DIGIT
```
Algorithm:
Step 1 –
Convert the location code into digit with the table below.

```A: 10    B: 11    C: 12    D: 13    E: 14    F: 15    G: 16    H: 17    I: 34
J: 18    K: 19    L: 20    M: 21    N: 22    O: 35    P: 23    Q: 24    R: 25
S: 26    T: 27    U: 28    V: 29    W: 32    X: 30    Y: 31    Z: 33
```
Step 2 –
Compute the product of each digit of number obtianed in Step 1 multiplied by their positional coefficient. Then adding all products obtained in the preceding computation.
Step 3 –
Check the total obtained in Step 2 if it is a number ending in zero (30, 40, 50, etc.) for the identity number to be validated.
Example:

The following example demonstrates how to validate taiwan identity number A123456789.

```ID Number =    A     1   2   3   4   5   6   7   8   9
1   0
×1  ×9  ×8  ×7  ×6  ×5  ×4  ×3  ×2  ×1      (Coefficients)
----------------------------------------------------------
1   0   8  14  18  20  20  18  14   8   9  (Total = 130)

Step 1: Convert "A" into "10".
Step 2: Calculate the product of each digit multiplied by their coefficient and sum them
all up.
1 + 0 + 8 + 14 + 18 + 20 + 20 + 18 + 14 + 8 + 9 = 130
Step 3: 130 ÷ 10 = 13...0
Note: The identity number is valid because 130 divided by 10 yields no remainder.
```