CBOR Encode

This online CBOR encoding tool helps you encode JSON or CBOR Diagnostic Notation from text or file to CBOR bytes in Hex or Base64. Read more

Encode JSON or Diagnostic Notation as CBOR

CBOR (Concise Binary Object Representation) is a compact binary data format standardized by RFC 8949. Its data model includes integers, byte and text strings, arrays, maps, tags, simple values, and floating-point numbers. This tool converts JSON or CBOR Diagnostic Notation into CBOR bytes displayed as Hex or Base64.

How to use the encoder

Choose JSON for familiar objects, arrays, strings, numbers, booleans, and null. Choose Diagnostic when you need CBOR-specific values such as byte strings, tags, or simple values. Enter text, select a local file, or load URL content, then choose the binary output encoding and press Encode. File input also produces a downloadable cbor.dat.

Example

The JSON object {"hello":"world"} encodes as Hex a16568656c6c6f65776f726c64. In Diagnostic input, h'010203' represents a CBOR byte string and encodes as 43010203. Hex and Base64 are two printable representations of the same CBOR bytes.

Important limitations

JSON cannot express every CBOR type or preserve all numeric distinctions. This encoder produces a valid representation but does not offer a deterministic-encoding switch. Map ordering, integer or floating-point width, and other valid encoding choices may differ between implementations. Follow the deterministic encoding rules in RFC 8949 when a protocol requires byte-for-byte reproducibility.

Frequently asked questions

Should I choose Hex or Base64?

Choose Hex for byte inspection and test vectors; choose Base64 for a shorter value in text-based transport.

Why does another encoder produce different bytes?

Both byte strings may represent the same data item. Check map ordering, integer and floating-point representation, tags, indefinite-length forms, and deterministic-encoding requirements. Use CBOR Decode to compare their represented values.

Input
Output
Share Link
Settings