CBOR Encode/Decode Online
Convert JSON to CBOR and back, read RFC 8949 diagnostic notation, render semantic tags, and diff the raw bytes side by side — all in your browser.
What is CBOR Encode/Decode Online?
CBOR (Concise Binary Object Representation, RFC 8949) is the compact binary serialization format behind WebAuthn passkeys, COSE messages, and IoT protocols like CoAP. It encodes the same structures as JSON into a fraction of the bytes while adding native support for byte strings, semantic tags, and bignums. This toolbox turns CBOR into something you can actually inspect: it converts JSON to CBOR (hex or base64), decodes binary back into readable JSON or RFC 8949 diagnostic notation, renders common semantic tags readably, and diffs the JSON vs CBOR byte streams side by side.
Zero-Server Tool Data Guarantee
All encoding and decoding happens locally in your browser. Your data is never sent to any server.
How to Use
Choose Your Mode
Select 'Encode' to turn JSON data into CBOR binary, or 'Decode' to convert CBOR bytes back to readable output. Drop a file instead of pasting — decode mode reads the raw bytes.
Set Encoding Type
Pick either 'Hex' or 'Base64' as the text representation for your binary CBOR data.
Pick an Output View (decode)
Choose 'JSON' for a plain decoded object or 'Diagnostic' for RFC 8949 §8 diagnostic notation with h'...' byte strings, <<...>> embedded data, and n(...) tags.
Inspect Semantic Tags
Dates (tag 0/1), bignums (tag 2/3), and embedded CBOR (tag 24) render readably in both views, so nothing is silently dropped.
Diff the Bytes
Open the Hex Dump Diff tab to see JSON and its CBOR encoding side by side with offset rulers and top-level type annotations.
Common Use Cases
WebAuthn / FIDO2 Debugging
Decode CBOR-encoded authenticator data from WebAuthn registration and authentication ceremonies.
IoT Data Serialization
Encode sensor readings and device state into compact CBOR for transmission over constrained networks.
COSE Message Inspection
Decode the payload of COSE-signed or encrypted messages used in firmware update and device authentication protocols.
Round-Trip Testing
Verify encode → decode round-trips, read diagnostic notation, and inspect tag-encoded values during schema migrations.
Implementation Examples
import { encode, decode } from 'cbor-x';const toHex = (bytes) => [...bytes].map((b) => b.toString(16).padStart(2, "0")).join("");// Round-trip test: JSON -> CBOR bytes -> JSONconst doc = { id: 42, name: "sensor-7", active: true };const bytes = encode(doc);console.log(toHex(bytes)); // b90003626964182a646e616d656873656e736f722d3766616374697665f5const decoded = decode(bytes);console.log(decoded); // { id: 42, name: 'sensor-7', active: true }console.log(JSON.stringify(decoded) === JSON.stringify(doc)); // true// Big integers keep full precision through the tag-2 bignumconst huge = decode(encode(18446744073709551616n));console.log(typeof huge, huge); // bigint 18446744073709551616
CBOR vs JSON vs MessagePack
| Feature | CBOR | JSON | MessagePack |
|---|---|---|---|
| RFC | RFC 8949 | RFC 8259 | No formal RFC |
| Self-describing | Yes (type + value) | No (text only) | Partially |
| Semantic tags | Yes (tag system) | No | Extension types |
| Size | Very compact | Verbose | Compact |
| Schema required? | No | No | No |
| Primary use | IoT, WebAuthn, CoAP | APIs, config | High-perf APIs |
| Implementation | Moderate | Trivial | Simple |
Production Best Practices & Security
Frequently Asked Questions
CBOR (Concise Binary Object Representation) is a binary serialization format defined in RFC 8949 and inspired by JSON, designed to pack data into the smallest possible footprint. Think of it as JSON's compact, binary sibling — it represents the same kind of key-value structures and arrays, but encodes them using a fraction of the bytes.
CBOR is the format behind WebAuthn (passkey authentication), COSE (CBOR Object Signing and Encryption), and many IoT protocols where every byte counts on constrained devices.