What is CBOR?
CBOR (Concise Binary Object Representation) is the IETF-standard binary serialization format defined in RFC 8949. It is closely related to MessagePack — same JSON-equivalent data model, similar wire footprint — but standardised through the IETF process and used as the encoding underneath COSE (RFC 9052), CWT (RFC 8392), and the WebAuthn / FIDO2 attestation format. If your protocol cites an RFC, CBOR is usually the right choice.
CBOR vs MessagePack — which should I pick?
They are wire-compatible cousins, not interchangeable. Pick CBOR when interoperating with anything in the IETF stack (COSE, CWT, WebAuthn/FIDO2, OSCORE, EAT, SUIT manifests). Pick MessagePack when your stack is application-level and you want a slightly larger ecosystem of dynamic-language libraries, especially Python and Ruby. Both shrink JSON by similar amounts (~50%); the choice is ecosystem fit, not raw bytes.
Why is the output base64 or hex?
CBOR is raw bytes, so to display or paste it you need a text encoding. Base64 packs 3 bytes into 4 ASCII characters (33% overhead) and is the standard transport. Hex doubles size (2 chars per byte) but is easier to read by hand for debugging. Toggle the format above the output panel.
How does this encoder handle floats?
For simplicity, non-integer numbers are always encoded as float64 (major type 7, additional info 27, tag 0xfb). The CBOR spec also defines float16 (0xf9) and float32 (0xfa); the decoder counterpart reads all three. If you need bit-exact float32 output for COSE interop, the spec allows you to downcast values whose Math.fround() equals the original.
What about negative integers?
Major type 1 stores -(N+1), so -1 becomes argument 0, -100 becomes 99, -1000 becomes 999. The encoder handles this transformation automatically — you pass a normal JS number and the right tag and value go on the wire. The decoder applies the inverse at parse time.
Does this encoder produce canonical / deterministic CBOR?
It uses preferred serialization for argument widths (the smallest length encoding that fits) and float64 for non-integers, which matches most of the Section 4.2 deterministic profile of RFC 8949. Strict canonical encoding additionally requires sorting map keys by their CBOR-encoded form; this encoder preserves JSON key insertion order. For COSE_Sign1 deterministic encoding, run the output through a normalizing canonicaliser.
Are CBOR tags (date, bignum, etc.) supported?
Not by the encoder — the input is JSON, which has no native date or bignum types, so there is nothing for the encoder to tag. The decoder counterpart understands the structural majors (0–5, 7) and ignores tag wrappers transparently. For RFC 8949 tag 0/1 (datetimes), tag 2/3 (bignums), or RFC 8746 typed arrays, encode in code with cbor-x or cbor.js.
Is the data uploaded?
No. The encoder is plain JavaScript running in your tab. Open DevTools → Network and click Encode — there are zero outbound requests. JSON containing personal data, credentials, or attestation payloads never reaches our servers.