CoderTools

MessagePack Codec

Encode and decode MessagePack binary serialization format

🔒 100% Local ProcessingYour input data is processed entirely in your browser. It is not uploaded to any server.

Paste MessagePack data from API responses, log files, or network captures

Click to Insert Example Data

Decoded Result

Enter MessagePack data and click Decode to see results

MessagePack Data Types Reference

Type Name Format Byte Range Description
Positive FixInt0x00-0x7FIntegers from 0 to 127 (single byte)
Negative FixInt0xE0-0xFFIntegers from -32 to -1 (single byte)
FixMap0x80-0x8FMaps with 0-15 key-value pairs
FixArray0x90-0x9FArrays with 0-15 elements
FixStr0xA0-0xBFStrings with 0-31 bytes length
Nil0xC0Represents null/nil value
Boolean0xC2-0xC3True (0xc3) or False (0xc2)
Binary0xC4-0xC6Raw binary data (bin8/bin16/bin32)
Extension0xC7-0xC9, 0xD4-0xD8Application-specific types with type code
Float0xCA-0xCB32-bit or 64-bit floating point numbers
Unsigned Integer0xCC-0xCF8/16/32/64-bit unsigned integers
Signed Integer0xD0-0xD38/16/32/64-bit signed integers
String0xD9-0xDBUTF-8 strings (str8/str16/str32)
Array0xDC-0xDDArrays with 16-bit or 32-bit length
Map0xDE-0xDFMaps with 16-bit or 32-bit length

MessagePack Protocol Documentation

What is MessagePack

MessagePack is a binary serialization format designed for efficient data exchange. Created by Sadayuki Furuhashi in 2008, it packs JSON-like data structures into a compact binary representation that's typically 50% smaller than JSON while being faster to parse. The format is widely adopted in Redis, Fluentd, and numerous real-time communication systems where performance matters.

Binary Encoding Structure

MessagePack uses a type-length-value encoding scheme. The first byte (format byte) determines the data type and may contain the value itself for small integers and short strings. Larger values use additional bytes for length and payload. This design allows MessagePack to encode small values extremely efficiently while still supporting large data structures.

Format Byte Meaning
0x00-0x7FPositive fixint (0-127, value in byte)
0x80-0x8FFixmap (0-15 pairs, count in lower 4 bits)
0x90-0x9FFixarray (0-15 elements, count in lower 4 bits)
0xA0-0xBFFixstr (0-31 bytes, length in lower 5 bits)
0xC0-0xDFNil, boolean, bin, ext, float, int types
0xE0-0xFFNegative fixint (-32 to -1)

MessagePack vs JSON Comparison

Both formats represent the same data model but optimize for different scenarios. MessagePack prioritizes compact size and parsing speed, making it ideal for high-throughput systems. JSON prioritizes human readability and universal compatibility across all platforms.

MessagePack Advantages
  • 30-50% smaller than JSON
  • Native binary data support
  • Faster serialization and parsing
  • Type-safe with distinct integer types
JSON Advantages
  • Human readable and editable
  • Universal browser and language support
  • Easier debugging and logging

Common Applications

  • Redis data serialization and caching
  • Real-time communication protocols (gaming, chat)
  • Fluentd log aggregation and forwarding
  • RPC frameworks (MessagePack-RPC)
  • Mobile and embedded applications with bandwidth constraints

Extension Types

MessagePack supports application-defined extension types. Each extension has a type code (integer from -128 to 127) and binary payload. Common standard extensions include timestamp (type -1), which stores seconds and nanoseconds for precise time representation.

Type Code Common Usage
-1Timestamp (official)
0-127Application-defined types

Quick Menu

No recent tools