PBKDF2 & HKDF Key Derivation
Derive a key from a password or secret with PBKDF2 or HKDF, choosing the salt, iteration count or info label, hash, and output length, and read it back as hex or base64, entirely in your browser.
PBKDF2 & HKDF Key Derivation — Stretch a password into a PBKDF2 key, or expand a high-entropy secret into named subkeys with HKDF, without anything leaving your machine. Pick the hash, set the salt and iteration count (PBKDF2) or info label (HKDF), choose how many bits of output you need, and copy the derived key as hex or base64. Every byte is computed locally with the native Web Crypto API (crypto.subtle.deriveBits), so your password and secret never touch a server.
What is PBKDF2 & HKDF Key Derivation?
PBKDF2 & HKDF Key Derivation is a free in-browser tool that runs the two key derivation functions developers reach for most. PBKDF2 (Password-Based Key Derivation Function 2) deliberately slows down brute force by repeating an HMAC many thousands of times, turning a human password plus a salt into a fixed-length key. HKDF (HMAC-based Key Derivation Function) takes a secret that already has enough entropy and expands it into one or more context-bound subkeys using an info label, which is ideal for deriving separate encryption and authentication keys from a single master secret. Backend engineers, security reviewers, and anyone building login or encryption code use it to test vectors, reproduce a server's derivation, or generate keys for a one-off task. Use the PBKDF2/HKDF toggle to switch algorithm, choose SHA-256, SHA-384, SHA-512, or SHA-1, set the output length in bits, and read the result as hex or base64.
How to use PBKDF2 & HKDF Key Derivation
- Pick PBKDF2 or HKDF with the toggle at the top, matching the function your code or test vector uses.
- Type or paste your password (PBKDF2) or high-entropy secret (HKDF) into the Secret field, then enter a salt.
- For PBKDF2 set the iteration count; for HKDF set the optional info label that binds the key to a context.
- Choose the hash (SHA-256, SHA-384, SHA-512, or SHA-1) and the output length in bits.
- Switch the hex / base64 toggle to the encoding you need and copy the derived key with the copy button.
Examples
PBKDF2 — 256-bit key from a password
Input
Secret: correct horse battery staple Salt: a1b2c3d4 Hash: SHA-256, Iterations: 100000, Bits: 256
Output
a 64-character hex string (32 bytes) that is reproducible for the same password, salt, hash, and iteration count
HKDF — context-bound subkey from a master secret
Input
Secret: 9f8e7d6c…(master key) Salt: session-2024 Info: aes-gcm-encryption Hash: SHA-256, Bits: 256
Output
a different 256-bit key than the same secret with Info: hmac-authentication, so one master produces independent subkeys
Shorter output as base64
Input
Bits: 128, encoding switched to base64
Output
a 24-character base64 string encoding the first 16 derived bytes
Frequently asked questions
- Does my password or secret get sent anywhere?
- No. The Secret, salt, and info stay in your browser. The key is derived locally with the Web Crypto API (crypto.subtle.deriveBits), and nothing is uploaded to or stored on any server, so the tool works offline and your inputs never leave the page.
- When should I use PBKDF2 versus HKDF?
- Use PBKDF2 to derive a key from a low-entropy human password — its iteration count slows brute force. Use HKDF when you already have a high-entropy secret (a master key or shared secret) and want to expand it into one or more separate subkeys via the info label. HKDF is fast and is not a substitute for PBKDF2's password stretching.
- Why is my output length rounded?
- Web Crypto's deriveBits works in whole bytes, so the output length in bits is rounded to the nearest multiple of 8. The stat below the result shows the actual bits and bytes that were produced.
- Which hashes and algorithms are supported?
- Both algorithms run on SHA-256, SHA-384, SHA-512, or SHA-1, the hashes the browser's Web Crypto exposes for PBKDF2 and HKDF. Scrypt, Argon2, and bcrypt are not provided because browsers do not implement them natively.
- Will the same inputs always give the same key?
- Yes. Key derivation is deterministic: the same algorithm, secret, salt, hash, output length, and iteration count (PBKDF2) or info (HKDF) always produce the same bytes, which is why you can use this to reproduce or verify a key your server derived.
Related tools
AES Text Encryption (AES-GCM + PBKDF2)
Encrypt and decrypt text with AES-256-GCM using a passphrase-derived key (PBKDF2 SHA-256, random salt), entirely in your browser with no uploads.
Argon2 & scrypt Hash
Hash a password with Argon2id or scrypt and verify an Argon2 hash against a password, entirely in your browser.
Bcrypt Hash Generator & Verifier
Generate a bcrypt password hash from plain text at a chosen cost factor, or verify a password against an existing bcrypt hash, entirely in your browser.
BIP39 Mnemonic Generator
Generate a random BIP39 recovery phrase of 12 to 24 words in several languages, or convert an existing mnemonic back into its raw entropy, entirely in your browser.