What is MessagePack?
MessagePack is a compact binary serialization format that maps directly to JSON-style data — null, booleans, numbers, strings, arrays, and maps. Unlike JSON, it encodes integers and lengths as raw bytes instead of decimal text, so payloads are typically 20–60% smaller and parse faster on the wire. The official spec (msgpack.org) defines the type tags this encoder uses (fixstr, fixarray, uint8/16/32, etc.).
When should I use MessagePack instead of JSON?
Use MessagePack when bandwidth, storage, or parse cost matters and you control both sides of the wire: IoT devices on metered cellular links, MQTT payloads, Redis cache values, gRPC alternatives, mobile-to-server APIs, and game networking. Stick with JSON for public APIs, browser fetches, log files, and config — anywhere debuggability and tooling support matter more than raw bytes.
Why is the output base64 or hex if MessagePack is binary?
MessagePack is raw bytes with no text representation, so to display or paste it you need a text encoding. Base64 packs 3 bytes into 4 ASCII characters (33% overhead) and is the default for transport. Hex doubles the size (2 chars per byte) but is easier to read by hand for debugging. Toggle the format above the output panel.
How much smaller is MessagePack vs JSON?
It depends on the data. Documents heavy in numbers, booleans, and short strings shrink the most — often 30–50% smaller because integers occupy 1–5 bytes instead of decimal text. Documents dominated by long natural-language strings see almost no reduction since strings are stored verbatim. Try the sample above to see the live size delta against the equivalent JSON.
Does this encoder support every MessagePack type?
It covers the JSON-equivalent subset: nil (0xc0), false/true (0xc2/0xc3), positive and negative fixints, uint8/16/32, int8/16/32, float64, fixstr/str8/str16/str32, fixarray/array16/array32, and fixmap/map16/map32. uint64 and int64 outside 32-bit range fall back to float64. Bin types, Ext types, and Timestamp are decode-only — encoding from JSON does not need them because JSON has no native binary or extension representation.
Are floats encoded as float32 or float64?
Always float64 (0xcb). JavaScript numbers are IEEE 754 double-precision internally, so encoding everything as float64 round-trips perfectly without precision loss. If you need float32 to match a hand-tuned protocol from a C client, the Bytes column will read 5 bytes per number; you can patch the encoder to emit 0xca for values whose Math.fround() equals the original.
Does the data leave my browser?
No. The encoder is plain JavaScript running in your tab. Open DevTools → Network and click Encode — there are zero outbound requests. JSON containing API keys, customer IDs, or proprietary schemas never reaches our servers.
How do I decode the output?
Use the companion MessagePack Decode tool — paste the base64 or hex string and it round-trips back to JSON. From code, libraries like @msgpack/msgpack (JS), msgpack-python, msgpack-c, msgpack-rust, and msgpack-java will read the same bytes. Strip the base64/hex wrapper before passing to a binary parser.