MessagePack / CBOR encoder and decoder
Data conversion
Loading
Loading tool
The tool is loaded only when you open it.
All processing for this tool happens in your browser. Your input is not sent to a server.
About this tool
Encode JSON or typed JSON, and inspect binary data locally without uploading it. Plain JSON integer tokens remain exact; decimals/exponents use binary64 and must round-trip as the same decimal. Use typed JSON for bytes, non-string keys and special values. Decoding always produces typed JSON.
Common uses
- Inspect a local .msgpack or .cbor file without uploading it.
- Convert API test payloads between JSON, typed JSON, Hex and Base64.
- Verify exact 64-bit identifiers, binary fields and non-string map keys.
How to use it
- 1.Choose MessagePack or CBOR and encode or decode.
- 2.For encoding, select plain or typed JSON. For decoding, paste Hex/Base64 or choose a binary file.
- 3.Convert, inspect the complete typed output and copy or download it. Binary download preserves decoded source bytes. Cancel or change any input to discard stale results.
Exact typed-input examples
Example 1 · msgpack
msgpack ["null"]
c0
Select this binary format and Typed JSON encoding. The complete expected Hex output is shown.
Example 2 · cbor
cbor ["null"]
f6
Select this binary format and Typed JSON encoding. The complete expected Hex output is shown.
Example 3 · msgpack
msgpack ["int","9007199254740993"]
cf0020000000000001
Select this binary format and Typed JSON encoding. The complete expected Hex output is shown.
Example 4 · cbor
cbor ["int","18446744073709551615"]
1bffffffffffffffff
Select this binary format and Typed JSON encoding. The complete expected Hex output is shown.
Example 5 · msgpack
msgpack ["bytes","00ff"]
c40200ff
Select this binary format and Typed JSON encoding. The complete expected Hex output is shown.
Example 6 · cbor
cbor ["bytes","00ff"]
4200ff
Select this binary format and Typed JSON encoding. The complete expected Hex output is shown.
Example 7 · msgpack
msgpack ["float","-0"]
cb8000000000000000
Select this binary format and Typed JSON encoding. The complete expected Hex output is shown.
Example 8 · cbor
cbor ["map",[[["int","7"],["str","x"]]]]
a1076178
Select this binary format and Typed JSON encoding. The complete expected Hex output is shown.
Example 9 · msgpack
msgpack ["ext",7,"00ff"]
d50700ff
Select this binary format and Typed JSON encoding. The complete expected Hex output is shown.
Example 10 · cbor
cbor ["tag","2",["bytes","010000000000000000"]]
c249010000000000000000
Select this binary format and Typed JSON encoding. The complete expected Hex output is shown.
Example 11 · cbor
cbor ["undefined"]
f7
Select this binary format and Typed JSON encoding. The complete expected Hex output is shown.
Example 12 · cbor
cbor ["simple",16]
f0
Select this binary format and Typed JSON encoding. The complete expected Hex output is shown.
Example 13 · msgpack
msgpack ["array",[["bool",true],["str","猫"]]]
92c3a3e78cab
Select this binary format and Typed JSON encoding. The complete expected Hex output is shown.
Common input errors
- Duplicate map/object key. No values were discarded.
- Use canonical standard Base64 with required padding.
- Indefinite-length CBOR is not supported.
- Integer exceeds this format’s native integer range. Use a CBOR bignum tag with bytes when appropriate.
- Unsupported map key: only string, integer, bytes, boolean and null are accepted.
Limits and notes
- Binary input/output ≤ 262,144 bytes; text ≤ 1,048,576 UTF-8 bytes; typed output ≤ 2,097,152 bytes. JSON syntax and binary values: depth ≤ 32; ≤ 10,000 values. Five-second worker deadline.
- Map keys: string, integer, bytes, boolean or null only; duplicate keys are rejected. CBOR tags stay opaque (including bignums); MessagePack extension -1 is a validated raw timestamp, 0–127 are opaque. No tag interpretation, indefinite lengths, composite/float keys or multiple concatenated values.
- MessagePack native integers: −2^63 through 2^64−1; CBOR native integers: −2^64 through 2^64−1. For larger CBOR integers use opaque tag 2/3 with a byte string. Integer tuple text is limited to 128 characters.
- Float16/32/64 decode to a binary64 semantic value. Negative zero, NaN and infinities have explicit tuples. Encoding floats uses float64; widths and NaN payload bits are not retained in re-encoded data.
- JSON syntax itself is capped at 32 levels and 10,000 values, including the wrappers in typed JSON. Thus deeply nested typed input can hit this limit before binary depth 32. Outputs over the stated bound are refused, not truncated.
Frequently asked questions
Why is decoded output not ordinary JSON?
JSON has no native bytes, extensions, tags, undefined, NaN or non-string keys. Every value is an explicit typed tuple, so a user object can never accidentally become a control marker.
Are CBOR tags validated or executed?
Tags remain opaque wrappers with their unsigned 64-bit number. Their application-specific meaning and payload validity are not interpreted, including date, bignum, embedded-CBOR, URL and regexp tags. No embedded bytes or code execute.
Can I recover identical encoded bytes?
Download binary after decoding to retain the original bytes. Decode then encode preserves supported semantic values, but may choose different widths or NaN bits. Map pair order remains as entered; canonical encoding is not claimed.
What happens to 0.1?
It is encoded as the nearest binary64 value with an explicit float tuple. Decimal tokens must round-trip through the shortest binary64 decimal without changing their decimal value; excess precision, overflow and nonzero underflow are rejected.
- RFC 8949 · CBOR
- MessagePack specification
- MessagePack JavaScript implementation
- cbor2 JavaScript implementation