Format Atlas

Compare

CBOR vs MessagePack

CBOR and MessagePack both serialize JSON-like values to binary. CBOR standardizes protocol tags and deterministic encoding rules; MessagePack offers compact encoding for general objects.

Which format should you choose?

Consider CBOR when a protocol needs IETF-standardized tags or deterministic encoding. Choose MessagePack when compatibility with existing applications and libraries is the priority. Test numeric ranges, extensions, normalization, and cross-implementation behavior.

Good fit for CBOR

Structured data exchange on constrained devices and networks · Data representation in COSE and IoT protocols

  • Representing JSON-like data in a compact binary form
  • Using standard or application-defined tags to convey meaning

Good fit for MessagePack

Binary serialization of JSON-like data · Structured data exchange between compatible applications

  • Encoding JSON-style arrays, maps, and basic values in binary
  • Exchanging extension values and timestamps between compatible libraries

Basic information

FieldCBORMessagePack
Extension.cbor.msgpack, .mpk
MIME typeapplication/cborapplication/octet-stream
Common usesStructured data exchange on constrained devices and networks · Data representation in COSE and IoT protocolsBinary serialization of JSON-like data · Structured data exchange between compatible applications
How to openRead it with a CBOR library or decoder, then inspect its diagnostic notation or a JSON-like view. Check how values without direct JSON equivalents, such as tags and byte strings, are represented.Read it with a MessagePack-aware library or decoder. For inspection, use diagnostic output or a JSON-like view, and check how binary values and extensions are displayed.
Export or convertWhen converting to JSON, byte strings and tagged values may need tool-specific representations because JSON has no direct equivalents. For signatures, hashes, or cache keys, follow the protocol's agreed encoding rules, such as deterministic encoding in RFC 8949.When converting to JSON, binary values and extensions may need arrays, strings, or custom wrappers because standard JSON has no direct equivalents. For round trips, test actual values, numeric ranges, timestamps, map keys, and extension types.

Choose by use case

Representing JSON-like data in a compact binary form

Structured data exchange on constrained devices and networks · Data representation in COSE and IoT protocols

CBOR

Using standard or application-defined tags to convey meaning

Structured data exchange on constrained devices and networks · Data representation in COSE and IoT protocols

CBOR

Encoding JSON-style arrays, maps, and basic values in binary

Binary serialization of JSON-like data · Structured data exchange between compatible applications

MessagePack

Exchanging extension values and timestamps between compatible libraries

Binary serialization of JSON-like data · Structured data exchange between compatible applications

MessagePack

Key point 1

CBOR defines integers, byte strings, arrays, maps, and tags in RFC 8949. MessagePack defines integers, strings, binary values, arrays, maps, and application-defined extension types.

More on the differences

Key point 2

CBOR specifies deterministic encoding requirements useful when a protocol needs consistent representations for signing or hashing. MessagePack applications may need to define key ordering and extension conventions themselves.

More on the differences

More on the differences

Choose according to the protocol and ecosystem rather than assuming one is universally smaller or faster. Define how tags or extensions, map keys, numbers, and optional values map, then test representative payloads.

  • CBOR tags can identify application-level value semantics, and RFC 8949 describes deterministic encoding requirements. MessagePack extension types carry application-defined type identifiers and bytes.
  • They do not share a byte-level encoding, even when representing similar data. A decoder for one format cannot be assumed to parse the other.
  • Conversions can change numeric widths, map-key types, tagged values, or extension data. Specify mappings and test round trips across the actual implementations.

Frequently asked questions

Are CBOR and MessagePack binary-compatible?

No. They have different encodings and extension models; applications need an explicit conversion or shared protocol definition.

Learn more

References and specifications