MessagePack Encode/Decode
Online MessagePack encode/decode tool with JSON conversion, hex/Base64/C-array output, and byte viewer for protocol analysis, IoT debugging, and binary payload troubleshooting.
Paste MessagePack bytes from packet capture, device logs, or API payloads.
Click to insert sample data
Decoded Result
Enter MessagePack data to decode and view result
MessagePack Protocol Guide
What is MessagePack
MessagePack is an efficient binary serialization format designed to keep a JSON-like data model while reducing payload size and improving parse speed. It is widely used in network protocols, embedded devices, and high-throughput services.
Encoding Structure
The first byte identifies both type and length strategy. Some types embed value or length directly in the first byte, while others use 1/2/4/8 following bytes.
| Format Byte | Meaning |
|---|---|
| 0x00-0x7f | positive fixint (0 to 127) |
| 0x80-0x8f | fixmap (0 to 15 key-value pairs) |
| 0x90-0x9f | fixarray (0 to 15 items) |
| 0xa0-0xbf | fixstr (length 0 to 31) |
| 0xc0 | nil |
| 0xc2/0xc3 | false/true |
| 0xcc-0xcf | uint8/16/32/64 |
| 0xd0-0xd3 | int8/16/32/64 |
| 0xdc/0xdd | array16/array32 |
| 0xde/0xdf | map16/map32 |
MessagePack Data Type Reference
| Type | Format Bytes | Description |
|---|---|---|
| Positive Integer (fixint/uint) | 00-7f / cc-cf | Non-negative integer with size-based encoding |
| Negative Integer (fixint/int) | e0-ff / d0-d3 | Signed integer with 8/16/32/64-bit variants |
| Floating Point | ca/cb | 32-bit or 64-bit IEEE 754 float |
| String | a0-bf / d9-db | UTF-8 text using fixstr/str8/16/32 by length |
| Binary | c4-c6 | Raw byte sequence using bin8/16/32 |
| Array | 90-9f / dc-dd | Ordered items using fixarray/array16/array32 |
| Map | 80-8f / de-df | Key-value object using fixmap/map16/map32 |
| Extension | d4-d8 / c7-c9 | Custom typed payload; type -1 is commonly timestamp |
MessagePack vs JSON
Both formats represent similar logical structures. MessagePack optimizes binary transfer efficiency, while JSON focuses on text readability and manual editing.
- Smaller payloads and lower network overhead
- Fast encode/decode for high-throughput workloads
- Binary-friendly format with protocol extension capability
- JSON-like structure with low migration cost
- Human-readable and easy to debug
- Broad ecosystem and language support
- Directly suitable for logs and config files
Common Use Cases
- High-frequency messaging between IoT devices and gateways
- Binary RPC transport between microservices
- Game server state sync and event broadcasting
- Compact data exchange in edge computing nodes
- Payload-sensitive mobile network requests
Extension Type (Ext)
Ext allows custom semantics beyond built-in types. By common convention, ext type = -1 is used for timestamp, while other type ids are application-defined.
| Ext Type | Meaning |
|---|---|
| -1 | Timestamp extension type (common convention) |
| 0 | Application-defined extension type |
| 1-127 | Reserved positive type range by protocol |
| -128--2 | Reserved negative type range by protocol |