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.
Content rules for the RFC 8949 tags
- Tag 0 content is a text string in RFC 3339 form; tag 1 is an integer or a float of seconds since 1970-01-01T00:00Z (floats give fractions, and need binary64 except near 1970). Writing NaN or Infinity inside tag 1 is discouraged: use an untagged
nullorundefined, which is shorter. - Tags 2 and 3 (bignums): a byte string read as an unsigned integer n in network order; tag 2 is n, tag 3 is −1 − n. Preferred form omits leading zeros (zero is the empty string), but decoders must accept leading zeros, and an integer that fits major type 0 or 1 is preferably not a bignum. 264 is
C2 49 01 00 00 00 00 00 00 00 00. - Tags 4 and 5: an array of exactly two items: an exponent e of major type 0 or 1 and a mantissa m (an integer or a bignum). A decimal fraction is m×10e (273.15 is
C4 82 21 19 6AB3), a bigfloat m×2e (1.5 isC5 82 20 03). They cannot hold Infinity or NaN; use a half-precision float for those. - Tags 21, 22, 23 hint at base64url, base64 or base16 when converting to JSON; 24 is a byte string holding an encoded CBOR item; 32, 33, 34, 36 are text: URI, base64url, base64, MIME message; 55799 is the self-describe tag
D9 D9 F7. - Tag 35 (regular expression, text) was defined in RFC 7049 and is kept in the registry with that reference.
- Floats and NaN. Preferred serialisation uses the shortest float that keeps the value (
F9 4580is 5.5,FA 45AD9C00is 5555.5). A shorter NaN is preferred if zero-padding its significand reproduces the original NaN (usually justF9 7E00); the quiet NaN is alsoFA 7FC00000orFB 7FF8000000000000. Infinity isF9 7C00. - Definite lengths are preferred when the length is known when encoding starts.
- Sequences (RFC 8742): several items one after another, with no enclosing array, are a CBOR sequence; tag 63 wraps one in a byte string, and the media type is
application/cbor-seq.
Diagnostic notation (RFC 8949 section 8 and RFC 8610 appendix G)
A human-readable notation for talking about CBOR items; it is not meant to be parsed and has no formal grammar in RFC 8949.
- JSON syntax for numbers,
true,false,null, UTF-8 strings, arrays and maps (maps allow any item as key).undefined;Infinity,-Infinity,NaN;simple(42)for unassigned simple values; a tag is its number followed by the content in parentheses,0("2013-03-21T20:04:00Z"),1(1363896240). - Byte strings: base16
h'12345678', base32b32'CI2FM6A', base32hexh32'...', base64 or base64urlb64'EjRWeA', all without padding. - Encoding indicators:
_and following alphanumerics are optional and ignorable.[_ 1, 2]or{_ ...}marks indefinite length;_nafter an item says it was encoded with additional information 24+n (1.5_1half,1.5_3double;_7is written as_instead). Indefinite strings with chunks are(_ h'0123', h'4567')or(_ "foo", "bar"); with no chunks''_and""_(and chunks that are empty strings are written(_ '')). - Extended Diagnostic Notation (RFC 8610 appendix G): whitespace ignored inside prefixed byte strings; unprefixed single quotes for UTF-8 text bytes (
'hello world');<< items >>for a byte string holding the encoded items (<<1, 2>>ish'0102',<<>>ish''); adjacent strings separated by whitespace concatenate (and may mix text and byte-string notation, but a comma breaks it); numbers in hexadecimal0x, octal0o, binary0band hexadecimal floats0x1.8p0; comments between slashes/ ... /, counted as whitespace.
CDDL (RFC 8610)
The Concise Data Definition Language describes CBOR (and JSON) structures. Read from RFC 8610 appendices B and D and sections 3 and 6.1 (2026-11-13); the ABNF is the normative syntax.
cddl = S 1*(rule S)
rule = typename [genericparm] S assignt S type
/ groupname [genericparm] S assigng S grpent
assignt = "=" / "/=" assigng = "=" / "//="
genericparm = "<" S id S *("," S id S ) ">"
genericarg = "<" S type1 S *("," S type1 S ) ">"
type = type1 *(S "/" S type1)
type1 = type2 [S (rangeop / ctlop) S type2]
type2 = value / typename [genericarg] / "(" S type S ")"
/ "{" S group S "}" / "[" S group S "]"
/ "~" S typename [genericarg]
/ "&" S "(" S group S ")" / "&" S groupname [genericarg]
/ "#" "6" ["." uint] "(" S type S ")"
/ "#" DIGIT ["." uint] ; major/ai
/ "#" ; any
rangeop = "..." / ".." ctlop = "." id
group = grpchoice *(S "//" S grpchoice)
grpchoice = *(grpent optcom)
grpent = [occur S] [memberkey S] type
/ [occur S] groupname [genericarg]
/ [occur S] "(" S group S ")"
memberkey = type1 S ["^" S] "=>" / bareword S ":" / value S ":"
optcom = S ["," S]
occur = [uint] "*" [uint] / "+" / "?"
uint = DIGIT1 *DIGIT / "0x" 1*HEXDIG / "0b" 1*BINDIG / "0"
value = number / text / bytes
number = hexfloat / (int ["." fraction] ["e" exponent ])
text = %x22 *SCHAR %x22 bytes = [bsqual] %x27 *BCHAR %x27
bsqual = "h" / "b64"
id = EALPHA *(*("-" / ".") (EALPHA / DIGIT)) EALPHA = ALPHA / "@" / "_" / "$"
S = *WS WS = SP / NL NL = COMMENT / CRLF COMMENT = ";" *PCHAR CRLF
- Rules:
name = typedefines a type,name = (group)a group;/=and//=extend a type choice or group choice (sockets). By convention extension points start with$(types) or$$(groups). The first rule is the root. - Occurrence in front of a group entry:
?optional,*zero or more,+one or more,n*mwith optional bounds; none means exactly once. Maps cannot repeat a key whatever the occurrence says. - Member keys:
bareword:andvalue:are literal keys;type =>is a type key (^before=>marks a cut: a key that matches here cannot match later entries). - Representation types
#major[.ai]and#6.nnn(type)for tags,#7.25to#7.27for floats;~nameunwraps a named array, map or tag type to its group or content;&(...)turns a group into a choice of its member values. - Controls (
target .op controller; IANA registry of control operators):.size(byte length of a string, or uint below 256N),.bits(only listed bit positions may be set; bit n of a string isstr[n>>3] & (1<<(n&7))),.regexp(an XSD regular expression),.cborand.cborseq(a byte string holding one CBOR item, or a sequence taken as an array),.withinand.and(intersection;.withinintends the left side to be a subset of the right),.lt,.le,.gt,.ge(numbers),.eq,.ne(any equal values: strings bytewise, arrays and maps pairwise, tagged values with the same tag, integers and floats distinguished inside containers) and.default(like.nebut meaning a default value, meaningful in optional contexts). RFC 9090 adds.sdnv,.sdnvseqand.oid.
The standard prelude (appendix D), automatically appended to every file:
any = # uint = #0 nint = #1 int = uint / nint
bstr = #2 bytes = bstr tstr = #3 text = tstr
tdate = #6.0(tstr) time = #6.1(number) number = int / float
biguint = #6.2(bstr) bignint = #6.3(bstr) bigint = biguint / bignint
integer = int / bigint unsigned = uint / biguint
decfrac = #6.4([e10: int, m: integer]) bigfloat = #6.5([e2: int, m: integer])
eb64url = #6.21(any) eb64legacy = #6.22(any) eb16 = #6.23(any)
encoded-cbor = #6.24(bstr) uri = #6.32(tstr) b64url = #6.33(tstr)
b64legacy = #6.34(tstr) regexp = #6.35(tstr) mime-message = #6.36(tstr)
cbor-any = #6.55799(any)
float16 = #7.25 float32 = #7.26 float64 = #7.27
float16-32 = float16 / float32 float32-64 = float32 / float64
float = float16-32 / float64
false = #7.20 true = #7.21 bool = false / true
nil = #7.22 null = nil undefined = #7.23
The prelude is fixed: tags registered later (such as 37 for UUIDs, buuid = #6.37(bstr)) must be defined in each file. There is no type string, since text and byte strings differ. Other parts of RFC 8610 (matching rules in appendix C, use with JSON in appendix E, the PEG grammar in appendix A, generics in section 3.10) were not reproduced.
The IANA tag registry
The CBOR Tags registry (last updated 2026-11-09, read 2026-11-13) holds the assignments. Rules: 0–23 Standards Action; 24–32767 Specification Required; 32768 up to 264−1 First Come First Served; every request carries the RFC 8949 template. Tags 65535, 4294967295 and 18446744073709551615 are always invalid (to catch uninitialised values). Entries marked “(TEMP)” expire. The listing is the registry's: tag, data item, meaning, reference.
| Tag | Data item | Meaning | Reference |
|---|---|---|---|
| 0–5 | see above | Date/time string, epoch time, bignums, decimal fraction, bigfloat | RFC 8949 |
| 6–15, 20 | Unassigned | ||
| 16, 17, 18, 19 | COSE | COSE_Encrypt0, COSE_Mac0, COSE_Sign1, COSE_Countersignature | RFC 9052, RFC 9338 |
| 21–24, 32–34, 36 | Encoding hints, encoded CBOR, URI, base64url, base64, MIME message | RFC 8949 | |
| 25, 28, 29, 256 | uint; any; uint; any | String references (nth previously seen string) and value sharing (mark a value as shared; reference the nth marked value); 256 marks a value as having string references | cbor.schmorp.de (Marc A. Lehmann) |
| 26, 27 | array | Serialised Perl object (class name and constructor arguments); language-independent object | cbor.schmorp.de |
| 30 | array | Rational number | Peter Occil |
| 31 | undefined (F7) | Absent value in an array | Sami Vaarala |
| 35 | text | Regular expression | RFC 7049 |
| 37 | byte string | Binary UUID (RFC 9562 section 4) | Lucas Clemente |
| 38 | array | Language-tagged string | RFC 9290 appendix A |
| 39 | multiple | Identifier | Lucas Clemente |
| 40, 1040 | array of two arrays | Multi-dimensional array, row-major (40) or column-major (1040) | RFC 8746 |
| 41 | array | Homogeneous array | RFC 8746 |
| 42 | byte string | IPLD content identifier | Volker Mische |
| 43–47 | text, uint, array | YANG bits, enumeration, identityref, instance-identifier, and schema item identifier (sid) | RFC 9254 |
| 48, 1048 | byte string | IEEE MAC address; IEEE OUI/CID | RFC 9542 |
| 52, 54 | byte string or array | IPv4, [prefixlen, IPv4], [IPv4, prefixpart]; IPv6 likewise | RFC 9164 |
| 58, 60, 62 | any, byte string, uint | Selective-disclosure markers: a redacted claim element or map key, a redacted array element, a decoy location (all TEMPORARY, expiring) | draft-ietf-spice-sd-cwt |
| 61 | CWT | CBOR Web Token | RFC 8392 |
| 63 | byte string | Encoded CBOR sequence (RFC 8742) | draft-bormann-cbor-notable-tags |
| 64–87 | byte string | Typed arrays: 64 uint8; 65, 66, 67 uint16, uint32, uint64 big-endian; 68 uint8 clamped; 69, 70, 71 uint16, uint32, uint64 little-endian; 72 sint8; 73, 74, 75 sint16, 32, 64 big-endian; 76 reserved; 77, 78, 79 sint16, 32, 64 little-endian; 80, 81, 82, 83 IEEE 754 binary16, 32, 64, 128 big-endian; 84, 85, 86, 87 the same little-endian | RFC 8746 |
| 96, 97, 98 | COSE | COSE_Encrypt, COSE_Mac, COSE_Sign | RFC 9052 |
| 99 | array | CRI reference | draft-ietf-core-href |
| 100, 1004 | integer; text | Days since 1970-01-01; RFC 3339 full-date string | RFC 8943 |
| 101, 121–127, 1280–1400 | array, any | Alternatives (the tag number selects one of several, 1+1 and 1+2 encodings) | draft-bormann-cbor-notable-tags |
| 103, 104, 120 | array, multiple | Geographic coordinates; coordinate reference system (WKT or EPSG); Internet of Things data point | Danilo Vidovic; draft-clarke-cbor-crs; AllThingsTalk |
| 107, 1070 | map | SUIT envelope; SUIT manifest | draft-ietf-suit-manifest |
| 108 | byte string | Expected conversion to lower-case base16 | draft-bormann-cbor-notable-tags |
| 110, 111, 112 | byte string, array or map | Relative OID; object identifier (BER); OID relative to 1.3.6.1.4.1 | RFC 9090 |
| 200, 201 | multiple, any | Gordian Envelope; enclosed dCBOR | drafts by McNally |
| 257–270 | various | Binary MIME message (257); mathematical finite set (258); map with key-value operations (259); network address (260, deprecated), network prefix (261, deprecated); embedded JSON (262); hexadecimal string (263); decimal fraction and bigfloat with arbitrary exponent (264, 265); IRI and IRI reference (266, 267); extended decimal, bigfloat and rational (268, 269, 270) | Occil, Di Napoli, Raju, others |
| 271 | DOTS signal channel object | RFC 9132 | |
| 272, 273, 274 | byte string | Non-UTF-8 CESU-8, WTF-8 and MUTF-8 strings | Sami Vaarala |
| 275–287, 296, 301 | various | Map with only text keys (275); ERIS read capability (276); 3GPP GAD shape and velocity (277, 278); coordinate reference system wrapper (279); symbol, linked list, character, object (280–283); JSON numeric value as text (284); SUIT reports (285–287); shared-value scope isolation (296); geohash string (301) | various |
| 500–599 | various | Earmarked for CoRIM, with assigned entries for CoRIM maps (501, 526, 527), concise SWID and MID tags (505, 506), UEID (550), security version numbers (552, 553), PEM keys and certificate chains (554–556), bit arrays (560) and SPDM evidence (570, 571) | draft-ietf-rats-corim, TCG |
| 601, 602 | map; array | Unprotected CWT claims set; detached EAT bundle | RFC 9781, RFC 9711 |
| 1001, 1002, 1003 | map, map, array | Extended time; duration; period | RFC 9581 |
| 1010 | array | Object type identifier | draft-rundgren-cotx |
| 18300–18811 | byte string, array | Bare hash values for COSE algorithms −256 to −1 (18300–18555) and 1 to 255 (18557–18811); a hash with its algorithm id (18556) | draft-bormann-cbor-notable-tags |
| 20853, 21065, 21066, 21334, 21607, 22098, 25441 | various | Quoted description (20853); I-Regexp (21065); ECMAScript RegExp (21066); programming aid for simple values, always invalid (21334); a CBOR tag identifier (21607); indirection hint (22098); capture (25441) | various |
| 32768–32870+ | various | FHIR constant (32768); external reference (32769); PSA Crypto IPC pointers (32770–32869); logical operators NONE/NOT, ANY, ALL (32870–32872); TLA+ function (33000) | various |
| 40000–40803 | various | The Blockchain Commons ur: types (known value, digest, encrypted, compressed, keys, seeds, HD keys, SSKR, PSBT, SSH texts, ML-KEM and ML-DSA keys, and more) | BCR-2020-006 |
| 40919, 41728–41731, 42600–42602, 43000, 43001, 44252, 46010, 46011 | various | Concordium contract address; fractions (with NaN signalling variants); NATO confidentiality clearance, metadata binding and NCMS metadata; complex numbers (single, interleaved array); metrological value; CRC-32 and MD5 digests | various |
| 50000–50012, 51997, 55003–55005 | various | PlatformV tags; CBOR-LD; USOF references | various |
| 55799, 55800, 55801 | any, tagged byte string | Self-described CBOR; file contains CBOR sequences; file starts with a CBOR-labeled non-CBOR data label | RFC 8949, RFC 9277 |
| 56500, 57342–57599, 60000–60021 | array | Compressed byte string; record-structure definition and reference tags; Intel attestation evidence tags | various |
| 80000–80199, 133133, 14245120–14245220, 15309736, 827539798, 1146111423, 1298360423–1299145044, 1330664270, 1347571280–1347571542, 1398229316, 1413829460, 1463894560, 1482048304–1482048346, 1668546817–1668612095, 1701996915–1701996916, 1735551332, 4294967296 | various | Private ranges; ZeWIF; W3C verifiable-credential proofs; RAINS message; Universal Saves Format; DICE protection environment; MoaT markers; Openswan configuration; Proof of Process packets and provenance mark; CoSWID (1398229316, RFC 9393); explicit none; Xbox virtual containers; content-format-indexed content (RFC 9277); ERIS blocks; PromiseGrid envelope; Intel FPGA SPDM manifest | various |
Everything not listed here is unassigned.
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)