Leading Space Changes Hash – Whitespace SHA-256 Check

Local only

Show that a leading space is part of the hashed input.

6 chars · 1 line

Waiting for input

Loading hash algorithms…

Whitespace and hashes

Why does a leading space change the hash?

A leading space is a real input character. VetaTool does not trim hash text, so one space before hello changes the SHA-256 digest. 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. Reveal or count leading whitespace.
  2. Hash the exact padded value.
  3. Trim only if the data contract says leading spaces are insignificant.

Hashing preserves leading whitespace

Text editors, form fields, templates, and copied terminal output can introduce a leading space. That space changes the byte sequence and therefore the digest.

Leading-space SHA-256 comparison

The first value begins with one ordinary space.

Input comparison

␠hello
hello

SHA-256 digests

leading space: 1c9c535c80b3298829957b9fbfcd00bec337baca0866812efc749b7669613d43
plain: 2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824

Common questions

Frequently asked questions

Does the Hash tool trim leading spaces?

No. Leading and trailing characters are included in the text being hashed.

Should I trim before hashing?

Only when both producers and consumers of the digest agree that trimming is part of the canonicalization rule.

Debugging a specific Hash issue? Browse Hash troubleshooting.