Skip to content

Hash generator (MD5, SHA-1, SHA-256, SHA-384, SHA-512)

Compute MD5 and the SHA hashes for text or a file. Output as hex, Base64 or Base64URL. The page runs fully in your browser, and the file you pick never leaves your machine.

Output
MD5
SHA-1
SHA-256
SHA-384
SHA-512

What is a cryptographic hash?

A cryptographic hash function takes any amount of input and gives a fixed-size string of bytes, called the digest. It is easy to compute in one direction and practically impossible to reverse. Even a one-bit change in the input flips about half of the output bits. The same input always gives the same hash.

Hashes are not encryption. They are one-way. They have three useful properties: collision resistance (it is hard to find two inputs with the same hash), preimage resistance (it is hard to find an input for a given hash) and second-preimage resistance (it is hard to find a second input that matches a known one).

When to use this tool

  • Checking a download. The publisher posts the SHA-256 of the official file. You hash your copy and compare. The two 64-digit hex strings either match or they do not.
  • Making an idempotency or dedupe key. The SHA-256 of a request body is a fingerprint. Use it to drop duplicate writes or to cache responses.
  • ETags and cache tags. A short MD5 of a response body is a cheap ETag. Many web frameworks do this by default.
  • Comparing two large files. If a file is too big to diff, hash both copies and compare. The same SHA-256 means the same bytes.

How the algorithms differ

  • MD5 - 128 bits (32 hex characters). Designed in 1991, broken for collisions in 2004. Still fine for non-security uses like ETags and checksums of well-known files. Never use it for passwords, signatures, or any place where an attacker controls part of the input.
  • SHA-1 - 160 bits. Broken for collisions in 2017 (the SHAttered paper). Same advice as MD5: legacy checksums only.
  • SHA-256, SHA-384, SHA-512 - the SHA-2 family. No published collisions. SHA-256 is the normal choice today. SHA-512 is faster on 64-bit CPUs because it works on 64-bit words. SHA-384 is SHA-512 cut to 384 bits, with different start values.
  • Not on this page - SHA-3 (Keccak), BLAKE2 and BLAKE3, and password hashes like bcrypt and argon2. Password hashing should always happen on the server, with a dedicated algorithm and a salt per user.

Worked examples

  • The quick brown fox jumps over the lazy dog - MD5 is 9e107d9d372bb6826bd81d3542a419d6 and SHA-256 is d7a8fbb307d7809469ca9abcb0082e4f8d5651e46d3cdb762d02d0bf37c9e592. This is a standard test vector. Use it to check that an implementation is right. The Sample button fills it in.
  • Empty input (a 0-byte file) - MD5 is d41d8cd98f00b204e9800998ecf8427e and SHA-256 is e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855. Every correct library gives these. An empty text box shows nothing, so pick an empty file to see them here.
  • Text in another script - नमस्ते is hashed as its UTF-8 bytes. MD5 is 16e2d966d4ab046e2442bc008b4da566. Other tools that hash UTF-8 give the same value.
  • A 4 MB image - the SHA hashes are computed by the browser's crypto.subtle.digest on the file bytes, with no upload. The page stays usable because Web Crypto is async. MD5 is shown only when the file is UTF-8 text, so for an image the MD5 row says it is not shown.

Common mistakes

  • Using MD5 for passwords. MD5 and SHA-256 are fast, and that is exactly why they are wrong for passwords. Use bcrypt, scrypt or argon2 with a salt per user and a cost factor you can tune.
  • Comparing hashes with ==. On the server, use a constant-time compare (crypto.timingSafeEqual in Node, hmac.compare_digest in Python). A normal compare leaks how many bytes matched through its timing.
  • Hashing the wrong bytes. A checksum mismatch is usually a trailing newline or Windows line endings (CRLF). Compare the raw bytes, not what the editor shows.
  • Trusting a hash without a signature. Anyone who can change the download page can change the hash too. A hash with a signature, or a hash served over HTTPS from a different origin, is what shows tampering.
  • Hashing huge files on the main thread. A pure JavaScript hash of a 1 GB file freezes the page. This page caps files at 50 MB.

FAQ

Is MD5 still safe to use?

For checksums and ETags, yes. For anything security-related (passwords, signatures, certificates), no. MD5 has practical collision attacks. Use SHA-256 or stronger when collision resistance matters.

Where does the file go when I pick it?

Nowhere. The hash is computed in the page with the browser's Web Crypto API and a small MD5 library. The file never leaves your machine.

What is the difference between hex, Base64 and Base64URL?

They are three ways to write the same hash bytes. Hex is 2 characters per byte and has no special characters. Base64 is about 4 characters per 3 bytes. Base64URL replaces + and / with - and _ and drops the = padding, so it is safe in a URL.

Why does my hash differ from the one the server computed?

Usually because of a trailing space or newline, different line endings (CRLF and LF), or the file changed between the two hashes. Hash the same bytes on both sides and compare.

Why is there no MD5 for my file?

The MD5 library on this page works on text, so MD5 is shown only for files that are valid UTF-8 text. For binary files like images, use SHA-256, or run md5sum on your machine.

What is the largest file I can hash?

50 MB. Bigger files are refused so the page does not run out of memory or freeze.