How to use
- Type or paste text, switch the input to hex bytes, or open the file you want to check.
- Keep SHA-256 selected and choose lowercase hex, uppercase hex or Base64 output.
- Paste the checksum from the download page into the Compare with field. Match means the file is identical.
- Copy the result, or copy SHA-384, SHA-512 or another digest from the table of all algorithms.
What is SHA-256?
SHA-256 is the most widely used member of the SHA-2 family, designed by the NSA and standardized by NIST in 2002 in FIPS 180-2. Today it is specified in FIPS 180-4, and RFC 6234 gives the same algorithms with reference code. SHA-256 processes 512-bit blocks in 64 rounds of 32-bit arithmetic and outputs a 256-bit digest: 64 hex characters or 44 Base64 characters. No practical collision or preimage attack is known, and it is the default choice for:
- TLS certificates and handshakes, and code signing;
- Bitcoin, which applies SHA-256 twice for block hashes, proof of work and transaction IDs (the checksum in Base58Check addresses comes from the same double hash);
- checksum files such as
SHA256SUMS, container image digests (sha256:...) and Subresource Integrity.
Verifying a download
Open the downloaded file and paste the publisher's checksum into the Compare with field. Letter case does not matter, and a Base64 value works too. Match means the file is byte for byte the one the checksum was made from. It does not prove who made it, so take the checksum from the publisher's HTTPS site or a signed SHA256SUMS file rather than from the mirror that served the download.
For text, the hash covers bytes, not characters. Windows line endings (CRLF), a byte order mark, or UTF-16 instead of UTF-8 each produce a completely different SHA-256. Use the Text encoding select or hex input to hash exactly the bytes another system hashed.
Length extension and passwords
Like MD5, SHA-1 and SHA-512, SHA-256 is open to length extension: given SHA-256(secret + message) and the length of the secret, an attacker can compute a valid hash for that message followed by padding and data of their choosing, without knowing the secret. To sign or authenticate data with a key, use HMAC-SHA256 from the HMAC Generator instead of hashing the key and message together.
Speed is also why a plain SHA-256 is the wrong way to store passwords: anyone who obtains the hashes can test guesses as fast as their graphics cards compute SHA-256, and identical passwords produce identical hashes. Use Argon2id, scrypt, bcrypt or PBKDF2-HMAC-SHA256 with a high iteration count, all of which add a salt.
SHA-256 on the command line and in code
$ printf 'abc' | sha256sum
ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad -
sha256sum -c SHA256SUMS # Linux: check a list of files
shasum -a 256 file.iso # macOS
certutil -hashfile file.iso SHA256 # Windows
Get-FileHash file.iso # PowerShell (SHA256 is the default)
# Python
hashlib.sha256(data).hexdigest()
// Node.js
crypto.createHash('sha256').update(data).digest('hex')
The value for abc is the test vector from the standard; type abc above to see the same result. The table of all algorithms also lists SHA-384, SHA-512, SHA-1, MD5 and CRC values for your input.
Examples
| Input (UTF-8) | SHA-256 |
|---|---|
Hello, World! | dffd6021bb2bd5b0af676290809ec3a53191dd81c7f70a4b28688a362182986f |
Base64.is | 63f2f446bc11a1f96175c0f77bdac08ca1b184ba42c3a42c34ddcbce00b1b800 |
你好 | 670d9743542cae3ea7ebe36af56bd53648b0a1126162e78d81a32934a711302e |
Frequently asked questions
Can SHA-256 be decrypted?
No. SHA-256 is a one-way hash, not encryption. Online "decrypters" only look hashes up in tables of known inputs, so they find common passwords and short strings but nothing long or random.
Why does my SHA-256 not match the published checksum?
Most often the download is incomplete or a different version, or you hashed the file name instead of the file. Load the file itself with Open file. Also check that both values use the same algorithm: a 128-character hex value comes from a 512-bit hash such as SHA-512, not from SHA-256.
How do I get a SHA-256 hash in Base64?
sha256- values, although sha384- is more common) and the HTTP Content-Digest header use this form. Hex and Base64 carry the same 32 bytes; convert between them with Base64 to Hex.Is SHA-256 the same as SHA-2?
SHA-2 is a family: SHA-224, SHA-256, SHA-384, SHA-512, SHA-512/224 and SHA-512/256. SHA-256 is its most common member. SHA-3 (FIPS 202) is a separate design based on Keccak and gives different results.
How long is a SHA-256 hash?
=. SHA3-256 and BLAKE2s have the same length; the Hash Identifier lists such candidates for an unknown hash.