DevKitHub

API & Security

MD5, SHA-1 and SHA-256 Hash Generator

Type or paste text to get its MD5, SHA-1 and SHA-256 digests together. All three are computed locally — nothing is uploaded.

1 line

Digests — 43 UTF-8 bytes

MD5128-bit · broken
9e107d9d372bb6826bd81d3542a419d6
SHA-1160-bit · broken
2fd4e1c67a2d28fced849ee1bb76e7391b93eb12
SHA-256256-bit
d7a8fbb307d7809469ca9abcb0082e4f8d5651e46d3cdb762d02d0bf37c9e592

MD5 and SHA-1 are marked broken because producing two different inputs with the same digest is practical, so neither proves a file is the one you expect. Both are still fine for spotting accidental corruption. A hash is not encryption and cannot be reversed, and none of these belong anywhere near password storage — use bcrypt, scrypt or Argon2 for that.

This tool runs entirely in your browser. Your input is never uploaded, stored or logged.

How it works

All three algorithms follow the same shape. The text is converted to UTF-8 bytes, a single 0x80 byte and then zeros are appended until the length is eight bytes short of a 64-byte boundary, and the original length in bits is written into those last eight bytes. The result is processed one 64-byte block at a time through a compression loop, and the internal state left at the end is the digest. Because the padding rule is part of the specification, two implementations that follow it produce identical output — which is the entire reason a checksum is useful to anyone but its author.

These are implemented as plain arithmetic on this page rather than handed to the browser's built-in crypto API, for three reasons. Web Crypto deliberately has no MD5, and MD5 is what most people arrive here needing. Web Crypto is asynchronous, while every other tool on this site is a synchronous function shared between the browser and the API. And Web Crypto only exists in a secure context, so it disappears in environments where plain arithmetic still works. The trade-off is speed, which for text-sized input is not noticeable.

On choosing between them: MD5 and SHA-1 are broken for any security purpose. Chosen-prefix collisions against both are practical and have been demonstrated against real certificates, so neither should be used to prove that a file is the file you expect when someone might be trying to fool you. They remain perfectly good at detecting accidental corruption, which is why package registries still publish MD5 checksums. Use SHA-256 whenever an adversary is part of the threat model. And note that no hash is encryption: there is no key and no way back to the original text.

Common problems

Every example below is run against this tool in our test suite, so what it says here is what the tool actually does.

The hash does not match the one md5sum printed for the same text.

Why:
A trailing newline. `echo abc` sends four bytes, not three, so `echo abc | md5sum` hashes "abc\n" and gets a completely different digest.
Fix:
Use `printf %s abc | md5sum`, or `echo -n`. A single invisible byte changes every bit of the output.

The hash differs from the one my backend computes for the same string.

Why:
A character-encoding mismatch. Hashes are defined over bytes, and "é" is two bytes in UTF-8 but one in Latin-1, so the two systems are hashing different input.
Fix:
Make both sides encode as UTF-8 before hashing. This tool always does.

Using a plain hash to store passwords.

Why:
MD5, SHA-1 and SHA-256 are designed to be fast, which is exactly wrong for passwords: a commodity GPU tries billions of SHA-256 candidates per second against a stolen table.
Fix:
Use bcrypt, scrypt or Argon2, which are deliberately slow and salted. Never a bare hash, salted or not.

Frequently asked questions

Can I reverse a hash back to the original text?
No. A hash is one-way by design and maps input of any length onto a fixed number of bits, so information is thrown away. Sites that appear to "decrypt" MD5 are looking the digest up in a table of previously hashed strings — that works for common passwords and for nothing else.
Is MD5 still safe to use?
Not against anyone deliberately trying to fool you. Producing two different files with the same MD5 is cheap and has been demonstrated against real certificates. It is still fine for spotting accidental corruption, such as a truncated download.
Why does my hash differ from the one my server produced?
Almost always a trailing newline or a character-encoding difference. Hashes are computed over bytes: adding one invisible byte, or encoding "é" as Latin-1 instead of UTF-8, changes the digest completely.
Is my text sent to a server?
No. The algorithms run in your browser as ordinary JavaScript arithmetic. Nothing you type is uploaded, stored or logged.

Read more about this

Last updated