Structured Data
TLV Parser
Parse hexadecimal TLV records with fixed type widths and big-endian or definite BER lengths. Inspect offsets and reject truncated values.
This tool runs open-source code from CyberChef by GCHQ (Apache License 2.0). See open-source credits.
TLV Parser reads fixed-width type bytes followed by a length and its value. Fixed lengths use big-endian order. Use BER length selects definite BER length encoding while keeping the configured type width. The parser returns each record's starting offset, type bytes, value length, and exact hexadecimal value.
The JSON keeps type and value bytes as hexadecimal strings. The byte table explains each type, length, and value boundary.
- Check a proprietary binary message whose tag and length widths are known.
- Locate a truncated value without silently inventing missing bytes.
- Inspect definite BER length fields while retaining opaque application values.
Sources: ITU-T X.690: BER length encoding
Instructions
- Select Hex and paste complete byte pairs. Choose Raw only when characters directly represent the original byte values.
- Set Type size to the fixed number of type bytes. Use zero for records that contain only length and value.
- Set Length size to the fixed width from your format specification. Use BER length ignores that fixed width.
- Select Parse bytes. Compare each record's declared length with its value bytes and the next record's offset.
- Select Run working sample for two records with type bytes 01 and 02.
Example
Input: 01 03 41 42 43 02 02 00 ff
Settings: Input format: Hex; Type size: 1; Length size: 1; Use BER length: off (the defaults).
Result: [ { "offset": 0, "key": "01", "length": 3, "value": "414243" }, { "offset": 5, "key": "02", "length": 2, "value": "00ff" } ]
Record 1 starts at offset 0 and contains 41 42 43. Record 2 starts at offset 5 and contains 00 ff.
Limits
- Type size accepts 0 through 8 bytes. Fixed Length size accepts 1 through 4 bytes.
- BER mode supports short lengths and up to four subsequent length bytes. It rejects indefinite lengths.
- BER mode does not parse variable ASN.1 identifiers, nested structures, or end-of-contents markers.
- The input limit is 65535 bytes and 4096 records. The explanation shows at most 64 field rows.
- Zero-length values remain valid. Incomplete headers and values cause errors with the affected offset.
- TLV has no universal type registry or checksum. Your application's specification determines the meaning of each type and value.