Skip to content

Thai National ID Card Specification

1. System Overview

  • Standards: ISO/IEC 7816-4
  • Encoding: TIS-620 (Thai Character Set)
  • Crypto: None for basic data reading (Plaintext access after selection)
  • Protocol: T=0 / T=1 (Contact)

2. Application Identifiers (AID)

ApplicationAID (Hex)Description
Thai ID AppA0 00 00 00 54 48 00 01Main ID Application

3. APDU Command Reference

CLA: 80 (Proprietary) for Reading, 00 (ISO) for Selection.

CommandINSP1P2DataLeDescription
SELECTA40400[AID]-Select Application
READ BINB0OfsHOfsL-LenRead Data from fixed offsets
GET RESPC00000-LenGet Response (if SW=61xx)

4. Data Offsets (Virtual File Structure)

The Thai ID card acts like a large binary file where different data fields are located at specific offsets. Requires SELECT AID first.

Field NameOffset (Hex)Length (Bytes)Description
Citizen ID00 041313-digit National ID Number (ASCII)
Full Name (Thai)00 11100Thai Name (TIS-620)
Full Name (En)00 75100English Name (ASCII)
Date of Birth00 D98YYYYMMDD (ASCII, often Buddhist Era?)
Gender00 E11'1'=Male, '2'=Female
Issuer00 F6100Issuing Authority (Thai)
Issue Date01 678YYYYMMDD
Expiry Date01 6F8YYYYMMDD
Address15 79100Address (Thai)
PhotoxxxxvarSplit into multiple chunks (requires chaining)

5. Reading Flow

  1. SELECT Thai ID App (00 A4 04 00 08 A0 00 00 00 54 48 00 01).
    • Check SW 9000.
  2. READ BINARY specific offsets.
    • Example (Read CID): 80 B0 00 04 02 00 0D.
    • Note: The 02 in P2 (or Lc field in some drivers) might be specific to certain readers/cards, but standard ISO READ BINARY uses P1/P2 as offset.
    • Correction: Some sources say command structure is 80 B0 P1 P2 02 00 Le. The 02 00 bytes are peculiar to Thai ID structure.
  3. Decode TIS-620 bytes to String.

Released under the MIT License.