Random hex generator
Random hexadecimal strings for keys, tokens, salts and test hashes, as plain hex, 0x-prefixed, bytes or colon-separated.
16-character alphabet × 32 = 128 bits of entropy per value (16 bytes).
Press generate to fill this table.
Common hex lengths
| Hex digits | Bytes | Bits | Typical use |
|---|---|---|---|
| 16 | 8 | 64 | Trace IDs, short nonces |
| 32 | 16 | 128 | Session tokens, AES-128 keys, IVs |
| 40 | 20 | 160 | Fake SHA-1 / Git commit hashes |
| 64 | 32 | 256 | AES-256 and HMAC keys, fake SHA-256 hashes |
Questions people ask
What is a random hex string used for?
Session tokens, encryption keys and IVs, salts, nonces, test hashes and colour codes. Each hex digit carries 4 bits, so 32 hex digits is a 128-bit value and 64 digits is 256 bits.
How do I generate a 256-bit key in hex?
Set the length to 64 hex digits. That is 32 bytes, the key size for AES-256 and HMAC-SHA256. In a terminal, openssl rand -hex 32 does the same.
What are the byte and colon formats?
Byte format separates each pair of hex digits with a space (as hex dumps do), and colon format joins them with colons, as fingerprints and some key formats do.