Skip to content

SHA-256 Hash Generator - Generate SHA-256 Hashes Online

SHA-256 Hash
—

Generate a SHA-256 Hash

Type or paste text and its 64-character SHA-256 digest appears below. The text is encoded as UTF-8 and hashed by the browser's Web Crypto API (crypto.subtle.digest), the same primitive many web apps use themselves. Nothing leaves the page. Paste hello and you should see a hash starting 2cf24dba; if you get something else, check for a stray space or newline.

Same Digest, Different Spellings

The 32 bytes of a SHA-256 digest are written in several ways depending on the tool. Knowing which one you are looking at saves a lot of "why don't these match" debugging:

  • Hex (this page, sha256sum, GitHub release pages): 2cf24dba5fb0...
  • Docker and OCI image digests add a prefix: sha256:2cf24dba5fb0...
  • Subresource Integrity uses Base64: sha256-LPJNul+wow4m6DsqxbninhsWHlwfp0JecwQzYpOLmCQ=
  • Windows Get-FileHash prints upper-case hex. Case does not matter.

Verifying a Download

Projects publish a SHA-256 next to each release so you can confirm the file was not corrupted or swapped. This page hashes text, so for a file run one of these and compare the result with the published value:

sha256sum file.tar.gz             # Linux
shasum -a 256 file.tar.gz         # macOS
Get-FileHash file.tar.gz          # PowerShell (SHA-256 by default)

With a SHA256SUMS file in the same folder, sha256sum -c SHA256SUMS checks every listed file at once.

Where SHA-256 Is Used

Most TLS certificates are signed with SHA-256 (the sha256WithRSAEncryption or ECDSA-SHA256 you see in certificate details). Bitcoin hashes block headers with SHA-256 twice. Container registries address image layers by their SHA-256. JWTs signed with HS256 use HMAC-SHA256, and RS256 and ES256 sign a SHA-256 hash of the token. Git can store objects under SHA-256 instead of SHA-1, though SHA-1 is still the default.

SHA-256 or Something Else?

Prefer SHA-256 over MD5 and SHA-1, both of which have practical collision attacks. SHA-512 is equally sound and sometimes faster in software, but its 128-character output is more than most uses need. To authenticate a message with a shared secret, hashing secret + message yourself is not safe (SHA-256 is open to length-extension attacks); use the HMAC-SHA256 generator instead.

Related Tools

Frequently Asked Questions

How long is a SHA-256 hash?
256 bits, written as 64 hex characters. The SHA-256 of "hello" is 2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824.
Is SHA-256 secure?
Yes. There is no known practical collision or preimage attack on SHA-256, and it is the hash behind most TLS certificate signatures, code signing and Bitcoin. What it is not is a password hash: it is fast by design, so use bcrypt, scrypt or Argon2 for passwords.
Why doesn't my SHA-256 match sha256sum?
echo adds a newline, and "hello\n" hashes to 5891b5b5... instead of 2cf24dba.... Use printf 'hello' | sha256sum or echo -n. If the input came from a Windows file, \r\n line endings will also change the result.
How do I turn the hex hash into an SRI integrity value?
Subresource Integrity uses Base64 of the raw digest, not hex. For a file, run openssl dgst -sha256 -binary file.js | openssl base64 -A and write integrity="sha256-<result>". Pasting the hex from this page into the attribute will not work.
Can I decode a SHA-256 hash?
No. SHA-256 is one-way and there is no key. A "SHA-256 decoder" can only search hashes it has already computed, which finds short, common inputs like password123 and nothing else. If you need the original back, use an encoding such as Base64 or encryption.