Skip to content
Hand-written codecs

MessagePack & CBOR Encoder

Encode JSON to MessagePack or CBOR — and decode it back — with a byte-by-byte annotation of every field, the encoded size versus the original JSON size, and format auto-detection. The codecs are implemented here in TypeScript; no library and no network call.

1 · JSON → bytes

Numbers outside the 64-bit range throw instead of silently losing precision. Use {"$bytes":"<base64>"} for a byte string, {"$tag":1,"value":…} for a CBOR tag, and {"$indefinite":[…]} for an indefinite-length CBOR array or map.

JSON
187 B
MessagePack
92 B
CBOR
92 B
Saved vs JSON
51%
MessagePack · 92 bytes· in the breakdown below
86 a2 69 64 2a a4 6e 61 6d 65 ab 50 75 72 65 42 72 6f 77 73 65 72 a5 72 61 74 69 6f ca 3f c0 00 00 a6 62 69 6e 61 72 79 c4 05 68 65 6c 6c 6f a5 66 6c 61 67 73 93 c3 c2 c0 a6 6e 65 73 74 65 64 83 a4 74 69 6e 79 cc ff a3 62 69 67 cf 00 00 00 01 00 00 00 00 a3 6e 65 67 d1 fc 18
base64: hqJpZCqkbmFtZatQdXJlQnJvd3NlcqVyYXRpb8o/wAAApmJpbmFyecQFaGVsbG+lZmxhZ3OTw8LApm5lc3RlZIOkdGluecz/o2JpZ88AAAABAAAAAKNuZWfR/Bg=
CBOR · 92 bytes
a6 62 69 64 18 2a 64 6e 61 6d 65 6b 50 75 72 65 42 72 6f 77 73 65 72 65 72 61 74 69 6f fa 3f c0 00 00 66 62 69 6e 61 72 79 45 68 65 6c 6c 6f 65 66 6c 61 67 73 83 f5 f4 f6 66 6e 65 73 74 65 64 a3 64 74 69 6e 79 18 ff 63 62 69 67 1b 00 00 00 01 00 00 00 00 63 6e 65 67 39 03 e7
base64: pmJpZBgqZG5hbWVrUHVyZUJyb3dzZXJlcmF0aW/6P8AAAGZiaW5hcnlFaGVsbG9lZmxhZ3OD9fT2Zm5lc3RlZKNkdGlueRj/Y2JpZxsAAAABAAAAAGNuZWc5A+c=

Byte-by-byte breakdown — MessagePack

OffsetBytesHexMeaning
0x0000186map fixmap(6)
0x00011a2str fixstr(2)
0x000226964"id" (2 bytes UTF-8)
0x000412apositive fixint 42
0x00051a4str fixstr(4)
0x000646e616d65"name" (4 bytes UTF-8)
0x000a1abstr fixstr(11)
0x000b115075726542726f77736572"PureBrowser" (11 bytes UTF-8)
0x00161a5str fixstr(5)
0x00175726174696f"ratio" (5 bytes UTF-8)
0x001c5ca3fc00000float32 1.5
0x00211a6str fixstr(6)
0x0022662696e617279"binary" (6 bytes UTF-8)
0x00282c405bin 8(5)
0x002a568656c6c6fbin (5 bytes)
0x002f1a5str fixstr(5)
0x00305666c616773"flags" (5 bytes UTF-8)
0x0035193arr fixarray(3)
0x00361c3true
0x00371c2false
0x00381c0nil
0x00391a6str fixstr(6)
0x003a66e6573746564"nested" (6 bytes UTF-8)
0x0040183map fixmap(3)
0x00411a4str fixstr(4)
0x0042474696e79"tiny" (4 bytes UTF-8)
0x00462ccffuint8 255
0x00481a3str fixstr(3)
0x00493626967"big" (3 bytes UTF-8)
0x004c9cf0000000100000000uint64 4294967296
0x00551a3str fixstr(3)
0x005636e6567"neg" (3 bytes UTF-8)
0x00593d1fc18int16 -1000

2 · Bytes → JSON

What is covered

MessagePack

Positive and negative fixint, uint8/16/32/64, int8/16/32/64, float32/float64 (the narrowest that round-trips), fixstr and str8/16/32, bin8/16/32, fixarray and array16/32, fixmap and map16/32, nil, true, false.

CBOR (RFC 8949)

All integer widths, float16/32/64, definite and indefinite byte and text strings, arrays and maps, tags, simple values, null and undefined. Tag 0/1 render as ISO dates, tags 2/3 as bignums.

Note on integers: MessagePack has no native bigint, so values beyond ±2^53 come back as strings. Anything outside the 64-bit range is rejected rather than truncated.

About this tool

This tool encodes JSON into MessagePack and CBOR and decodes both formats back to JSON, using codec implementations written from scratch in TypeScript — no library is bundled or fetched. It annotates every encoded field with its offset, byte length, raw hex and meaning, and reports the encoded size against the original JSON. Everything runs in your browser, so pasted data never leaves the page and the tool works fully offline.

  • 100% free — no account needed
  • Runs in your browser
  • Nothing is uploaded

Frequently asked questions

Is MessagePack & CBOR Encoder really free?

Yes. MessagePack & CBOR Encoder is completely free on PureBrowser — every feature, with no account, no trial, and no credit card.

Does MessagePack & CBOR Encoder upload my data?

No. MessagePack & CBOR Encoder runs entirely inside your browser, so anything you type, paste, or open stays on your own device.

Do I need to sign up or install anything?

Neither. There is no account and nothing to download — open the page and MessagePack & CBOR Encoder is ready to use on desktop or mobile.

Does MessagePack & CBOR Encoder work offline?

Once the page has loaded, yes. All of the processing happens locally in your browser, so it keeps working without a connection.