Formula
hash = SHA-x(UTF-8 bytes of the text)
- SHA-256 gives 256 bits (64 hex characters)
- SHA-384 gives 384 bits, SHA-512 gives 512 bits, SHA-1 gives 160 bits
- The text is converted to UTF-8 bytes before hashing
A hash is a fixed-length fingerprint: the same input always gives the same output, and a tiny change gives a completely different one.
Worked example
The hash of “abc”
- Text to hash
- abc
- Hex letters
- lowercase (a–f)
SHA-256
ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad
Input length: 3 characters, 3 bytes (UTF-8)
ddaf35a193617abacc417349ae20413112e6fa4e89a97ea20a9eeee64b55d39a2192992a274fc1a836ba3c23a3feebbd454d4423643ce80e2a9ac94fa54ca49f
How it works
A cryptographic hash function turns any input into a fixed-length fingerprint. The same text always produces the same hash, a one-character change produces a completely different one, and the original text cannot practically be recovered from the hash. The SHA-256 hash of "abc" is ba7816bf…15ad, for example. That makes hashes useful for checking that a file or message has not changed.
This page uses the Web Crypto API built into your browser, so the text is hashed on your device and never sent anywhere. The text is encoded as UTF-8 first, which matches what most command-line tools do for text, but hashing the same words with a trailing newline or in another encoding gives a different result. SHA-1 is included only for compatibility because it is no longer considered secure against deliberate collisions.
MD5 is not offered, because browsers do not implement it and it should not be used for security. A hash is also not encryption, and a plain fast hash is the wrong tool for storing passwords. For encoding rather than hashing see Base64 Encode and Decode, for unique identifiers the UUID Generator, and to inspect a signed token the JWT Decoder.
Assumptions and limits
- Text is hashed as UTF-8.
- Hashes are computed with the browser's Web Crypto API, which supports SHA-1, SHA-256, SHA-384 and SHA-512.
- Not suitable on its own for password storage.