Encode a payload
Paste JSON and the CBOR bytes appear as hex or Base64. Integers take the smallest head that fits, text strings are major type 3, and containers state their element count.
{"a": 1, "b": [2, 3]} becomes a26161016162820203, 9 bytes. The leading a2 is a 2-entry map and nothing else in the stream needs a separator.
CBOR against MessagePack
The two formats sit within a byte or two of each other for most payloads. CBOR is the one written into IETF specifications, so it is what COSE, WebAuthn, and most constrained-device protocols expect on the wire. MessagePack has wider library support in application code.
Pick by what reads the bytes on the other end, not by size. The comparison under the output shows both counts when there is a real difference.
Canonical encoding
Deterministic CBOR requires shortest-form integers and map keys sorted by their encoded bytes. This encoder writes shortest-form integers but preserves the key order of the JSON input, since reordering silently would change any hash or signature computed over the result. Sort the keys in the source when a canonical form is needed.