JSON Key Order Changes Hash – Same Object, Different SHA-256

Local only

Show that object key order changes the serialized text hashed by the current tool.

13 chars · 1 line

Waiting for input

Loading hash algorithms…

Structured text and hashes

Why does JSON key order change the hash?

The two example objects contain the same pairs, but their serialized character order differs. VetaTool hashes that serialization directly, so their SHA-256 values differ. 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 property order in the serialized JSON.
  2. Use a documented canonical JSON scheme when stable cross-system hashes are required.
  3. Hash the canonical output, not arbitrary serializer output.

A text hash does not sort object properties

Hashing occurs after serialization. The digest function sees a sequence of characters, not a JavaScript object, and therefore does not know that reordered pairs may be semantically equivalent.

Same pairs, different key order

Only the serialized property order changes.

JSON text comparison

{"a":1,"b":2}
{"b":2,"a":1}

SHA-256 digests

a,b order: 43258cff783fe7036d8a43033f830adfc60ec037382473548ac742b888292777
b,a order: 3fb75453225c732a76b7899ea2096dda1455189c89817239732182f73fe5a09f

Common questions

Frequently asked questions

Does JSON object key order matter to this Hash Generator?

Yes, because it hashes the entered serialized text rather than parsing and sorting the object.

How do I get stable JSON hashes across systems?

Define and use the same canonical serialization before hashing on every side.

Debugging a specific Hash issue? Browse Hash troubleshooting.