Skip to content

Menu

CBOR Decoder

Decode CBOR hex or base64 to RFC 8949 diagnostic notation and JSON, or encode JSON to CBOR, with a byte-by-byte breakdown. Runs in your browser.

Runs entirely in your browserEncodingFree, no sign-up
Loading tool

01What is CBOR Decoder?

CBOR shows up in places where JSON is too heavy: CoAP sensors, COSE keys, CWT tokens and WebAuthn data. It is compact, but a hex dump of it tells you almost nothing. CBOR Decoder turns Concise Binary Object Representation bytes into text you can read, and it turns JSON into CBOR too. Paste CBOR as hex or base64, and you get three views: RFC 8949 diagnostic notation, a JSON version and a byte-by-byte breakdown. The decoder follows RFC 8949. Each data item starts with an initial byte. The top three bits give the major type: unsigned integer, negative integer, byte string, text string, array, map, tag, or simple value and float. The low five bits are the additional information. Values 0 to 23 hold the argument directly, and 24 to 27 mean it follows in 1, 2, 4 or 8 bytes. Value 31 marks an indefinite length for strings, arrays and maps, or the break code that ends one. Values 28 to 30 are reserved, so the tool reports them as not well-formed. Floats are read in all three sizes. Half-precision floats use the decoder from Appendix D of the RFC, and single and double floats use the standard IEEE 754 layouts. Diagnostic notation writes NaN, Infinity and -Infinity by name. An optional switch adds the encoding indicators _1, _2 and _3, so you can see whether a value was sent as a half, single or double float. Indefinite arrays and maps show as [_ ...] and {_ ...}, and chunked strings as (_ h'0102', h'030405'). Simple values 20 to 23 show as false, true, null and undefined, and others as simple(n). The breakdown names common tags, such as 0 for a date string, 1 for epoch time, 2 for a bignum and 55799 for self-described CBOR. A worked example from the RFC: a26161016162820203 starts with a2, a map of 2 pairs. Then 6161 is the text "a" and 01 is the integer 1. Then 6162 is "b", and 82 starts an array of two items, 02 and 03. The diagnostic notation is {"a": 1, "b": [2, 3]}. The JSON to CBOR direction writes the shortest form for each value. Integers use the smallest argument size, and a float uses whichever of half, single or double precision keeps it exact. So 1.5 becomes f93e00, while 1.1 needs the full 9-byte double. There are limits. The JSON view loses detail: byte strings become base64url text, tags are dropped, and undefined and non-finite floats become null. JSON cannot tell 1.0 from 1, so 1.0 is encoded as the integer 1. The tool does not check tag content or sort map keys for deterministic encoding. Nothing is uploaded.

IoT and embedded developers, security engineers working with COSE, CWT or WebAuthn, and anyone writing or testing a CBOR library. The tool runs entirely in your browser, so your data never leaves your device.

02How to use CBOR Decoder

  1. Choose CBOR to diagnostic / JSON, or JSON to CBOR
  2. Paste CBOR as hex or base64, or paste JSON when encoding
  3. Read the diagnostic notation for an exact view of the data, including tags and float sizes
  4. Use the byte-by-byte breakdown to see each initial byte, its offset and its meaning
  5. Copy any view with its Copy button

03Worked examples

Input: a26161016162820203
Result: Diagnostic: {"a": 1, "b": [2, 3]} JSON: {"a":1,"b":[2,3]} 0 a2 map (2 pairs) 1 6161 text string (1 bytes): "a" 3 01 unsigned int: 1 4 6162 text string (1 bytes): "b" 6 82 array (2 items) 7 02 unsigned int: 2 8 03 unsigned int: 3
An example from RFC 8949 Appendix A.
Input: 84 f9 3c 00 fa 47 c3 50 00 fb 3f f1 99 99 99 99 99 9a 39 03 e7
Result: Diagnostic: [1.0, 100000.0, 1.1, -1000] With indicators: [1.0_1, 100000.0_2, 1.1_3, -1000] JSON: [1,100000,1.1,-1000]
Half, single and double floats, then a negative integer with a 2-byte argument.
Input: bf 61 61 9f 01 f9 3e 00 ff 61 62 7f 62 68 69 61 21 ff 61 74 c1 1a 51 4b 67 b0 ff
Result: Diagnostic: {_ "a": [_ 1, 1.5], "b": (_ "hi", "!"), "t": 1(1363896240)} With indicators: {_ "a": [_ 1, 1.5_1], "b": (_ "hi", "!"), "t": 1(1363896240)} JSON: {"a":[1,1.5],"b":"hi!","t":1363896240}
Indefinite map, array and text string, a half float and an epoch time tag.
Input: a2 01 c2 49 01 00 00 00 00 00 00 00 00 20 44 de ad be ef
Result: Diagnostic: {1: 2(h'010000000000000000'), -1: h'deadbeef'} JSON: {"1":"AQAAAAAAAAAA","-1":"3q2-7w"} 2 c2 tag 2 (unsigned bignum)
Byte strings become base64url and the tag disappears in JSON. Breakdown trimmed to the tag line.
Input: 83 01 02
Result: Error: array at byte 0 claims more items than bytes remain.
The header promises 3 items but only 2 follow.
Input: {"a": 1.5, "b": [true, null]}
Result: a26161f93e00616282f5f6
JSON to CBOR. 1.5 fits in a half float, so it takes 3 bytes.

04Common use cases

  • Reading CBOR payloads from IoT devices that talk CoAP
  • Inspecting COSE keys, CWT tokens or WebAuthn data at the byte level
  • Checking that an encoder picks the shortest integer and float forms
  • Making small CBOR test vectors from JSON for unit tests
  • Finding the exact byte where a truncated or malformed message breaks
  • Spotting bignum tags or byte strings that a JSON-only logger has been mangling

05Tips

  • Turn on encoding indicators to see if a float was sent wider than it needed to be.
  • Diagnostic notation keeps byte strings, tags and integer map keys that the JSON view loses, so use it when precision matters.
  • A d9d9f7 prefix is tag 55799, which only marks the data as CBOR and can be ignored.
  • An error like "claims more items than bytes remain" usually means the payload was cut off in transit or copied short.
  • Spaces and line breaks in hex input are fine, so you can paste straight from a packet capture.

06Related concepts

CBOR, RFC 8949, diagnostic notation, COSE, CoAP, IEEE 754 half precision.

Frequently Asked Questions

What is CBOR Decoder?

CBOR Decoder is a free, browser-based developer tool on AIDToolStack. Decode CBOR hex or base64 to RFC 8949 diagnostic notation and JSON, or encode JSON to CBOR, with a byte-by-byte breakdown. Runs in your browser. It requires no installation or sign-up and works entirely in your browser.

Is CBOR Decoder free to use?

Yes. No sign-up, no fees and no usage cap.

Does CBOR Decoder store my data?

No. It runs in your browser; nothing is uploaded.

Related Tools

Reviews and commentsShow

Reviews

Sign in to leave a review.

Loading reviews…

Comments

Sign in to leave a comment.

Loading comments…

What changed in AI dev tools, once a month

Renames, shutdowns, pricing changes and new MCP setups, each with a source.

Subscribe