About this tool
PBKDF2 (Password-Based Key Derivation Function 2, RFC 8018) turns a password into a key by running HMAC many thousands of times. It’s the password hash in Django, in many enterprise systems and in Wi-Fi WPA2, and it’s the KDF required by FIPS 140 validated systems. This generator uses your browser’s built-in Web Crypto implementation.
Everything is computed in your browser with WebAssembly or the Web Crypto API. Your passwords and files are never uploaded.
Recommended iteration counts
OWASP’s password storage guidelines recommend at least:
| Algorithm | Iterations |
|---|---|
| PBKDF2-HMAC-SHA256 | 600,000 |
| PBKDF2-HMAC-SHA512 | 210,000 |
| PBKDF2-HMAC-SHA1 | 1,300,000 |
PBKDF2 isn’t memory-hard, so GPUs crack it far faster than Argon2 or scrypt at the same server cost. Prefer Argon2id for new systems unless you need FIPS compliance or compatibility.
The Django format
Django stores PBKDF2 hashes as pbkdf2_sha256$iterations$salt$hash, with the 32-byte hash in Base64. Keep the salt alphanumeric (as the New salt button does) and the key length at 32 bytes to produce a value Django can verify.
PBKDF2 in code
const enc = new TextEncoder();
const key = await crypto.subtle.importKey('raw', enc.encode(password), 'PBKDF2', false, ['deriveBits']);
const bits = await crypto.subtle.deriveBits(
{ name: 'PBKDF2', hash: 'SHA-256', salt: enc.encode(salt), iterations: 600000 },
key, 256);import hashlib
dk = hashlib.pbkdf2_hmac("sha256", password.encode(), salt.encode(), 600_000, dklen=32)
dk.hex()openssl kdf -keylen 32 -kdfopt digest:SHA256 -kdfopt pass:"$PASSWORD" \
-kdfopt salt:"$SALT" -kdfopt iter:600000 PBKDF2FAQ
What is PBKDF2?
A key derivation function that applies HMAC to a password and salt many times, making each guess slow. It is defined in RFC 8018.
How many PBKDF2 iterations should I use?
OWASP recommends at least 600,000 for HMAC-SHA256, 210,000 for HMAC-SHA512 and 1,300,000 for HMAC-SHA1.
Is PBKDF2 still secure?
Yes, with enough iterations, but it isn’t memory-hard, so GPUs crack it more cheaply than Argon2id or scrypt. Use it where compliance or compatibility requires it.
Does the salt need to be secret?
No. The salt must be random and unique per password, but it can be stored next to the hash.