Random hex string generator
Produces strings of 0-9 and a-f from the browser's secure random generator, with each character adding 4 bits of randomness.
Loading the tool…
Processing and privacy: The result is calculated inside your browser and your data is not sent to any server.
How to use it
- Enter hex characters, how many, uppercase and add 0x prefix.
- The result appears straight away and updates as you edit.
- Copy the result, or copy a link that keeps the same values to share it.
How it is calculated
It draws ceil(length ÷ 2) bytes from crypto.getRandomValues, writes them as hex and trims to the requested length. Entropy = length × 4 bits.
Example
Inputs: Hex characters = 32, How many = 5, Uppercase = no, Add 0x prefix = no. Result: Strings: 434a5e7404133fe97123042317c875c9 1950c0b098083c82cf7ae87757081801 2ff277f9bd5f6743ad219d3464d0bf4d 0f669a30b5816f5b9ec4c6ac5c10f442 0524214122ff0deaa561eb5688c47940; Hex characters each: 32; Entropy per string: 128 bits.
Limits and caveats
- The strings change on every recalculation, so copy what you need before editing options.
- Nothing is stored anywhere; a key you generate here and lose cannot be recovered.
Questions about this tool
How long should an API key be?
32 hex characters give 128 bits, a common floor for secret tokens. Use 64 characters (256 bits) for signing keys such as HMAC-SHA256.
Is this randomness fit for security use?
Yes, it comes from crypto.getRandomValues, a cryptographically secure generator, not Math.random.
Does uppercase change the strength?
No, it is the same value in a different case, so each character still carries 4 bits.
