JSON Whitespace Changes Hash – Minified vs Spaced JSON SHA-256

Local only

Explain why formatting-only JSON changes produce different text digests.

7 chars · 1 line

Waiting for input

Loading hash algorithms…

Structured text and hashes

Why does JSON whitespace change the hash?

VetaTool's Hash Generator hashes JSON as ordinary text. It does not parse or canonicalize the object first, so spaces and formatting remain part of the digest input. This tool is free to use. No account or payment is required.

Last updated

What you can do here

  • MD5 text digests
  • SHA-1 text digests
  • SHA-256 text digests
  • SHA-512 text digests
  • Exact text byte sensitivity
  • Browser-local hashing

Steps

  1. Compare the exact serialized JSON strings.
  2. Choose a canonical serialization if your protocol requires stable object hashes.
  3. Hash only after both sides use that same serialization.

Semantic JSON equality is not text equality

Whitespace outside JSON strings can be insignificant to a parser while still being real input characters to a text hash. VetaTool intentionally does not rewrite the JSON before hashing.

Minified vs spaced JSON

Both parse to the same object, but the serialized text differs.

JSON text comparison

{"a":1}
{ "a": 1 }

SHA-256 digests

minified: 015abd7f5cc57a2dd94b7590f04ad8084273905ee33ec5cebeae62276a97f862
spaced: efc6fbbe835f02996e070d9b3f37ffc4153f8ed11590fbf555bff7021d271fe9

Common questions

Frequently asked questions

Does VetaTool canonicalize JSON before hashing?

No. The Hash Generator treats the JSON characters as plain text.

Can two equivalent JSON documents have different hashes?

Yes, whenever their serialized text differs, including whitespace or key order.

Debugging a specific Hash issue? Browse Hash troubleshooting.