HKDF Extract & Expand

Derive key material with HKDF or run extract and expand separately. Control hash, salt, context bytes and output length.

Extract, expand or both

HKDF separates input key material from application-specific output keys. Extract returns a fixed-length PRK; expand takes a PRK of at least the hash output length, optional context bytes and a requested length. The combined mode performs both steps. The example reproduces RFC 5869 test case 1.

UTF-8, hex, Base64 and Base64url input have explicit byte semantics. Empty salt and info are supported. Random salt is optional and is included in the JSON record. IKM and input PRK are excluded from that record; the derived key itself is secret material.

Length, context and intended use

Output may contain 0 through 255×HashLen bytes: at most 8160 bytes with SHA-256, 12240 with SHA-384 or 16320 with SHA-512. Extract always returns HashLen bytes. IKM and info are each capped at 64 KiB, salts at 1 KiB and expand-only PRK at 4 KiB.

HKDF is for key derivation and context separation, not password stretching. It cannot create entropy missing from a weak input. Keep the hash, salt, info, stage and length with your protocol. Raw output omits that context; JSON records make it explicit.

Reference

Questions & answers

Why does changing info change the output?

Info separates keys for different purposes. Use a deliberate protocol-defined value, and reproduce the exact same bytes when deriving the same key again.

Does an empty salt mean no extraction?

No. Combined and extract modes still perform extraction. Only Expand mode uses a supplied PRK directly.

Is my input uploaded or saved?

Processing runs in your browser. The tool does not put keys, passwords or content in URLs or local storage, or send them to a processing API. Clear removes visible inputs and outputs; it does not guarantee secure erasure of browser-managed memory.

Other Languages