Initial byte and arguments
01The first byte carries a three-bit major type and five-bit additional information.
Type 1 with argument 499 represents −500.
Key idea: Small arguments 0–23 are inline; larger values use following bytes.
Rules & examples
Small arguments 0–23 are inline; larger values use following bytes.
- Small arguments 0–23 are inline; larger values use following bytes.
- Major types distinguish integers, strings, containers, tags, and simple/float values.
- Negative integers use value −1 minus the unsigned argument.
Examples are illustrative. Consult the linked RFC and its errata for implementation details.
Sources
New to this? Start hereA quick picture + helpful background
First, agree how to read the message.
An encoding tells a reader how to interpret bytes. A format tells it how values fit together. Correctly reading a value does not make that value trustworthy.
Helpful first, if these ideas are unfamiliar
These pictures are analogies to help you learn. The linked RFC explains the actual rules.
Related RFCs and changes
“Updates” changes part of an earlier RFC. “Obsoletes” replaces it. This list shows selected related documents.
The new specification keeps full format compatibility, corrects errata, and clarifies deterministic encoding. It explicitly does not create a new CBOR format version.
Read the updated RFC section ↗