FreeDeskTools

HKDF Key Derivation Tool

Last Updated: July 2, 2026

HKDF Key Derivation

All key derivation uses the native Web Crypto API (RFC 5869). Your master key, salt, info, and derived keys never leave your browser.

RFC 5869 Web Crypto API Zero Uploads No Logging

Input Keying Material (IKM)

Master secret. Auto-detects UTF-8, hex, or base64.

0 bytes · detecting encoding...
auto
0 bytes
0 bytes

Example Presets

Click a preset to fill demo values. These examples show real HKDF usage patterns.

Derive cryptographic keys from a master secret using RFC 5869 HKDF with the Web Crypto API. Supports SHA-256, SHA-384, SHA-512, configurable salt, context info, and key length. 100% browser-based with zero uploads.

RFC 5869 Compliant
Web Crypto API
Zero Uploads
Browser Processing
SHA-256/384/512
Multiple Derived Keys

How To Use

Follow these simple steps to get started with hkdf key derivation tool.

1

Enter your master key (IKM)

Paste or type your Input Keying Material (master secret) into the IKM field. You can enter UTF-8 text, hex, or base64. The tool auto-detects the encoding.

2

Configure salt and info (optional)

Add a salt for additional entropy (recommended — random, at least 16 bytes). Add context Info if you need domain-specific key derivation (e.g., 'encryption-key', 'auth-key').

3

Choose key parameters

Select the hash algorithm (SHA-256 recommended), derived key length, and output encoding. Validate that the length is compatible with your chosen hash.

4

Generate and export

Click 'Derive Key' to generate your derived key. Copy the output, download as TXT or JSON, or generate multiple derived keys with different Info values.

Real-World Examples

Practical situations where hkdf key derivation tool helps solve real problems.

Derive AES Encryption Keys

Derive a 256-bit (32-byte) AES key from a shared master secret using HKDF with SHA-256. The salt ensures unique keys even when the same master secret is used across different sessions or applications.

Key Separation for Multi-Service Architectures

Use different Info parameters to derive separate keys for encryption, authentication, signing, and MAC in microservice environments. Each derived key is cryptographically isolated even though they share the same IKM.

JWT Secret & HMAC Key Generation

Derive HMAC keys for JWT signing (HS256, HS384, HS512) from a single master secret. The Info field encodes the token context, ensuring each service or endpoint gets a unique signing key.

Session Key Derivation

Derive unique session keys for each user session from a long-term master key. Include the session ID in the Info field to ensure forward secrecy and key separation between sessions.

Why Use This Tool

Discover how this tool can improve your workflow and productivity.

RFC 5869 Compliant

Implements HKDF (HMAC-based Key Derivation Function) exactly as defined in RFC 5869 using the browser's native Web Crypto API. The extract-then-expand construction ensures cryptographically strong derived keys suitable for production use.

Native Web Crypto API

Uses crypto.subtle.importKey and crypto.subtle.deriveBits — the same FIPS-compliant cryptographic primitives used by browsers for TLS, WebAuthn, and encrypted media. No JavaScript crypto libraries, no polyfills, no third-party dependencies.

Multiple Hash Algorithms

Support for SHA-256, SHA-384, and SHA-512 with automatic length validation. SHA-256 is the default and recommended HKDF hash, providing an optimal balance of security and performance for most key derivation scenarios.

Key Health Analysis

Real-time analysis of your master key entropy, salt quality, and overall key health. Conservative heuristics estimate security level (Weak, Acceptable, Strong, Excellent) without overpromising on entropy measurement.

Common Use Cases

Practical scenarios where this tool can help you get things done.

Derive AES Encryption Keys

Derive a 256-bit (32-byte) AES key from a shared master secret using HKDF with SHA-256. The salt ensures unique keys even when the same master secret is used across different sessions or applications.

Key Separation for Multi-Service Architectures

Use different Info parameters to derive separate keys for encryption, authentication, signing, and MAC in microservice environments. Each derived key is cryptographically isolated even though they share the same IKM.

JWT Secret & HMAC Key Generation

Derive HMAC keys for JWT signing (HS256, HS384, HS512) from a single master secret. The Info field encodes the token context, ensuring each service or endpoint gets a unique signing key.

Session Key Derivation

Derive unique session keys for each user session from a long-term master key. Include the session ID in the Info field to ensure forward secrecy and key separation between sessions.

Tool Summary

Quick facts about this tool at a glance.

Purpose Derive cryptographic keys from a master secret (IKM) using RFC 5869 HKDF (HMAC-based Key Derivation Function) in your browser. Supports SHA-256, SHA-384, SHA-512 hash algorithms, optional salt, optional context Info, and configurable output length (8–128 bytes). Generate single or multiple derived keys with automatic encoding detection.
Best For Developers, security engineers, DevOps professionals, penetration testers, backend engineers, and students who need to derive AES keys, HMAC keys, session keys, or sub-keys from a shared master secret using RFC 5869 compliant HKDF.
Processing 100% browser-side via Web Crypto API. crypto.subtle.importKey imports the IKM as HKDF key material. crypto.subtle.deriveBits performs RFC 5869 extract-then-expand key derivation with the selected hash, salt, info, and output length.
Cost Free.
Sign-Up Required No.
Data Storage Volatile browser memory. Derived keys stored only in JavaScript variables and released on tab close. Preferences stored in localStorage (algorithm, encoding, key length — never IKM, salt, info, or derived keys).

What Is HKDF Key Derivation Tool?

An HKDF Key Derivation Tool is a browser-based cryptographic utility that derives secure keys from a master secret using the HMAC-based Key Derivation Function defined in RFC 5869. It uses the Web Crypto API's native HKDF implementation (crypto.subtle.importKey + crypto.subtle.deriveBits) to perform the extract-then-expand construction. The tool supports SHA-256, SHA-384, and SHA-512 hash algorithms, optional salt for additional entropy, optional Info for context-specific key derivation, and configurable output lengths from 8 to 128 bytes. It can generate multiple derived keys with different Info values for key separation in multi-service architectures.

About This Tool

HKDF Key Derivation Tool: RFC 5869 Key Derivation in Your Browser

HKDF (HMAC-based Key Derivation Function) is a cryptographic primitive that derives one or more cryptographically strong secret keys from a master secret. It is defined in RFC 5869 and is widely used in modern security protocols including TLS 1.3, IPsec, SSH, Signal Protocol, WireGuard, and WPA3.

This tool implements HKDF using the browser's native Web Crypto API — the same FIPS-compliant cryptographic primitives used by browsers for secure connections, digital signatures, and encrypted media. There are no JavaScript crypto libraries, no polyfills, and no third-party dependencies.

How HKDF Works

HKDF follows a two-step construction called extract-then-expand:

Step 1: Extract (HKDF-Extract)

The extract step takes the Input Keying Material (IKM) and an optional salt, and produces a fixed-length Pseudorandom Key (PRK). The salt adds entropy even if the IKM is not uniformly random. If no salt is provided, a default salt of all zeros (matching the hash output length) is used.

PRK = HMAC-hash(salt, IKM)

Step 2: Expand (HKDF-Expand)

The expand step takes the PRK and an optional Info parameter, and produces the desired number of output bytes. The Info parameter ensures domain separation — different Info values produce independent derived keys even from the same PRK.

Derived Key = HKDF-Expand(PRK, Info, L)

Where L is the desired output length in bytes.

When to Use HKDF

HKDF is the right choice when you already have a high-entropy shared secret and need to derive one or more cryptographic keys. Common scenarios include:

  • Diffie-Hellman shared secrets: After an ECDH or DH key exchange, use HKDF to derive encryption and authentication keys from the shared secret.
  • Pre-shared keys: Derive session-specific keys from a long-term pre-shared key using unique salts and Info values.
  • Key hierarchy: Create a key hierarchy where a single master key produces separate keys for encryption, signing, authentication, and key-wrapping.
  • Protocol key derivation: Implement the key schedule for custom cryptographic protocols following established patterns like TLS 1.3.

Why HKDF Is Different from Hashing

Raw hashing of a master key (e.g., SHA-256(masterKey)) is not a safe key derivation strategy because:

1. No domain separation: Two different uses of SHA-256(masterKey) produce the same output, allowing key reuse across contexts. 2. Fixed output length: SHA-256 always produces 32 bytes regardless of requirements. 3. No extraction: If the master key has structure or bias, the hash output inherits those weaknesses. 4. No salting: Without a salt, the same master key always produces the same derived key.

HKDF addresses all of these through its two-step extract-then-expand construction with salt and Info parameters.

Why HKDF Is Different from PBKDF2

PBKDF2 (Password-Based Key Derivation Function 2) also uses HMAC and can produce variable-length output, but it is designed for a different use case:

  • PBKDF2: Designed for deriving keys from low-entropy passwords. Uses a configurable iteration count to slow down brute-force attacks. Memory-hard variants (scrypt, Argon2) provide additional GPU/ASIC resistance.
  • HKDF: Designed for deriving keys from high-entropy secrets. Fast and efficient because the input already has sufficient entropy. No iteration count is needed.

Use PBKDF2 (or better, Argon2) for password hashing. Use HKDF for protocol-level key derivation from high-entropy sources.

Real-World HKDF Usage

TLS 1.3 uses HKDF extensively for its key schedule. The TLS 1.3 handshake uses HKDF-Extract and HKDF-Expand multiple times to derive handshake traffic keys, application traffic keys, exporter secrets, and resumption secrets — all from the (EC)DHE shared secret.

WireGuard uses HKDF to derive session keys from Diffie-Hellman shared secrets, with chained HKDF operations for key confirmation and transport key derivation.

Signal Protocol uses HKDF to derive message encryption keys, authentication keys, and chain keys from the double ratchet algorithm's shared secrets.

IPsec (RFC 7296) uses HKDF as the default pseudorandom function for deriving child SA keys from the IKEv2 shared secret.

Best Practices for HKDF

1. Always use a salt: Even though salt is optional in RFC 5869, always provide a unique random salt of at least 16 bytes. The salt ensures that derived keys change even when the same IKM is used.

2. Use descriptive Info values: Info strings like 'AES-256-GCM-Encryption-v2' provide domain separation and make the derivation auditable.

3. Choose the right hash: SHA-256 is sufficient for most applications. Use SHA-512 only if you need output lengths exceeding 8160 bytes or compliance with specific standards.

4. Validate derived key length: Ensure the requested length is compatible with your chosen hash. SHA-256 max output is 255×32 = 8160 bytes.

5. Test with vectors: Verify your HKDF implementation against RFC 5869 test vectors before using in production.

Quick Summary

Production-grade HKDF (RFC 5869) key derivation using the browser's native Web Crypto API. Imports IKM via crypto.subtle.importKey('raw', ..., 'HKDF', ...) and derives keys via crypto.subtle.deriveBits({ name: 'HKDF', hash, salt, info }, keyMaterial, lengthBits). Supports SHA-256, SHA-384, SHA-512. Auto-detects hex/base64/UTF-8 for IKM and salt. Validates output length against hash block size limits. Conservative entropy heuristics for key health analysis. Generates 1–10 derived keys with unique Info values. 100% client-side, zero uploads, zero logging. Compliant with the same Web Crypto HKDF used in TLS 1.3 and WebAuthn.

Related Concepts

Explore related terms and topics associated with hkdf key derivation tool.

HMAC-based Key Derivation Function onlinederive key from master key browserWeb Crypto API HKDFderive sub keys onlinecryptographic key derivation toolbrowser HKDF generatorderive AES key onlineRFC 5869 HKDFHKDF SHA256 onlineHKDF SHA512 online

Frequently Asked Questions

Common questions about hkdf key derivation tool.

What is HKDF?

HKDF (HMAC-based Key Derivation Function) is a cryptographic key derivation function defined in RFC 5869. It takes a master secret (IKM), an optional salt, and an optional context string (Info), and produces one or more cryptographically strong derived keys. HKDF uses a two-step extract-then-expand construction: the extract step produces a pseudorandom key (PRK) from the IKM and salt, and the expand step generates the desired number of output bytes from the PRK and Info. HKDF is widely used in modern cryptographic protocols including TLS 1.3, Signal, WireGuard, IPsec, and SSH.

Why use HKDF instead of hashing?

HKDF is designed specifically for key derivation, whereas hashing (SHA-256, SHA-512) is designed for data integrity. Raw hashing of a master key produces outputs that lack key separation, domain separation, and cryptographic independence. HKDF's extract-then-expand construction ensures that: (1) Different Info parameters produce independent derived keys, (2) Even weak IKM benefits from the salt's randomness, (3) The output length is variable and validated, and (4) The derived keys maintain the full security of the HMAC construction. Hashing a master key directly is not a safe key derivation strategy.

How is HKDF different from PBKDF2?

HKDF and PBKDF2 serve different purposes. HKDF is designed for key derivation from a cryptographically strong master secret (e.g., a Diffie-Hellman shared secret or a securely generated key). PBKDF2 is designed for password-based key derivation, using a configurable iteration count to slow down brute-force attacks. HKDF is fast (no iteration count), making it unsuitable for password storage but ideal for protocol-level key derivation where the master secret already has high entropy. PBKDF2 is slow by design, making it suitable for deriving keys from human-memorable passwords. Use HKDF when you already have a strong secret; use PBKDF2 (or better, Argon2) for password hashing.

How is HKDF different from Argon2?

HKDF and Argon2 serve fundamentally different purposes. HKDF is a key derivation function designed to derive multiple cryptographic keys from a single high-entropy master secret. It is intentionally fast and efficient because the master secret already has sufficient entropy. Argon2 is a memory-hard key derivation function (password hash) designed to resist GPU and ASIC brute-force attacks by requiring significant memory and computation. Argon2 won the Password Hashing Competition and is the recommended choice for password hashing and key derivation from passwords. HKDF is the recommended choice for protocol-level key derivation where the input already has high entropy (e.g., ECDH shared secrets, pre-shared keys).

What is Salt in HKDF?

In HKDF, the salt is an optional but strongly recommended random input that adds entropy to the key derivation process. The salt is mixed into the extract step via HMAC, ensuring that even if the same IKM (Input Keying Material) is used multiple times, different derived keys are produced (as long as the salt is different). The salt does not need to be secret, but it should be unique per derivation context. Best practice is to use a random salt of at least 16 bytes. In TLS 1.3, the salt is derived from the Diffie-Hellman shared secret negotiation.

What is Info in HKDF?

The Info parameter (also called context or application-specific information) is an optional string that provides domain separation in HKDF's expand step. By using different Info values, you can derive multiple independent keys from the same IKM and salt — each Info value produces a completely different derived key. For example, you might use Info='encryption' for an AES key, Info='authentication' for an HMAC key, and Info='signing-1' for a signing key — all from the same IKM. Info is included in the HMAC computation, so derived keys are cryptographically bound to their context.

Which hash algorithms are supported?

This HKDF generator supports SHA-256, SHA-384, and SHA-512. SHA-256 is the default and recommended choice for most applications, providing a 256-bit security level with optimal performance. SHA-384 and SHA-512 provide higher security margins (384-bit and 512-bit respectively) but produce larger derived keys. The hash algorithm determines the maximum output length: SHA-256 supports up to 255×32 = 8160 bytes, SHA-384 up to 255×48 = 12240 bytes, and SHA-512 up to 255×64 = 16320 bytes. All three algorithms are NIST-approved and widely supported.

Can I derive AES keys with HKDF?

Yes. HKDF is the recommended method for deriving AES keys from a shared secret. To derive an AES-128 key, set the derived key length to 16 bytes (128 bits). For AES-192, use 24 bytes. For AES-256, use 32 bytes. Use a unique salt per session and meaningful Info values (e.g., 'AES-256-GCM-Encryption') to ensure key separation. The derived bytes are suitable for direct use as AES key material. Always include a unique salt to prevent key reuse across sessions.

Is this HKDF tool secure?

Yes. This tool uses the Web Cryptography API's native HKDF implementation, which is the same FIPS-compliant cryptographic primitive used by browsers for TLS 1.3, Web Authentication (WebAuthn), and Encrypted Media Extensions (EME). The implementation follows RFC 5869 exactly — there is no custom cryptographic code, no polyfills, and no third-party libraries. All processing happens in your browser: your IKM, salt, Info, and derived keys never leave your device. FreeDeskTools never receives, stores, or transmits any cryptographic material.

Does anything leave my browser?

No. This HKDF tool performs all cryptographic operations locally using your browser's native Web Crypto API. Your Input Keying Material (IKM), Salt, Info, and derived keys never leave your device. FreeDeskTools never receives, stores, or transmits any cryptographic material. There are no server requests, no logging, no telemetry related to your inputs, and no analytics that track your keys. Only anonymous usage events (e.g., 'Generate Key clicked') are tracked for site improvement.

Can I use this for production?

Yes, with appropriate precautions. The tool uses the browser's native Web Crypto API HKDF implementation which is RFC 5869 compliant and suitable for production key derivation. However, you should: (1) Always verify the derived key using test vectors, (2) Use strong random salts (at least 16 bytes), (3) Ensure your IKM has sufficient entropy (at least 128 bits for AES-128, 256 bits for AES-256), (4) Never use derived keys in production without proper testing, (5) Consider the security implications of deriving keys in a browser environment (e.g., other extensions, compromised browser). For high-security production environments, consider using a dedicated cryptographic library or HSM.

What is RFC 5869?

RFC 5869 is the official IETF specification for HKDF (HMAC-based Key Derivation Function), published in May 2010. It defines the extract-then-expand construction: the extract step (HKDF-Extract) applies HMAC with the salt to the IKM to produce a pseudorandom key (PRK), and the expand step (HKDF-Expand) uses the PRK with the Info parameter in an HMAC-based counter mode to produce the desired output length. RFC 5869 is widely implemented and is used in TLS 1.3 (RFC 8446), IPsec (RFC 7296), SSH (RFC 4253), Signal Protocol, WireGuard, and WPA3. The Web Crypto API's HKDF implementation follows RFC 5869 exactly.

How long should my master key be?

Your master key (IKM) should have at least as many bits of entropy as the security level you need. For AES-128, the IKM should have at least 128 bits (16 bytes) of entropy. For AES-256, at least 256 bits (32 bytes). The IKM can be any length, but longer keys (e.g., 64 bytes) provide additional security margin. If your IKM is a shared secret from Diffie-Hellman key exchange, it should be at least 256 bits for Curve25519 or 3072-bit DH. If you're using a password as IKM, use PBKDF2 or Argon2 instead of HKDF — HKDF is not designed for low-entropy inputs. Always use a random salt of at least 16 bytes.

Reviewed by FreeDeskTools Editorial Team

HKDF Key Derivation Tool has been reviewed for accuracy, usability, privacy, and browser-side performance. FreeDeskTools tools are designed to run locally whenever possible, helping users complete tasks quickly without unnecessary data collection.

Was this tool helpful?

Your feedback helps us improve HKDF Key Derivation Tool and build better tools for everyone.

Free, private utilities for developer, text, image, calculator, marketing, productivity, and security workflows. No uploads, no sign-ups.