gettoolz.app

SHA-256 hash generator

SHA-256, the most used member of the SHA-2 family, gives a 256-bit digest of 64 hex characters — today’s default checksum for software releases, container images and certificates. Computed in your browser: the text you type is never sent anywhere.

Part of developer tools and security tools.

Text to hash

SHA-256

waiting for input…

MD5

waiting for input…

SHA-1

waiting for input…

SHA-512

waiting for input…

Good to know about SHA-256

Published by NIST in 2001, SHA-256 has no known practical attack on either collisions or preimages. It is what Bitcoin mines with (applied twice), what names every layer of a Docker image (sha256:…), and what signs most TLS certificates on the web.

One property still catches people out: length extension. Given SHA-256(secret + message) and the secret’s length, anyone can compute a valid digest for that message with more data appended — without knowing the secret. To authenticate a message with a key, use HMAC-SHA-256, which is built to rule this out, rather than hashing the key and the message together.

The same 32 bytes also turn up in base64 rather than hex, as in the sha256-… value of a Subresource Integrity attribute. It is the same digest, only written differently, so it will not look like the one above.

SHA-256 reference hashes

Every digest below was computed by the same code as the generator above when this page was built, and checked against the value recorded in the site’s source — a mismatch stops the build. Inputs are hashed as UTF-8 bytes, with nothing added.

SHA-256 digests of common inputs
InputSHA-256Copy
(empty string)0 bytes. Zero bytes — also the digest of any empty file.e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
abc3 bytes. The test vector used in the algorithm’s own specification.ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad
hello5 bytes. Just the five letters, as printf sends them.2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824
hello\n6 bytes. With the trailing newline that echo adds.5891b5b522d5df086d0ff0b110fbd9d21bb4fc7163af34d08286a2e846f6be03
The quick brown fox jumps over the lazy dog43 bytes. The classic pangram.d7a8fbb307d7809469ca9abcb0082e4f8d5651e46d3cdb762d02d0bf37c9e592
café5 bytes. The é is two bytes in UTF-8, c3 a9.850f7dc43910ff890f8879c0ed26fe697c93a067ad93a7d50f466a7028a9bf4e

Getting the same digest on the command line

On Linux, printf %s hello | sha256sum prints 2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824, the value in the table. The more natural echo hello | sha256sum gives 5891b5b522d5df086d0ff0b110fbd9d21bb4fc7163af34d08286a2e846f6be03 instead, because echo appends a newline and the newline is hashed too. On macOS the command is shasum -a 256. When a digest will not match, a trailing newline or a text editor’s different encoding is the first thing to check.

Other algorithms

SHA-256 digests are 256 bits, 64 hex characters. The same text through the other algorithms:

Or open the hash generator with all four side by side. Either way the text stays in this tab — see the privacy page.