How SHA-256 works on text and files
SHA-256 is defined in NIST FIPS 180-4 as part of the SHA-2 family. It pads your input to a multiple of 512 bits, runs 64 rounds of bitwise mixing over 32-bit words, and outputs a fixed 256-bit digest. Written in hexadecimal, that digest is always 64 characters long whether you hash a single letter or a 1 GB disk image.
This page calls your browser's native crypto.subtle.digest("SHA-256", bytes) implementation. Text strings are first converted with new TextEncoder().encode(text) so the UTF-8 byte sequence matches what Python's hashlib.sha256, Node.js crypto.createHash("sha256"), Go's crypto/sha256, and OpenSSL produce. When you switch to the File Checksum tab, your browser reads the file into an ArrayBuffer locally and hashes it in memory without uploading anything.
Known test vectors to sanity-check your code
When debugging an API signature or a file-integrity script, comparing against two known vectors catches encoding bugs fast:
- Empty string (0 bytes):
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 hello(5 bytes, no trailing newline):2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824
If your shell gives you 5891b5b522d5df086d0ff0b110fbd9d21bb4fc7163af34d08286a2e846f6be03 for hello, you have a trailing \n byte. That happens every time someone runs echo "hello" | shasum -a 256 instead of printf "hello" | shasum -a 256. Watch the byte counter above the text box on this page: hello should read 5 chars and 5 bytes.
Verifying a downloaded file without terminal flags
Software vendors usually publish a SHA256SUMS file next to their installers. To check a download here, open the File Checksum tab and drop the `.zip`, `.dmg`, `.exe`, or `.iso` file into the dashed box. Then paste the publisher's 64-character string into the comparison field at the bottom of the tool. The badge switches to Exact Match or Mismatch right away, ignoring uppercase versus lowercase differences so you never have to compare 64 characters by eye.
If you prefer the command line for multi-gigabyte ISOs that might strain browser memory, run shasum -a 256 file.iso on macOS, sha256sum file.iso on Linux, or Get-FileHash file.iso -Algorithm SHA256 in Windows PowerShell.
When to use SHA-256, and when to pick something else
Older hashes like MD5 and SHA-1 have known practical collision attacks, meaning someone can craft two different files that share the same digest. SHA-256 has a 2²⁵⁶ output space and no practical collision attack, which is why TLS certificates, Git's newer object format, container image digests, and software package managers rely on it.
There are two situations where SHA-256 is not the best fit. First, if a vendor publishes a 128-character checksum or you want faster hashing on 64-bit servers, use our SHA-512 Hash Generator. Second, never store raw user passwords with plain SHA-256. A single consumer GPU can compute billions of SHA-256 hashes per second against a leaked database. For password storage, use a deliberately slow, salted algorithm like our Bcrypt Hash Generator.