1. Home
  2. Developer tools
  3. PBKDF2 and HKDF Calculator

PBKDF2 and HKDF Calculator

Reproduce a key derivation from your code or a test vector, and see how long it takes in a browser.

Free, no sign-up. Runs in your browser: nothing is uploaded.

How to use PBKDF2 and HKDF Calculator

  1. Choose PBKDF2 or HKDF and the hash.
  2. Enter password or key material, salt, info and length.
  3. Copy the derived key.

Features

  • PBKDF2-HMAC with SHA-1, SHA-256, SHA-384 and SHA-512
  • HKDF with extract and expand steps shown
  • Text, hex or Base64 inputs
  • Iteration guidance from OWASP
  • Timing in your browser
  • Sample test vectors

Supported formats

Input

  • Password or key material
  • Salt in text, hex or Base64

You get

  • Derived key in hex and Base64

Private by design

Everything you enter is processed by your browser on this device. Nothing is sent to openWorkstand or anyone else, so the PBKDF2 and HKDF Calculator is safe for private and work data. After you have used it once while online, it also works without an internet connection. How local processing works

Good to know

  • Timing depends on your device and says little about a server.
  • Very high iteration counts can freeze a slow phone for several seconds.

Guide

PBKDF2 and HKDF: deriving keys from passwords and secrets

People pick passwords that are short and guessable, while encryption algorithms need keys that are long and random. A key derivation function bridges the gap. PBKDF2 stretches a password by repeating a keyed hash many thousands of times, so that each guess costs an attacker real work. HKDF does a different job: it takes a secret that is already random, for example the output of a key exchange, and expands it into several independent keys. This page runs both, so you can reproduce a result from your own code.

How PBKDF2 works

PBKDF2, defined in RFC 8018, computes HMAC of the password with the salt and a block counter, then feeds the result back through HMAC for the chosen number of iterations, XORing all the intermediate values together. The output is as many bytes as you ask for. Because the work grows with the iteration count, a count of 600,000 makes a single guess roughly 600,000 times more expensive than one hash. The salt must be random and unique per password.

Checking a result

Press Sample and the page sets the password password, the salt salt, 4096 iterations and 20 bytes with HMAC-SHA-1. The derived key is 4b007901b765489abead49d926f721d065a429c1 in hex, or SwB5AbdlSJq+rUnZJvch0GWkKcE= in Base64. That is one of the test vectors in RFC 6070, and it matches the result of Node’s built-in crypto library for the same inputs. If your library gives the same value for the same inputs, its byte handling is right.

Iteration counts

Hardware gets faster, so the guidance rises. OWASP’s password storage advice from 2023 lists 1,300,000 iterations for PBKDF2 with HMAC-SHA-1, 600,000 with HMAC-SHA-256 and 210,000 with HMAC-SHA-512. The page shows a note with the figure for the hash you choose. For derivation from an already strong secret, a few thousand iterations or even one are acceptable, since there is nothing to guess.

HKDF

Switch to the HKDF tab for RFC 5869. Extract takes the optional salt and the input key material and produces a fixed-size pseudorandom key; expand turns that key and an “info” label into as many bytes as you need. Use a different info string for each purpose, such as “app v1 encryption key” and “app v1 mac key”, and you get unrelated keys from one secret. HKDF is deliberately fast, so it does not protect weak passwords.

Limits

Timing shown by the page reflects your browser and device, not a server. Very large iteration counts can freeze a slow phone for several seconds. PBKDF2 is not memory-hard, so GPUs run it efficiently; where you have the choice, Argon2id or scrypt resists them better.

Storing the result

A stored PBKDF2 password record should carry four things: the algorithm name, the iteration count, the salt and the derived key. Many systems write them in one string such as pbkdf2_sha256$600000$salt$hash, so the count can be raised later without breaking old records: when a user logs in with the right password, rehash it with the new count and replace the entry. Compare derived keys with a constant-time comparison, never with a plain equality test that stops at the first difference.

Checked against the current version of the PBKDF2 and HKDF Calculator on .

Frequently asked questions

Why does the salt need to be unique for each password?

Without a unique salt, two users with the same password get the same stored value, and an attacker can precompute tables of common passwords once and look every account up. A random salt per password forces separate work for each.

Is the result of PBKDF2 a password hash I can store?

Yes, together with the salt, the iteration count and the algorithm name. Store them in one string or in separate columns, so that you can raise the count later and verify old entries.

How many PBKDF2 iterations should I use?

OWASP’s 2023 guidance is 600,000 for PBKDF2-HMAC-SHA256 and 210,000 for SHA-512. Tune upwards as hardware gets faster.

When do I use HKDF instead of PBKDF2?

HKDF expands a key that is already strong and random into several keys. It is fast on purpose, so it must not be used to stretch a human-chosen password.

Keep working with the result

openWorkstand also includes a free workspace with documents, spreadsheets, tasks, projects and a calendar that save to a folder on your computer.