ATR parser for smart cards
Decode ISO/IEC 7816-3 Answer-To-Reset bytes — convention, format byte, interface bytes (TA/TB/TC/TD), historical bytes, and check byte (TCK). Pasteable from PC/SC, OpenSC, GP shell, or your reader logs.
Input
Decoded
ATR structure in one line
The Answer-To-Reset is what a contact smart card sends after a cold or warm reset, defined by ISO/IEC 7816-3: TS · T0 · (TA1 TB1 TC1 TD1) · (TA2 TB2 TC2 TD2) … · historical bytes · TCK?. TS fixes the bit convention (3B direct, 3F inverse). T0's high nibble says which of TA1–TD1 follow and its low nibble says how many historical bytes (0–15) close the ATR. Each TD byte announces a protocol (T=0 byte-oriented, T=1 block-oriented) and which interface bytes come in the next group.
Spec
ISO/IEC 7816-3 — the canonical reference for ATR structure and protocol negotiation.
Related reading
Related tools
Next step
After the ATR, the card talks in APDUs. Read the responses with the APDU status-word reference, or see secure elements for the chips behind the ATR.
Worked example: the sample ATR, byte by byte
Press Sample above and the parser decodes 3B 8F 80 01 80 4F 0C A0 00 00 03 06 03 00 01 00 00 00 00 6A. This is the ATR most people meet first, and it is not a chip's own answer at all.
| 3B | TS — direct convention |
|---|---|
| 8F | T0 — high nibble 8: only TD1 follows; low nibble F: 15 historical bytes |
| 80 | TD1 — protocol T=0 indicated, and TD2 follows |
| 01 | TD2 — protocol T=1 indicated, no further interface bytes |
| 80 | Historical — category indicator |
| 4F 0C | Historical — application identifier follows, 12 bytes long |
| A0 00 00 03 06 | Historical — RID registered to the PC/SC Workgroup |
| 03 | Historical — card standard: ISO/IEC 14443 Type A, part 3 |
| 00 01 | Historical — card name from the PC/SC registry: MIFARE Classic 1K |
| 00 00 00 00 | Historical — reserved |
| 6A | TCK — XOR of T0 through the last historical byte; present because T=1 is offered |
A MIFARE Classic card is a contactless memory card: it has no ISO/IEC 7816-3 ATR. The PC/SC contactless reader builds this one so that software written for contact cards can still open a session, and the PC/SC RID in the historical bytes is the giveaway. If your logs show A0 00 00 03 06, you are looking at what the reader says about the card, not what the card said.
Three rules this parser applies that hand-decoding often gets wrong. First, TA2 is not a T=1 parameter: it is the specific-mode byte, whose low nibble names the only protocol the card will run. The T=1 values (IFSC in TA, waiting times BWI/CWI in TB, LRC or CRC in TC) start at the third group. Second, TCK is required whenever any protocol other than T=0 is offered and absent on a pure T=0 card, so a missing TCK is only an error in the first case. Third, the historical bytes are card- or reader-specific; the parser shows them raw and as ASCII, and their meaning comes from the issuer's or reader's documentation, as in the PC/SC case above.