This page follows RFC 8949 (December 2020), read 2026-11-12, which obsoletes RFC 7049 while keeping full compatibility with its interchange format; it does not create a new version of the format. Tag numbers follow the IANA CBOR Tags registry, read 2026-11-12.
Initial byte
Bits 7–5 are the major type; bits 4–0 the additional information:
| Additional information | Meaning |
|---|---|
| 0–23 | The argument is this value. |
| 24, 25, 26, 27 | The argument follows in 1, 2, 4 or 8 bytes, big-endian. |
| 28, 29, 30 | Reserved; not well-formed. |
| 31 | Indefinite length (major types 2–5), or the break code (major type 7). Not well-formed with major types 0, 1 and 6. |
| Major type | Meaning of the argument | Content |
|---|---|---|
| 0 | The unsigned integer itself | None |
| 1 | n: the value is −1 − n | None |
| 2 | Length in bytes | A byte string |
| 3 | Length in bytes | UTF-8 text |
| 4 | Number of items | That many data items |
| 5 | Number of pairs | Key and value items |
| 6 | Tag number | One data item, the tag content |
| 7 | Simple value or float | See below |
Major type 7
| Additional information | Byte | Meaning |
|---|---|---|
| 0–19 | E0–F3 | Simple values 0–19, unassigned |
| 20 | F4 | false |
| 21 | F5 | true |
| 22 | F6 | null |
| 23 | F7 | undefined |
| 24 | F8 | Simple value 32–255 in the next byte (values below 32 here are not well-formed) |
| 25 | F9 | Half-precision float (2 bytes) |
| 26 | FA | Single-precision float (4 bytes) |
| 27 | FB | Double-precision float (8 bytes) |
| 28–30 | FC–FE | Reserved |
| 31 | FF | Break: ends an indefinite-length item |
Indefinite lengths
- Byte and text strings (
5F,7F): a series of definite-length chunks of the same major type, thenFF. - Arrays (
9F) and maps (BF): items untilFF; a map must have an even number of items.
Deterministic encoding
RFC 8949 section 4.2.1 defines the core deterministic encoding requirements (RFC 7049 called its earlier form “Canonical CBOR”): integers, lengths and tags in the shortest form; floats in the shortest form that keeps the value; no indefinite lengths; and map keys sorted in bytewise lexicographic order of their deterministic encodings. Protocols that want a deterministic format can build on these requirements.
A2 61 61 01 61 62 82 02 03 {"a": 1, "b": [2, 3]} (RFC 8949 appendix A)