Skip to content
Jellykit

Random Hex Generator

Generate random hexadecimal strings of any length, in lowercase or uppercase, for IDs, salts, nonces and test values.

  • Runs on your device
Loading tool

About Random Hex Generator

Need a string of hex digits: a 32-character identifier, a salt, a nonce, a fake commit hash for a test? Set the number of hex digits and get one value or hundreds, each digit picked evenly from 0-9 and a-f by your browser’s cryptographic random number generator.

Every hex digit carries exactly 4 bits, so 32 digits hold 128 bits and 64 digits hold 256. Switch the character set to uppercase hex if your system expects A-F. Values are made on this page and are not sent or kept anywhere.

How it works

  1. Each position is filled with crypto.getRandomValues, using rejection sampling so that every symbol in the set is exactly equally likely.
  2. A custom set is split into the characters you see, so an emoji with a skin tone or a letter with an accent counts as one symbol. Repeats, spaces and line breaks are dropped.
  3. Entropy is the length multiplied by log2 of the number of symbols: the number of guesses, in bits, needed to try every possible string.

Questions

How many hex digits do I need for 128 or 256 bits?

Each hex digit is 4 bits, so 128 bits is 32 digits and 256 bits is 64 digits. An odd number of digits is fine here, though it no longer maps to whole bytes.

Is this the same as random bytes shown in hex?

With an even number of digits, yes: 32 random hex digits carry the same information as 16 random bytes. Use the random bytes generator when you think in bytes or also need Base64.

Can I use these as secret keys?

Yes. The digits come from the browser’s cryptographic generator with no bias, so 64 of them make a sound 256-bit key. Treat the result like a password and do not paste it anywhere public.

Everything you enter here is processed in this browser tab. Nothing is uploaded, logged or shared. How privacy works here.