HomeCBOR Encode/Decode

CBOR Encode/Decode

Online CBOR encode/decode tool with JSON and CBOR conversion, hex, Base64, C-array output, and container length modes for IoT and embedded protocol debugging.

Paste CBOR data captured from packet tools, IoT devices, or API responses.

Click to insert example data

Decoded Result

Enter CBOR data to decode and view result

CBOR Protocol Guide

What is CBOR

CBOR (Concise Binary Object Representation) is a binary serialization format defined by RFC 8949. It keeps compatibility with the JSON data model while providing compact size and efficient parsing for IoT, embedded, and security scenarios.

Binary Structure

Each CBOR item starts with one byte. The top 3 bits represent the major type and the lower 5 bits represent additional information, which can encode small values directly or indicate following length bytes.

Additional InfoMeaning
0-23Value encoded directly in additional info
24Followed by 1-byte unsigned integer
25Followed by 2-byte unsigned integer (big-endian)
26Followed by 4-byte unsigned integer (big-endian)
27Followed by 8-byte unsigned integer (big-endian)
31Indefinite-length container ended by 0xFF

CBOR Data Type Reference

Major TypeType NameHeader BytesDescription
0Unsigned Integer0x00-0x1BNon-negative integers from 0 to 2^64-1
1Negative Integer0x20-0x3BNegative integers from -1 to -2^64
2Byte String0x40-0x5BArbitrary binary byte sequence
3Text String0x60-0x7BUTF-8 encoded text string
4Array0x80-0x9BOrdered collection of data items
5Map0xA0-0xBBKey-value object map
6Tag0xC0-0xDBSemantic tags for extended meaning
7Simple/Float0xE0-0xFBBooleans, null, undefined, and floating numbers

Container Length Modes

Arrays and maps can be encoded with different length modes. They are semantically equivalent but differ at binary level for compatibility and streaming needs.

ModeHeader BytesDescription
CompactA2 ...Minimum-size encoding with compact headers
Explicit 16-bitB9 00 02 ...Always use 2-byte length field
Explicit 32-bitBA 00 00 00 02 ...Always use 4-byte length field
IndefiniteBF ... FFIndefinite containers for streaming writers

CBOR vs JSON

Both formats represent the same logical structure. JSON emphasizes readability, while CBOR emphasizes compactness and processing efficiency.

CBOR Advantages
  • Smaller payload size and lower network overhead
  • Native support for binary data
  • Usually faster encoding and decoding
  • Semantic tags for richer type expression
JSON Advantages
  • Human-readable and easy to inspect
  • Broad language and browser support
  • Convenient for logs and troubleshooting

Common Use Cases

  • IoT device communication and sensor payload transfer
  • WebAuthn/FIDO2 authentication data analysis
  • COSE (CBOR Object Signing and Encryption) security workflows
  • CoAP constrained application message exchange
  • Embedded device configuration and data storage

Semantic Tags

Tags provide semantic meaning for CBOR items, allowing richer interpretation without changing the base binary structure.

Tag NumberSemantic Meaning
0Standard date-time string (RFC 3339)
1Epoch-based date-time (Unix timestamp)
2Positive bignum
3Negative bignum
32URI reference
55799Self-describe CBOR marker

Data is processed locally in your browser by default and will not be uploaded to any server. Upload will be clearly indicated if required.

© 2026 See-Tool. All rights reserved. | Contact Us