BER Length Visualizer
Encode any non-negative integer length to BER octets, or decode a hex length back to its value. Covers short-form, long-form (1..126 octets), and indefinite-form (0x80) encodings.
Decode
Result
Enter hex to decode or an integer to encode.
All decoding runs locally.
About BER length
BER (X.690 §8.1.3) defines three length forms. Short-form: a single byte ≤ 0x7F. Long-form: first byte 0x81..0xFE encoding the count of subsequent length octets, followed by big-endian length. Indefinite-form: 0x80 (BER only — DER forbids it). DGI long-form (used in some EMV personalisation specs) is a stricter variant: always FF || 2-byte BE length, even for small values.