Hash generator

Type text or open a file to get its hashes, then paste a checksum to compare.

What to hash

Hashes

Type some text or open a file to see its hashes.

Paste the hash published next to a download, or a line from a .sha256 file.

What a hash is

A hash function turns any amount of data into a short, fixed-size fingerprint. The same input always gives the same hash, and the smallest change gives a completely different one. Here is the SHA-256 of two words that differ only in their first letter:

hello  2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824
Hello  185f8db32271fe25f561a6fc938b2e264306ec304eda518007d1764826381969

That is what makes hashes useful: if two files have the same SHA-256, you can treat them as identical, and if one byte changed, the hash will tell you. A hash cannot be turned back into the data, and it is not encryption: there is no key and nothing to decrypt.

This page hashes text as UTF-8 bytes, so “año” is hashed as the four bytes 61 C3 B1 6F, the same as a file saved in UTF-8. Below the results it shows exactly what it hashed: the number of bytes, the line endings, and the first and last bytes, where a stray line break or a BOM would show.

Check a download with its checksum

  1. Find the checksum on the download page, usually labelled SHA-256 or in a file called SHA256SUMS or something.iso.sha256.
  2. Choose “File” above and open the file you downloaded. It is read on your device; nothing is uploaded.
  3. Paste the published checksum in “Compare with a checksum”. You can paste the whole line from a checksum file; the algorithm is recognised from the length.
  4. If it says “Matches”, the file is exactly the one that was published. If not, download it again from the official site.

A matching checksum proves the file was not damaged or swapped on the way, as long as you took the checksum from a source you trust. If an attacker can change both the file and the page that lists its checksum, the check proves nothing; that is why some projects also sign their checksum files.

Hash a file on your computer

Every system can compute the same values without installing anything. Replace file.iso with your file:

SystemCommand
Windows (Command Prompt)certutil -hashfile file.iso SHA256
Windows (PowerShell)Get-FileHash file.iso -Algorithm SHA256
macOSshasum -a 256 file.iso
Linuxsha256sum file.iso
Linux, against a checksum filesha256sum -c SHA256SUMS

certutil also takes MD5, SHA1, SHA384 and SHA512; on macOS use md5 file.iso or shasum -a 1, -a 384 or -a 512; on Linux md5sum, sha1sum, sha384sum and sha512sum. PowerShell prints the hash in capitals and certutil in lower case; case does not matter, and this page compares either.

Which algorithm to use

AlgorithmSizeHex charactersAgainst tampering
MD5128 bits32Broken (collisions since 2004)
SHA-1160 bits40Broken (first public collision, 2017)
SHA-256256 bits64Secure
SHA-384384 bits96Secure
SHA-512512 bits128Secure

“Broken” means that someone can deliberately build two different files with the same MD5 or SHA-1. It does not mean that a file damaged by accident will keep its hash: MD5 still catches a broken download. But to know that nobody replaced a file on purpose, use SHA-256 or longer.

A hash is also the wrong tool for storing passwords: SHA-256 is designed to be fast, so a stolen list of hashed passwords can be guessed by the billions. Passwords are stored with slow functions made for it, such as bcrypt, scrypt or Argon2.

Why a hash does not match

When you hash a text and the result differs from the one you expected, the text is almost never “wrong”; its bytes are different in a way you cannot see. If you paste the expected checksum, this page tries the usual differences and tells you which one makes it match. The usual ones:

  • A line break at the end. echo "hello" | sha256sum hashes “hello” plus a line break, which gives 5891b5b5… instead of 2cf24dba…; use echo -n "hello" or printf "hello".
  • Windows (CRLF) and Mac or Linux (LF) line endings: a text copied from a Windows file has an extra byte at the end of each line.
  • A byte order mark (BOM) that some editors add at the start of a UTF-8 file. It is invisible but adds three bytes.
  • Another text encoding: “año” in Latin-1 is three bytes, in UTF-8 four, so their hashes differ.
  • Spaces or invisible characters copied with the text. The invisible character finder shows them.
  • Comparing different algorithms: a 64-character checksum is SHA-256, never MD5.

To see exactly where two texts differ, paste them in the diff checker, and to reveal hidden spaces and marks, use the invisible character finder.

Questions

Can a hash be turned back into the text?

No: many inputs share each hash, and nothing in the hash says which one it was. Short or common inputs, such as simple passwords, can still be found by trying candidates and comparing hashes, which is why hashes of passwords need a slow function and a salt.

Is my file uploaded to calculate its hash?

No. The browser reads the file and computes every hash on your device, with its built-in Web Crypto for SHA and this page’s own code for MD5, which Web Crypto does not include. You can disconnect from the internet after the page loads and it still works.

Why is a SHA-256 hash always 64 characters?

SHA-256 always outputs 256 bits, whatever the input. In hexadecimal each character holds 4 bits, so 256 bits are 64 characters; in Base64 they are 44.

Hex or Base64?

They are the same value written two ways. Download pages and command-line tools use hex; Subresource Integrity in web pages and some APIs use Base64. Choose the format above to match the one you are comparing with; the comparison accepts both.

More developer tools

See all tools