# Hash Generator

> The Hash Generator computes MD5, SHA-1, SHA-256, SHA-384 and SHA-512 hashes of text or any file using your browser’s Web Crypto API (plus a small MD5 library), and checks a result against an expected checksum.

URL: https://atechcraft.com/hash-generator/
Category: Developer Tools
Last updated: 2026-12-01
Author: Abdul Moid Khan, ATechCraft

Runs in your browser. Your data never leaves your device.

## How to use the Hash Generator

1. Choose Text or File.
2. Type text or select a file. All five hashes are calculated.
3. Paste a published checksum in the Compare box to see if it matches.
4. Copy the hash you need.

## What is a hash generator?

A hash generator turns any text or file into a short, fixed-length "fingerprint" called a hash or checksum. This tool calculates five common hashes at once (MD5, SHA-1, SHA-256, SHA-384 and SHA-512) for text you type or any file you choose, and checks a result against a checksum you paste in.

The same input always gives the same hash, but changing even one letter gives a completely different hash. That makes hashes ideal for checking that a download wasn't corrupted or tampered with.

## How does hashing work?

A hash function reads data in blocks and mixes it through many rounds of bit operations to produce a fixed-size output. Good cryptographic hashes have three properties:

1. **One-way:** you can't work out the input from the hash.
2. **Avalanche effect:** a tiny change in input changes about half the output bits.
3. **Collision resistance:** it should be practically impossible to find two inputs with the same hash.

This tool uses the browser's [Web Crypto API](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/digest) for the SHA family, which is fast native code, and the small open-source js-md5 library (MIT) for MD5, because Web Crypto deliberately leaves MD5 out. Text is hashed as UTF-8 bytes.

## Which hash should I use?

| Algorithm | Output length | Hex characters | Still secure? | Good for |
| --- | --- | --- | --- | --- |
| MD5 | 128 bits | 32 | No, collisions are easy | Spotting accidental corruption, legacy checksums |
| SHA-1 | 160 bits | 40 | No, practical collision shown in 2017 | Legacy systems, Git object IDs |
| SHA-256 | 256 bits | 64 | Yes | Downloads, signatures, general use |
| SHA-384 | 384 bits | 96 | Yes | Subresource Integrity, TLS |
| SHA-512 | 512 bits | 128 | Yes | High-security uses, fast on 64-bit CPUs |

The SHA-2 family is specified in [NIST FIPS 180-4](https://csrc.nist.gov/pubs/fips/180-4/upd1/final). Google and CWI Amsterdam published the first practical SHA-1 collision ("SHAttered") in 2017, which is why SHA-1 shouldn't be used for security any more.

## Worked example

Type the text `hello` (lowercase, no newline):

| Algorithm | Hash |
| --- | --- |
| MD5 | `5d41402abc4b2a76b9719d911017c592` |
| SHA-1 | `aaf4c61ddcc5e8a2dabede0f3b482cd9aea9434d` |
| SHA-256 | `2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824` |

Now type `Hello` with a capital H. The SHA-256 changes completely to `185f8db32271fe25f561a6fc938b2e264306ec304eda518007d1764826381969`.

**Checking a download:** a software site lists the SHA-256 of its installer. Choose the downloaded file in File mode, paste the published value into the Compare box, and the tool shows **Match** in green if every character agrees.

## Tips

1. **Watch for hidden characters.** A trailing space or newline changes the hash. Text copied from a terminal often ends with a newline.
2. **Case doesn't matter in hex.** `ABC123` and `abc123` are the same hash; the compare box ignores case.
3. **Don't hash passwords with SHA-256 for storage.** Fast hashes let attackers try billions of guesses per second. Use a slow password hash like Argon2, bcrypt or scrypt in your back end.
4. **Base64 is not a hash.** It can be reversed instantly; see the [Base64 tool](https://atechcraft.com/base64-encoder-decoder/).
5. **Inspecting a token?** Use the [JWT Decoder](https://atechcraft.com/jwt-decoder/); its signature is usually an HMAC-SHA-256.
6. **Comparing two texts** to find the difference? Hashes only say "same" or "different"; the [Text Diff Checker](https://atechcraft.com/text-diff/) shows where.

## Limitations

- Files are read fully into memory, so very large files (several gigabytes) may fail on low-memory devices.
- The tool doesn't do keyed hashes (HMAC), salted password hashes or other algorithms like SHA-3 and BLAKE3.
- Text is always hashed as UTF-8. Another tool hashing the same characters as UTF-16 will give different results.

Files are processed locally and never uploaded.

## Frequently asked questions

### Which hash should I use?

SHA-256 for checksums and general use. MD5 and SHA-1 are broken for security purposes but are still used to spot accidental corruption.

### Can I reverse a hash?

No. Hashes are one-way. Weak inputs like short passwords can be guessed, which is why passwords need slow hashes such as bcrypt or Argon2, not SHA-256.

### Why does my text hash differ from another tool?

Check for hidden differences such as a trailing newline or different text encoding. This tool hashes the exact UTF-8 bytes of the text.

### Are files uploaded?

No. Files are read and hashed in your browser.
