Skip to content
AZ Tools

PBKDF2 Key Derivation

Derive a key from a password with PBKDF2-HMAC in your browser — pick the hash, iteration count and output length, and read the result as hex or Base64.

How to use

  1. Enter the password and the salt. Tick the hex box if the salt is stored as bytes rather than text.
  2. Choose the hash and the iteration count — or take a preset, which is the RFC vector for checking against, and the OWASP figures for real use.
  3. Set the output length in bits and copy the derived key as hex or Base64.

About this tool

Show

PBKDF2 turns a password into a key by running HMAC over it many thousands of times. The point is not secrecy — the algorithm is public and so is the salt — but cost: an attacker guessing passwords has to pay the same iteration count on every guess. Set the password, the salt, the iteration count, the hash and how many bits you want out, and the derivation runs through the browser's own WebCrypto implementation. Nothing is sent anywhere.

The defaults reproduce the third test vector from RFC 6070: password and salt at 4096 iterations of HMAC-SHA1 gives 4b007901b765489abead49d926f721d065a429c1. That vector is the reason this tool is useful for debugging — if your server and this page disagree on a key, one of you is encoding the password or the salt differently, and a shared reference point tells you which. The salt can be entered as text or as hex, because a salt read from a database is almost never printable.

Iteration counts are a moving target, and the field warns below 100,000 for that reason. OWASP's current password-storage guidance is 600,000 iterations for HMAC-SHA256 and 210,000 for HMAC-SHA512, the difference being that SHA-512 does more work per round on 64-bit hardware. The presets are there so the number is a decision rather than something inherited from a tutorial written a decade ago.

One detail worth knowing about the output length: PBKDF2 produces its key one hash-sized block at a time, so asking for more bits than the hash emits makes it run the whole chain again for each extra block. Requesting 512 bits from HMAC-SHA256 costs exactly twice the work of requesting 256 and gives you nothing stronger, because the security still rests on the same 256-bit function. The tool says so when it happens.

Finally, the honest caveat: PBKDF2 has no memory hardness, so it parallelises cheaply on GPUs and specialised hardware. It remains the right choice where a standard or a platform requires it, and for new password storage Argon2id or scrypt are the better-defended options.

Frequently asked questions

Why does my server produce a different key from the same inputs?

Almost always an encoding difference rather than an algorithm one. This page encodes the password as UTF-8 and, unless you tick the hex box, the salt too. Servers that store the salt as raw bytes and hand it over as hex, or that hash a Base64 form of the password, will disagree. Reproduce the RFC 6070 vector on both sides first: if that matches, the algorithm is fine and the difference is in what you are feeding it.

How long should the salt be?

At least 16 bytes of output from a cryptographic random generator, and unique per password. The salt is not a secret — it is stored next to the hash — its job is to make sure two users with the same password get different keys, so that one precomputed table cannot attack everybody at once. A shared or constant salt gives that away entirely.

Is PBKDF2 still acceptable?

For new password storage, Argon2id is the first recommendation and scrypt the second, because both are designed to need a lot of memory and so resist the parallel hardware that makes PBKDF2 cheap to attack. PBKDF2 is still perfectly appropriate where it is mandated — FIPS-validated environments, WPA2, many file formats — and with a high enough iteration count it is far better than storing a bare hash.

Does a longer output make the key stronger?

Not beyond the hash it came from. PBKDF2 generates hash-sized blocks and concatenates them, so a 512-bit output from HMAC-SHA256 is two blocks: double the computation for a key whose strength is still bounded by SHA-256. Ask for the length your cipher needs — 256 bits for AES-256 — and put the extra budget into iterations instead.

Why does a high iteration count freeze the page for a moment?

Because WebCrypto derivation is asynchronous but not interruptible: once it starts, the browser works through every round before it returns. At OWASP-level counts that is a noticeable pause on a phone, which is itself a useful thing to feel — it is the same cost an attacker pays per guess.

Related tools