Protocols
Saved & recent

Type–length–value

Also called: TLV, tag-length-value

Type–length–value is a way to organize fields inside a message. The type identifies what a field represents, the length describes its size according to the format’s rules, and the value contains its data. A receiver can use those boundaries to locate the next field without understanding every value.

In a hypothetical format with one-byte type and length fields, type 05, length 03 and bytes 41 42 43 carry the three ASCII letters ABC. That whole field occupies five bytes. Real protocols must define field widths, byte order and what the length counts. An unknown type can be skipped only when that protocol’s rules permit it; lengths still need validation.

Read first
Message framing
Related
Message framing, Protocol extensibility, Concise Binary Object Representation
Further reading
IETF — RFC 8200, IPv6 option format
one-byte type and length type length value · ABC 05 03 41 42 43 next field 3 value bytes 5 bytes in this field hypothetical format · hexadecimal
In this illustrative TLV format, the length counts three value bytes; the type and length add two more bytes.

View in the full Protocols collection