PBKDF2 Key Generator
Derive a key from a password and salt using PBKDF2-HMAC (SHA-256, SHA-384, or SHA-512) with a configurable iteration count and key length. Salt is randomly generated by default; output is shown in hex and base64.
Input
Treated as UTF-8 text.
A random salt is generated for every derivation by default — recommended. Choose Custom only when you need a reproducible salt (e.g. to match an existing system).
More iterations means slower brute-forcing but slower derivation. OWASP's 2023 minimums: 600,000 for SHA-256, 210,000 for SHA-384/SHA-512. Capped at 1,000,000 here since this runs as pure JS on the main thread, not native code.
Must be a multiple of 8. Common values: 128, 192, 256 (AES key sizes), 512 (SHA-512 HMAC key).
Hex comparison is case-insensitive; base64 is case-sensitive.
Output
Store this alongside the derived key — reproducing it later needs the exact same salt, algorithm, iteration count, and key length.
Only shown when an expected key is provided.
Guides
Derive a cryptographic key from a password or passphrase using PBKDF2-HMAC (RFC 8018), entirely in your browser. Pick SHA-256, SHA-384, or SHA-512, set the iteration count and key length, and get the result in both hex and base64.
What is PBKDF2?
PBKDF2 (Password-Based Key Derivation Function 2) turns a password into a fixed-length key by running an HMAC thousands of times in a loop, mixed with a random salt. The repeated hashing makes brute-forcing the original password far slower than hashing it once, and the salt stops attackers from precomputing results for common passwords (rainbow tables). It's used to store passwords securely, to turn a passphrase into an AES/ChaCha20 encryption key, and inside standards like WPA2 Wi-Fi and PDF/ZIP encryption.
How to use this tool
- Enter the password or passphrase to derive a key from.
- Leave Salt on "Auto-generate random" (recommended) unless you need to reproduce a specific existing derivation, in which case switch to Custom and supply it as text or hex.
- Choose a hash algorithm — SHA-256 is the modern default.
- Set the iteration count. Higher is slower to compute but harder to brute-force; the tool tells you whether your setting meets OWASP's current recommendation for the chosen algorithm.
- Set the key length in bits — 256 bits is a common size for an AES-256 key.
- Click Derive key. Read the result as hex or base64, and copy the salt used alongside it — you need the exact same salt, algorithm, iteration count, and key length to reproduce the key later.
To check a key you already have, paste it into Expected key and the tool reports "Match" or "No match".
Everything runs locally in your browser — your password, salt, and derived key are never sent to a server.
How many iterations should I use?
OWASP's 2023 Password Storage Cheat Sheet recommends at least 600,000 iterations for PBKDF2-HMAC-SHA256 and 210,000 for PBKDF2-HMAC-SHA384/SHA512 (which cost more per round). More iterations is more secure but slower — this tool caps out at 1,000,000 iterations since it runs as JavaScript on the main thread rather than native code, and very high counts can take several seconds.
FAQ
Why is my salt random by default?
A random, unique salt per derivation is what defeats precomputed rainbow-table attacks. You only need a custom, fixed salt when re-deriving a key that must match one produced elsewhere — otherwise, always use a fresh random salt.
Is PBKDF2 the best choice for hashing passwords?
It's a solid, widely-supported, standards-based option (RFC 8018) and the required choice for some protocols. If you're free to choose and want stronger resistance to GPU/ASIC cracking, consider the memory-hard Argon2 Hash Generator or the Bcrypt Hash Generator instead.
Can I use the derived key directly as an AES key?
Yes — set Key length to match the cipher (128/192/256 bits for AES), copy the hex or base64 output, and use it as the key in the AES Encryption / Decryption tool. Keep the salt, algorithm, and iteration count on hand; you'll need all of them to re-derive the same key later.
Why does my result differ from another PBKDF2 tool?
The most common causes are a different salt, iteration count, key length, or hash algorithm — all four must match exactly to get the same output. Password and salt encoding (UTF-8 text vs. hex bytes) matters too.