Hex Key Generator
Generate cryptographically secure random hex keys — 128, 192, 256, or 512-bit presets or any custom bit-length — with hex, base64, and raw bytes output plus one-click copy.
Use the Hex Key Generator
Key Length
256 bits — 32 bytes
Hexadecimal
—
Base64
—
Raw Bytes (decimal octets)
—
Bits
—
Bytes
—
Hex chars
—
Copied!
Summary
This tool generates cryptographically secure random keys using the browser's Web Cryptography API (crypto.getRandomValues). Choose a preset bit-length — 128, 192, 256, or 512 bits — or enter any custom length in bits (multiples of 8). Output is shown in three formats: hexadecimal, base64, and raw bytes (space-separated octets). Each format has its own copy button. Everything runs in your browser; no data is sent to any server.
How it works
- Select a preset bit-length (128, 192, 256, or 512 bits) or enter a custom length.
- Click Generate — crypto.getRandomValues() fills a typed array with random bytes.
- Three output formats are shown: hex, base64, and space-separated raw bytes.
- Click the copy button next to any format to copy it to your clipboard.
- Click Generate again or change the bit-length to produce a fresh key at any time.
Use cases
- Generate AES-128, AES-192, or AES-256 keys for symmetric encryption.
- Create HMAC-SHA256 or HMAC-SHA512 signing keys for API authentication.
- Produce random session secrets for web application configuration.
- Generate initialization keys for custom encryption protocols.
- Create key material for JWT secret generation or token signing.
Frequently Asked Questions
Last updated: 2026-06-19 · Reviewed by Nham Vu