APDU Command Builder
Construct valid ISO 7816-4 APDU commands by selecting command type and parameters.
BuilderClass
Instruction
Parameter 1
Parameter 2
Lc is calculated automatically from data length
Expected response length (leave empty if none)
| CLA | ||
| INS | ||
| P1 | ||
| P2 | ||
| Lc | ||
| Data | ||
| Le |
ISO 7816-4 Instruction Reference
| INS | Command |
|---|---|
| A4 | SELECT |
| B0 | READ BINARY |
| D6 | UPDATE BINARY |
| B2 | READ RECORD |
| C0 | GET RESPONSE |
| CA | GET DATA |
| 20 | VERIFY |
| 88 | INTERNAL AUTHENTICATE |
| 82 | EXTERNAL AUTHENTICATE |
| 84 | GET CHALLENGE |
How to Use
-
1
Choose the APDU command class
Select the command type from the ISO 7816-4 table: SELECT, READ BINARY, WRITE BINARY, GET RESPONSE, VERIFY PIN, or a proprietary command. The CLA, INS, P1, and P2 fields are pre-populated with standard values.
-
2
Set data length and body
Enter the Lc byte (command data length), the command data field in hex, and the Le byte (expected response length). The builder validates byte counts against ISO 7816-4 case structure rules.
-
3
Copy the assembled APDU hex string
The completed APDU is displayed as a hex string in both short (5-byte minimum) and extended length formats. Copy it directly for use with PC/SC wrappers, smartcard test tools, or embedded terminal code.
About
The APDU Command Builder provides a structured interface for constructing ISO 7816-4 compliant Application Protocol Data Units without manually encoding byte fields from specification tables. APDUs are the universal language for communicating with contact smart cards, SIM cards, security tokens, and contactless EMV payment cards, but their binary structure is error-prone to construct by hand.
The builder covers all ISO 7816-4 command cases: Case 1 (header only), Case 2 (header + Le), Case 3 (header + Lc + data), and Case 4 (header + Lc + data + Le), in both short and extended length variants. It pre-populates standard CLA, INS, P1, and P2 values for common commands and validates that the assembled APDU conforms to the case structure rules—for example, ensuring that Le is present when a response is expected and absent when it is not.
For developers working with PC/SC (ISO 7816-3 contact interface) or contactless card readers via ISO 14443, the builder output can be directly passed to SCardTransmit (WinSCard API), javax.smartcardio.CommandAPDU (Java), or card reader command-line tools. For hardware security module and SIM card test environments, the hex output is compatible with standard APDU log formats used in tools like GlobalPlatform Pro and pyResMan.