MD5 hash generator with salt
Enter a value and a salt below, choose how they should be combined, and generate a salted MD5 hash.
Why MD5 needs manual salting
Unlike bcrypt, plain MD5 has no concept of a salt built in — it's a pure function of its input, meaning the same input always produces the exact same output, forever, on every machine. That predictability is exactly what makes precomputed lookup tables (giant lists mapping common passwords to their MD5 hashes) so effective against unsalted MD5. A salt breaks that predictability by mixing in an extra, unique value before hashing, so the same password produces a different hash for every user.
Three ways to combine a salt with MD5
| Mode | How it works | Notes |
|---|---|---|
| Append | MD5(password + salt) | Simple, widely seen in legacy code, but vulnerable to certain length-extension-style edge cases depending on implementation |
| Prepend | MD5(salt + password) | Equally simple; marginally different resistance characteristics than append, still a basic-concatenation approach |
| HMAC | HMAC-MD5(key = salt, message = password) | Recommended — a formally-defined, cryptographically analyzed way to combine a secret and a message, stronger than raw concatenation |
The generator on this page supports all three modes so you can see exactly how the output differs. If you're implementing something that needs a manually-salted general-purpose hash, prefer the HMAC mode.
This still isn't a password-hashing recommendation
Even correctly salted with HMAC, MD5 remains a fast general-purpose hash — meaning it's still comparatively cheap to brute-force compared to a purpose-built algorithm. Salting an MD5 hash defeats precomputed rainbow tables, but it does nothing to slow down an attacker running a targeted brute-force against one specific stolen hash. If you're protecting real user passwords, use bcrypt (see our bcrypt generator) or Argon2 instead — salting is necessary but not sufficient for password security.
When salted MD5 is still a reasonable choice
- Generating a non-secret, unique-looking identifier from a known input plus a fixed application secret.
- Reproducing the exact hashing scheme of a legacy system you're migrating away from, purely for compatibility during the transition.
- Teaching or demonstrating the concept of salting itself.
Generate a random salt
Use the "Generate random salt" button above to produce a cryptographically random 8-byte (16 hex character) salt rather than typing your own guessable value — a predictable salt (like a username or a sequential number) provides much weaker protection than a truly random one.
Frequently asked questions
What is the strongest way to salt an MD5 hash?
HMAC-MD5, using the salt as the HMAC key, is stronger than simple append or prepend concatenation, because HMAC is a formally analyzed construction rather than ad-hoc string combination.
Does salting make MD5 safe for passwords?
It closes one specific gap (precomputed rainbow tables) but does not address MD5's core weakness for passwords, which is that it is far too fast, making brute-force attacks against any single hash cheap. Use bcrypt or Argon2 for real password storage.
Should the salt be secret?
The salt does not need to be secret — it is normally stored right alongside the hash — it only needs to be unique per record and unpredictable, so it can't be guessed and reused across a precomputed table.