Formatter Validator Minifier Escape / Unescape JSON ↔ String JSON ↔ YAML JSON → CSV NDJSON / JSON Lines JSON → Types JSON ↔ XML JSON Diff JSON Patch Canonicalize (RFC 8785) Schema Validator Schema Generator JSONPath Tester JWT Decoder JSON Errors Schemas More Tools
● RFC 8785 · JCS · 100% BROWSER-BASED

JSON Canonicalization & Hash

Produce the RFC 8785 canonical form of a JSON document — the invariant byte sequence you hash or sign — and its digest. Nothing leaves your browser, which matters when the document is about to be signed.

Input JSON
Canonical form (RFC 8785)
Canonical form will appear here
Digest

Canonicalization can change your data before you sign it

RFC 8785 builds on ECMAScript number serialization and constrains input to I-JSON (RFC 7493). That has a consequence worth understanding before you rely on a signature:

you send      {"id":9223372036854775807,"amount":0.1}
canonical     {"amount":0.1,"id":9223372036854776000}

The identifier is rounded, because it needs more precision than an IEEE 754 double provides. A signature over the canonical form does not cover the number you actually sent. This tool detects that case and every other value that changes, and tells you — rather than quietly handing you a hash of different data. If you must sign large identifiers, carry them as strings.

Duplicate member names are the other trap. I-JSON forbids them, and JSON.parse silently discards one of the values. We scan the source text before parsing, so the duplicate is reported instead of vanishing.

The four rules

Whitespace removed

RFC 8785 §3.2.1. No insignificant whitespace anywhere in the output.

Properties sorted

§3.2.3, by UTF-16 code unit — so A sorts before a, and astral characters sort by their surrogate values rather than their code points.

Primitives serialized as ECMAScript does

§3.2.2. 1e2 becomes 100, 1.0 becomes 1. The spec reuses ECMA-262 rather than defining its own number format.

UTF-8 output

§3.2.4. The byte count shown next to the output is the length you hash, not the character count.

Specifications

Verified against the official RFC 8785 test vectors — 6/6 on both the canonical text and the UTF-8 byte output.

Signing a document you also need to update? See the JSON Patch tool and when Merge Patch cannot do the job.