Guide
MessagePack bytes to JSON and back
MessagePack describes the same data as JSON — null, booleans, numbers, strings, arrays and maps — but writes it as bytes, with the type and often the length packed into the first byte of each value. It is used by RPC systems, caches, game servers and scripting engines that want compact messages without a schema. When you meet one in a log, a socket capture or a Redis value, you see hex. This page reads it back as JSON and can write JSON as MessagePack.
How the format works
Every value starts with a type byte. Small positive integers from 0 to 127 are a single byte equal to the number. A string up to 31 bytes long starts with 0xa0 plus its length, followed by its UTF-8 bytes. A map with up to 15 entries starts with 0x80 plus the count and is followed by the keys and values alternately. Larger values use longer forms that carry the length in one, two or four bytes. null, false and true are the single bytes 0xc0, 0xc2 and 0xc3.
Using the page
Pick a direction. For decoding, paste hexadecimal (spaces, 0x and commas are ignored) or Base64, which the page tells apart on its own, or open a file of up to 2 MB. The JSON appears on the right with a byte count. For encoding, paste JSON, choose hexadecimal or Base64 output, and copy the bytes. Errors, such as a message that ends in the middle of a string or an unused type byte, are reported with the offset where they occurred.
Numbers and special values
JSON numbers have no size limit in the text, but MessagePack integers are 8 to 64 bits wide. A 64-bit integer can be larger than a JavaScript number can hold exactly, so values beyond 2 to the 53rd power are shown as strings. Floating-point numbers are read in single and double precision. Binary data, which JSON cannot represent, appears as an object with a $binary key holding the hex. Extension types, used for timestamps and application-defined values, appear as an object with $ext (the type number) and data.
Size compared with JSON
MessagePack is usually smaller than JSON text for data with many numbers and short strings, because it avoids quotes, commas and digits spelled out in text. It saves little when the data is mostly long strings. The page reports the byte count of the binary form so you can compare it with the JSON you started with. When encoding, each value uses the smallest form that holds it, which is what the specification recommends.
A worked example
The Sample button loads 82 a7 63 6f 6d 70 61 63 74 c3 a6 73 63 68 65 6d 61 00, 18 bytes. The first byte 0x82 starts a map with two entries. a7 is a 7-character string, “compact”, and c3 is true; a6 is a 6-character string, “schema”, and 00 is the integer 0. The JSON is {“compact”: true, “schema”: 0}. Encoding the object {“id”: 7, “ok”: true, “tags”: [“a”, “b”]} gives 83a2696407a26f6bc3a47461677392a161a162, which is 19 bytes against 35 characters for the same JSON written without spaces.
Limits
Map keys that are not strings, which MessagePack allows, cannot be JSON keys, so they are shown as text. Timestamps in the standard extension are shown as raw extension data, not as dates. The page handles one message at a time, and a stream of several messages must be split first. Round-tripping binary or extension values may not return the original bytes, since JSON cannot hold them natively.
Related tools
- CBOR to JSON does the same for the CBOR format.
- Base64 Encoder converts the Base64 text that often carries such payloads.
- JSON Formatter checks and formats the JSON you want to encode.
- Hex to Binary lets you look at the bits of a type byte.
Checked against the current version of the MessagePack to JSON on .

