Random Hex Generator
Create random hex values of any length, formatted as a key, a nonce, a colour-style code or a byte array.
Processed locally in your browser/ Your data stays in your browser.
What is Random Hex Generator?
Hexadecimal writes each 4-bit nibble as one digit from 0 to 9 and a to f, so one byte is two hex digits. Random hex is the usual way to write keys, salts, nonces, session IDs and test data.
This generator asks the browser’s cryptographic random source for bytes and turns them into hex. You choose the length in bytes or in digits, up to 4,096, and up to 1,000 values at once. You can uppercase them, add a 0x, # or \x prefix, split them into groups of 2, 4, 8 or 16 digits with a separator, and export them as lines or as a JSON array.
How does it work?
- Pick the unit (bytes or hex digits) and the length: for example 16 bytes gives 32 digits and 128 bits.
- Set how many values you want and whether they should be uppercase.
- Choose a prefix and grouping, such as 0x before every 2-digit group to get a C-style byte list.
- Click Generate, then copy the values or download them as text or JSON.
Common use cases
- Making a 32-byte hex secret for an HMAC or a JWT signing key in a development environment.
- Generating 12-byte hex nonces or IVs for test vectors.
- Filling fixtures with random tokens or hash-like identifiers.
- Producing byte arrays such as 0x1f 0xa3 … to paste into firmware or C code.
Examples
Create random hex values of any length, formatted as a key, a nonce, a colour-style code or a byte array.
Privacy
Random Hex Generator runs entirely in your browser. The text or files you provide are processed on your device and are not uploaded, logged or stored on our servers.
Limitations
A random hex string is only as secret as your handling of it: do not reuse a value you copied from any web page as a production secret without checking your own security requirements.
Frequently asked questions
Is there any bias in the output?
No. Each hex digit maps to exactly 4 random bits, and 16 divides 256 evenly, so every digit from 0 to f is equally likely and no rejection sampling is required.
What happens with an odd number of hex digits?
The tool draws one byte more than needed and drops the last 4 bits, so an odd length such as 7 digits is still uniformly random.
How is this different from the random bytes generator?
Random bytes outputs one value in hex, Base64 or decimal. This tool is built for hex: many values at once, digit-based lengths, prefixes, grouping and separators.
Related tools
Random Bytes Generator
Get raw random bytes from the browser’s secure generator, formatted the way your code expects.
Developer Tools
Random String Generator
Produce random tokens, IDs and test strings from the character set you need.
Developer Tools
Text to Hex Converter
See the exact bytes behind any text, from a quick "Hello" to emoji, formatted the way your code or debugger expects.
Encoding & Decoding
Hex to Text Converter
Paste hex bytes from a dump, a log or a source file and read the text they spell.
Encoding & Decoding
Hex to Decimal Converter
Read hexadecimal values as decimal numbers, unsigned or as signed two’s complement integers of 8 to 64 bits.
Developer Tools
UUID Generator
Create one or thousands of universally unique identifiers in any version, formatted exactly the way your code or database expects.
Developer Tools
Password Generator
Create strong, truly random passwords with the character sets you choose. Nothing is sent or saved.
Developer Tools
Base Converter (Base 2 to 36)
Type a number, pick its base and the base you want, and get an exact result with a quick view in binary, octal, decimal, hexadecimal and base 36.
Developer Tools