Format overview
MessagePack uses a compact binary format where the first byte contains both format information and often the value itself.
Integer types
Positive fixint (0x00 - 0x7F)
Stores integers 0-127 in a single byte.
+--------+
|0XXXXXXX|
+--------+
stores 0-127 in one byteNegative fixint (0xE0 - 0xFF)
Stores integers -1 to -32 in a single byte.
+--------+
|111XXXXX|
+--------+
stores -32 to -1 in one byteuint8 (0xCC)
Stores unsigned 8-bit integer.
+--------+--------+
| 0xCC |XXXXXXX|
+--------+--------+
stores 0-255 in two bytesuint16 (0xCD)
Stores unsigned 16-bit integer (big-endian).
+--------+--------+--------+
| 0xCD |ZZZZZZZZ|ZZZZZZZZ|
+--------+--------+--------+
stores 0-65535 in three bytesuint32 (0xCE)
Stores unsigned 32-bit integer (big-endian).
+--------+--------+--------+--------+--------+
| 0xCE |AAAAAAAA|AAAAAAAA|AAAAAAAA|AAAAAAAA|
+--------+--------+--------+--------+--------+
stores 0-4294967295 in five bytesuint64 (0xCF)
Stores unsigned 64-bit integer (big-endian).
+--------+--------+--------+--------+--------+--------+--------+--------+--------+
| 0xCF |AAAAAAAA|AAAAAAAA|AAAAAAAA|AAAAAAAA|AAAAAAAA|AAAAAAAA|AAAAAAAA|AAAAAAAA|
+--------+--------+--------+--------+--------+--------+--------+--------+--------+
stores 0-18446744073709551615 in nine bytesFloating point types
float32 (0xCA)
Stores IEEE 754 single precision floating point (big-endian).
+--------+--------+--------+--------+--------+
| 0xCA |FFFFFFFF|FFFFFFFF|FFFFFFFF|FFFFFFFF|
+--------+--------+--------+--------+--------+
stores float32 in five bytesfloat64 (0xCB)
Stores IEEE 754 double precision floating point (big-endian).
+--------+--------+--------+--------+--------+--------+--------+--------+--------+
| 0xCB |FFFFFFFF|FFFFFFFF|FFFFFFFF|FFFFFFFF|FFFFFFFF|FFFFFFFF|FFFFFFFF|FFFFFFFF|
+--------+--------+--------+--------+--------+--------+--------+--------+--------+
stores float64 in nine bytesString types
fixstr (0xA0 - 0xBF)
Stores strings with length 0-31.
+--------+========+
|101XXXXX| data |
+--------+========+
stores 0-31 byte strings in 2-32 bytesstr8 (0xD9)
Stores strings with length 0-255.
+--------+--------+========+
| 0xD9 |YYYYYYYY| data |
+--------+--------+========+
stores 0-255 byte strings in 2-257 bytes