CBOR converter
What is a Cbor Converter?
CBOR (Concise Binary Object Representation, RFC 8949) is a binary data format with a data model similar to JSON: numbers, strings, arrays, maps, booleans and null, plus byte strings and tags. It is smaller and faster to parse than JSON, which makes it popular for constrained IoT devices, WebAuthn passkeys, COSE signatures and EU digital certificates.
How to use it
- Paste CBOR data as hex to decode it into JSON.
- Or paste JSON to encode it as CBOR hex.
- Copy the result.
How CBOR is structured
Every item starts with an initial byte whose top 3 bits are the major type and whose low 5 bits hold a small value or the length. Major types are: 0 unsigned integer, 1 negative integer, 2 byte string, 3 text string, 4 array, 5 map, 6 tag and 7 simple values and floats.
Example
The JSON { 'a': 1, 'b': [2, 3] } (with double quotes in real JSON) encodes to A2 61 61 01 61 62 82 02 03, 9 bytes. A2 is a map with 2 pairs, 61 61 is the 1-character text string a, 01 is the integer 1, and 82 02 03 is an array of 2 items, 2 and 3. The JSON text is 17 bytes, so CBOR is about half the size here.
Where you will see CBOR
- WebAuthn and passkeys: attestation objects and public keys are CBOR.
- COSE: signed and encrypted messages built on CBOR.
- CoAP and IoT telemetry.
Byte strings and tags have no direct JSON equivalent, so they are shown as hex or annotated values when decoded.
Frequently Asked Questions
Is CBOR the same as MessagePack?
They are similar compact binary formats with JSON-like data models, but they use different encodings and are not compatible.
Why does decoded CBOR show hex values?
CBOR supports raw byte strings, which JSON cannot represent directly, so they are shown as hex.
Where is CBOR used?
In WebAuthn and passkeys, COSE signatures, IoT protocols such as CoAP, and digital health certificates.
What are CBOR tags?
Tags add meaning to a value, for example tag 1 marks an epoch timestamp and tag 32 marks a URI.