Tooleux

MessagePack Encoder and Decoder

Encode JSON to MessagePack, or decode MessagePack hex/base64 back to JSON.

Runs in your browser. Nothing leaves your device.
Encode JSON to MessagePack and decode MessagePack to JSON. Hex or base64, size comparison, native binary and timestamp handling. Runs in your browser. Read more Show less

What is MessagePack?

MessagePack is a binary serialization format. It encodes the same values as JSON (strings, numbers, booleans, null, arrays, objects) using a compact binary representation. Unlike JSON, it also supports native binary blobs, timestamps, and 64-bit integers.

It is used by Redis, NATS, Logstash, Fluentd, and many RPC frameworks. For inter-service communication it is faster to parse than JSON and smaller for structured data with many short keys. For human-readable config files, JSON is the better choice.

How to use

Paste JSON to encode, or paste hex / base64 bytes to decode. Direction is detected automatically from the first non-whitespace character: { or [ means JSON, otherwise binary.

Two encodings are supported for the binary side:

  • Hex - two characters per byte. Easier to read, matches most protocol dumps.
  • Base64 - compact, matches how MessagePack is usually embedded in JSON payloads or URLs.

MessagePack is not always smaller than JSON

A common misconception is that MessagePack always saves space. It does not. The encode output shows the actual sizes and ratio, and for small objects it often grows:

  • {"a":1} is 7 bytes as JSON, 3 bytes as MessagePack - 57% smaller.
  • {"compact":true,"schema":0} is 28 bytes as JSON, 18 bytes as MessagePack - 36% smaller.
  • null is 4 bytes as JSON, 1 byte as MessagePack - 75% smaller.

The reason to use MessagePack is parse speed and native binary types, not compression. If you need compression, use GZIP or Brotli on top of either format.

FAQ

What is the difference between MessagePack and CBOR?

Both are binary JSON serializers with the same goals. CBOR has broader support for standard extension types (dates, decimals, tags) and is standardized in RFC 8949. MessagePack is slightly smaller for simple data and has more mature libraries. Either works for most use cases.

How are binary values handled?

MessagePack supports native binary types. When decoding, binary values appear as {"$binary": "hex", "$length": N} so they survive JSON round-trips without being silently corrupted.

How are timestamps handled?

MessagePack has a native timestamp extension. When decoding, timestamps appear as {"$date": "ISO 8601 string"}. When encoding, standard ISO strings are treated as plain strings, not timestamps.

Does the tool support the timestamp extension on encode?

No. Encoded JSON does not contain MessagePack-specific types. If you need to emit a native timestamp, use the library directly. The tool focuses on JSON-to-MessagePack and MessagePack-to-JSON, which covers the vast majority of debugging use cases.

Is my data sent anywhere?

No. Encoding and decoding run entirely in your browser.

Command line equivalent
# Python (msgpack)
pip install msgpack
python3 -c "import msgpack,sys,json; print(msgpack.packb(json.loads(sys.stdin.read())).hex())" < input.json

# Node (@msgpack/msgpack)
npm i @msgpack/msgpack
node -e "const {encode}=require('@msgpack/msgpack');console.log(Buffer.from(encode(JSON.parse(process.argv[1]))).toString('hex'))" '{"a":1}'

# Ruby (msgpack)
gem install msgpack
ruby -rmsgpack -e 'puts MessagePack.pack(JSON.parse(ARGF.read)).unpack1("H*")' < input.json

# msgpack-tools (C)
msgpack2json < input.msgpack
json2msgpack < input.json
Loads a test value into the form
Input (JSON or binary)
Output