Binary Format Decoder
Decode MessagePack, CBOR and BSON in your browser with exact byte spans, binary and extension types, 64-bit integers, item streams, diagnostics and JSON export.
Data is processed only in your browser{
"$document": [
[
"name",
"DevKit"
],
[
"active",
true
],
[
"score",
21.5
],
[
"tags",
[
"0",
"mqtt",
"1",
"binary"
]
],
[
"blob",
{
"$binary": "AP8QIA==",
"subtype": 0
}
]
]
}Binary, 64-bit integers, maps, extensions, CBOR tags and BSON special types use explicit wrappers so no type or precision is silently lost. This JSON is for inspection, not re-encoding.
How to use
Binary Format Decoder reads MessagePack, CBOR and BSON in one page, with no schema required. It restores integers, floats, strings, binary values, arrays, maps, nested documents, extensions and each format's special types into a decoded tree. Every node keeps its exact [start, end) byte range; hover or click either pane and the matching bytes or node highlight in sync.
How to use: paste hex or Base64, or upload a binary file up to 2 MB. Auto mode tries all three formats and lists every candidate that consumes the whole input; it never guesses away ambiguity. Pin MessagePack, CBOR or BSON manually when you know the format. Consecutive MessagePack objects, CBOR Sequence items and BSON documents appear in an item overview. Select one to copy its typed JSON or download the exact original bytes.
What each format restores
| Format | Structure | Special values |
|---|---|---|
| MessagePack | Integer widths, float32 / float64, str, bin, Array and Map | Extension type ids, Timestamp extension, full uint64 / int64 |
| CBOR | All major types, definite and indefinite containers, chunked strings and tags | RFC 3339 time tags, Bignum tags, Simple Values and float16 |
| BSON | Ordered documents, nested documents, arrays, strings and binary subtypes | ObjectId, Decimal128, Timestamp, Regex, Code w/ scope, MinKey and MaxKey |
Auto-detection and ambiguity
Auto mode does not decide from the first byte alone: it parses the entire buffer as each format. Only an error-free parse that consumes every byte is marked complete. If several formats fit, the page says so and shows every candidate. Hex 01, for example, is both a MessagePack and a CBOR positive integer. BSON length and terminator structure, CBOR tags and indefinite encodings, and MessagePack extensions raise a candidate's priority without hiding other complete matches.
Typed JSON and precision
JavaScript Number cannot represent every 64-bit integer, and plain JSON cannot directly carry binary data, maps, extensions or special BSON values. The report therefore uses explicit wrappers: large integers stay decimal strings, binary uses Base64, maps use key/value arrays, extensions retain their type id, CBOR tags retain their tag number, and BSON special types have their own markers. NaN and Infinity use a $float wrapper. This JSON is for inspection and archiving, not re-encoding.
Item streams, errors and limits
MessagePack can concatenate objects, CBOR Sequence can concatenate data items, and BSON can concatenate complete documents. The overview lists each boundary. When a BSON element is malformed but the declared document length is reliable, the tool keeps fields decoded before the break and continues with later documents. MessagePack and CBOR stop at the error when no reliable next boundary exists instead of guessing.
Input is limited to 2 MB, 20,000 items, 50,000 tree nodes and 256 nesting levels. The item list, tree and hex map are paginated. Reaching a limit is reported as a partial decode. Duplicate map keys produce warnings; invalid UTF-8, reserved type bytes, truncated lengths, unknown BSON element types and bad terminators produce errors. Every diagnostic jumps to its bytes.
Privacy and boundaries
Inputs, files and results stay in the current browser's memory and are never uploaded or added to the address bar automatically. Only “Share link” copies a link containing the original content (up to 6,000 bytes); do not use it for sensitive data. The tool checks binary wire structure, not business schemas, signatures, permissions or provenance, and it does not provide an encoder.
Frequently asked questions
Which binary formats are supported?
MessagePack, CBOR and BSON, all without a schema. Consecutive MessagePack objects, CBOR Sequence items and BSON documents are listed separately with item numbers and exact byte boundaries.
Is auto-detection reliable?
Auto mode tries all three formats and lists only error-free results that consume the entire input as complete candidates. Some bytes legitimately fit more than one format — 01 is both a MessagePack and a CBOR integer — so ambiguity and every candidate are shown instead of guessed away. Pin a format manually when you know it.
Are 64-bit integers, binary data and special types preserved?
Yes. The tree keeps the exact type and value. JSON export uses explicit wrappers for binary, extensions, CBOR tags and BSON ObjectId, Decimal128 and Timestamp values; integers outside JavaScript's safe range become decimal strings. NaN and Infinity are never silently turned into null.
Can the exported JSON be encoded back to binary?
No. Typed JSON is an inspection report, not a universal serializer. Maps use key/value arrays to retain duplicate and non-string keys, and BSON documents retain field order. Use an official library in your language when you need to encode the value again.
Is my data uploaded?
No. Parsing, diagnostics, copy and export all run in the current browser. Neither files nor inputs are sent to a server or added to the address bar automatically. Only “Share link” copies a link containing the original content (up to 6,000 bytes), so use it only for non-sensitive data.