CBOR
CBOR (Concise Binary Object Representation) is a binary form of JSON, standardized in RFC 8949, more compact and supporting more data types.
Purpose
To provide a more compact binary encoding than JSON for bandwidth- and storage-constrained scenarios.
Mechanism
Every data item starts with a tag byte: the high 3 bits give the major type (0-7) and the low 5 bits the additional information. Major types 0-2 are unsigned integers, negative integers, and byte strings; 3 is a text string; 4-5 are arrays and maps; 6 is tags (semantic tagging); 7 is floats and simple values. Extension tags support dates, URLs, bignums, and more.
Use cases
- CoAP IoT protocol
- WebAuthn credential data
- IPLD (the IPFS data model)
- Sensor data transport
Examples
- Input
{"a":1}OutputA1 61 61 01CBOR encoding of a one-pair map
Common errors
- Confusing CBOR and MessagePack encoding details
- They differ; parse with each specification
Related terms
JSON
JSON (JavaScript Object Notation) is a lightweight data interchange format based on JavaScript object literals, using key-value pairs and arrays. GLOSSARY
MessagePack
MessagePack is an efficient binary serialization format, similar to JSON but more compact, with multilingual support, used for RPC and caching. GLOSSARY
Protocol Buffers
Protocol Buffers is Google's language-neutral binary serialization format; it requires a .proto schema definition and is more compact and type-safe than JSON/XML. GLOSSARY
Related tools
CBOR Decode
CBOR Decode — pure client-side tool. Decodes real RFC 8949 CBOR binary (hex or base64 input, auto-detected) to pretty JSON. Full major types 0-7: all integers, byte/text strings (incl. indefinite-length), arrays, maps, tags (bignum, dates, URIs), simple values, half/single/double floats. Privacy-first, no server round-trip. TOOL
CBOR Encode
CBOR Encode — pure client-side tool. Encodes JSON into real RFC 8949 CBOR binary, wire-compatible, with deterministic encoding (§4.2.1: shortest int/float forms, map keys sorted length-first then bytewise). Byte strings, tags, bignums and simple values via $bytes/$tag/$bignum/$simple conventions. Output hex (default) or base64. Privacy-first, no server round-trip. TOOL