Skip to content
MeasureMate

Hash Calculator

Generate MD5, SHA-1, SHA-256, SHA-384 and SHA-512 hashes of text, computed in your browser.

Hash Algorithm
SHA-2 family. The usual choice for file checksums and signatures.
Enter text above to generate a hash
Hashing runs in your browser: SHA algorithms use the built-in Web Crypto API, and MD5 (which Web Crypto does not offer) uses a small local implementation. Your text is never uploaded.

Updated Formula covered by automated tests

A cryptographic hash function turns any input, from one letter to a whole book, into a fixed-length fingerprint written in hexadecimal. This tool computes that fingerprint for the text you type using SHA-256, SHA-384, SHA-512, SHA-1 or MD5, so you can compare it with a value published somewhere else.

Typical uses: checking that an API signature or webhook payload was built from the exact string you expect, reproducing a checksum quoted in documentation, generating a stable cache key, or debugging why two systems disagree about a value that should be identical (a trailing newline or a different character encoding is the usual culprit).

Your text is hashed inside the browser. The SHA algorithms come from the browser’s built-in Web Crypto API; MD5 is not part of Web Crypto at all, because it is considered broken, so this page includes its own small MD5 routine for compatibility with old checksums.

The formula

digest = H(UTF-8 bytes of the text)
Padded length: L + 1 + k + 64 ≡ 0 (mod 512) bits, with k ≥ 0 zero bits (SHA-1, SHA-256, MD5)
Hex characters shown = digest bits ÷ 4 (MD5 128 → 32, SHA-1 160 → 40, SHA-256 256 → 64, SHA-384 → 96, SHA-512 → 128)
H
The chosen hash function, defined in FIPS 180-4 for the SHA family and RFC 1321 for MD5
L
Length of the message in bits (8 per UTF-8 byte)
k
Number of zero bits appended after a single 1 bit so the length field ends on a block boundary
64
The message length itself, stored in the last 64 bits of the padded message (SHA-384 and SHA-512 use 1024-bit blocks and a 128-bit length field)

These functions follow the Merkle-Damgård design: the padded message is cut into fixed-size blocks, and each block is mixed into a running internal state through dozens of rounds of additions, rotations and logical operations. The final state is the digest. Changing a single input bit flips about half of the output bits, which is why similar inputs give unrelated-looking hashes.

A good hash is one-way (you cannot recover the input from the digest) and collision resistant (you cannot find two inputs with the same digest). MD5 lost collision resistance in 2004, and a practical SHA-1 collision was published in 2017. The SHA-2 functions (SHA-256, SHA-384, SHA-512) have no known practical attacks and are what NIST currently approves alongside SHA-3.

Worked example

Dev, a backend engineer, wants to confirm that his service hashes strings the same way the standard does, so he hashes the three-letter test message abc from the NIST examples.

  1. 1 Encode as UTF-8: a, b, c are bytes 0x61, 0x62, 0x63 (97, 98, 99 in decimal), so L = 3 × 8 = 24 bits.
  2. 2 Pad for SHA-256: 24 + 1 + k + 64 must equal 512, so k = 512 − 89 = 423 zero bits, giving exactly one 512-bit block.
  3. 3 Run the compression function over that block and write the 256-bit state as 256 ÷ 4 = 64 hex characters.
  4. 4 Compare with the published SHA-256 value: ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad.
  5. 5 For a legacy system, the MD5 of the same input is 900150983cd24fb0d6963f7d28e17f72 (128 ÷ 4 = 32 hex characters), as listed in RFC 1321.

Result: Both digests match the published test vectors, so any difference Dev sees in production must come from the input bytes (encoding, whitespace or line endings), not from the hash function.

Before you rely on the result

  • Text is converted to UTF-8 before hashing. A system that hashes UTF-16 or Latin-1 bytes will produce different digests for anything beyond plain ASCII.
  • MD5 and SHA-1 are provided only to match legacy values. Do not use them for signatures, certificates, password storage or any new security design.
  • A plain hash is not a message authentication code. To prove who produced a value, use HMAC with a secret key or a digital signature.

Frequently asked questions

Why does my hash not match the one from the command line?

Usually a hidden character. Running echo "abc" | sha256sum hashes four bytes, abc plus a newline, and gives a different result from abc alone; use echo -n or printf instead. Windows line endings (CR LF instead of LF) and a byte-order mark at the start of a file cause the same mismatch.

Can a hash be reversed to get the original text?

Not mathematically, but short or common inputs can be found by guessing: an attacker hashes millions of candidate words and looks for a match. That is why a plain SHA-256 of a password is not safe storage. Password storage needs a deliberately slow, salted function such as Argon2, scrypt, bcrypt or PBKDF2.

Is MD5 still acceptable for checking file downloads?

It detects accidental corruption well, but it cannot protect against tampering, because an attacker can craft two different files with the same MD5. When a project publishes SHA-256 checksums, use those, and prefer a signed checksum file when one is offered.

Can I hash a file with this page?

This version hashes text only. For files, use sha256sum or shasum -a 256 on Linux and macOS, or Get-FileHash in Windows PowerShell, which reads the raw bytes without any text conversion.

Sources

All technology