Skip to content
EMV Tools

Tools

BER-TLV decoder

Almost all EMV data is encoded as BER-TLV: a tag that says what the data is, a length in bytes, and the value. The card returns it in its responses to the terminal (APDU responses), and the terminal sends it to the issuer in DE 55 of the authorization message.

Paste data here when you need to see what a card returned or what a terminal sent: a GET PROCESSING OPTIONS response, a card record, or the DE 55 field from a host log.

The result is a tree. Each row shows the tag, its name from the dictionary, the length, and the value, and constructed tags (templates) hold their children. The decoder keeps going when it finds bytes it cannot read and marks them; strict mode stops at the first error. The PAN and track data are masked by default and never go into a share link.

Worked example: the GPO response example, 77 12 82 02 1980 94 0C 08010100 10010301 18010201, is template 77 with 18 bytes inside. It holds tag 82, the application interchange profile (AIP) 1980, and tag 94, the application file locator (AFL), whose three 4-byte entries list the records to read.

New to EMV? Read EMV in 5 minutes or browse the glossary

Everything runs in your browser. Nothing you enter leaves this page.

Spaces, line breaks, colons, and the 0x prefix are ignored.

Stop at the first error instead of marking it and continuing.
Examples with synthetic data

Anatomy of a TLV object

Anatomy of a TLV objectThe object 9F02 06 000000001000 from the terminal data example, split into its tag 9F02, its length 06, and its six-byte value 000000001000. The first tag byte, 9F, is 1001 1111 in bits: bits 8 and 7 give the class, bit 6 is 0 so the object is primitive, and bits 5 to 1 are all 1 so the tag continues in the next byte.9F 02Tag06Length00 00 00 00 10 00ValueFirst tag byte: 9Fb81b70b60b51b41b31b21b11123
  1. Bits 8 and 7 give the class. Here they are 10: a context-specific tag, the class of most EMV tags.
  2. Bit 6 says whether the object is primitive (0) or constructed (1). Here it is 0: the value is plain data.
  3. Bits 5 to 1 hold the tag number. When they are all 1 (11111), as here, the number continues in the next byte.

Other cases

  • Two-byte tags: the first byte ends in 11111, so the tag continues, as in 9F02. If bit 8 of the next byte is 1, a third tag byte follows.
  • Long lengths: a length byte from 00 to 7F is the length itself. 81 means the next byte holds the length, up to 255 bytes, and 82 means the next two bytes hold it, up to 65,535 bytes.
  • Constructed objects: when bit 6 of the first tag byte is 1, the value holds more TLV objects instead of data, as in 70 (a record template) and 77 (the GET PROCESSING OPTIONS response).