JSON canonicalization (JCS)

Client

RFC 8785 defines a single canonical JSON text for any value—useful when two systems must hash or sign the same bytes. This page shows the JCS string and a SHA-256 of its UTF-8 encoding. For human-readable key order only, see JSON sort keys.

Learn more: JCS (RFC 8785)

Produce the RFC 8785 JSON Canonicalization Scheme string for a parsed value—the exact bytes many systems use before signing or hashing—plus an optional SHA-256 of those UTF-8 bytes.

JCS vs sorted keys

Sorting object keys is often part of a human-readable “stable” stringify, but JCS also fixes how numbers and strings are written so independent implementations agree. Use this page when you need interoperability with specs that cite RFC 8785, not only alphabetical key order.

Signing and digests

The canonical string is shown as text; SHA-256 is computed in your browser over UTF-8 encoding of that string. Your protocol may use a different hash or sign UTF-8 bytes directly—always match what your verifier expects.

JSON input

?

Output follows RFC 8785 — the same byte sequence you would sign or hash for deterministic payloads. This differs from "sort keys" alone: number and string serialization rules are fixed by the scheme.

Common use cases

  • Compute a single canonical JSON text and SHA-256 fingerprint before signing or comparing integrity across services.
  • Verify that two logical JSON values serialize to identical bytes when interoperability tests require deterministic output.
  • Pair with sort-keys mentally: JCS is the standard for cryptographic canonicalization, not ad hoc key sorting alone.

Common mistakes to avoid

  • Hashing pretty-printed JSON instead of JCS

    Whitespace and key order from a generic formatter are not standardized. For signatures, always hash the RFC 8785 JCS string.

  • Expecting JCS to match your language’s default JSON.stringify

    Runtime serializers vary. JCS defines exact serialization rules; use a JCS implementation or this page when bytes must match.

FAQ

Is JCS computed in the browser?

Yes. The canonical string and SHA-256 are derived locally; your document is not uploaded.

How does JCS relate to JSON sort keys?

Sort keys only reorders object keys for readability. JCS specifies full canonical serialization (including numbers and strings) for deterministic bytes—use it when hashes or signatures must align.

Related utilities you can open in another tab—mostly client-side.