About the Random Hex Generator
Hexadecimal, or hex, is the number system with sixteen digits, 0 to 9 and A to F, used to write binary data compactly. Each hex digit stands for four bits and a pair of digits makes one byte. This generator creates random hex strings of any length from 1 to 4,096 digits, for encryption keys, session identifiers, nonces, salts, test data and colour codes. Choose capital or small letters, a 0x prefix, and spaces between pairs or blocks to match the format you need. The digits come from your browser's secure random generator and are never sent anywhere.
Updated October 2026
How to use the Random Hex Generator
- 1Enter the number of hex digits in each string. 32 digits make a 128-bit value.
- 2Enter how many strings you want.
- 3Choose grouping, capital letters and the 0x prefix if needed.
- 4Press Generate.
- 5Copy the strings or download them as a text file.
Typical lengths
- 2 digits: one byte.
- 8 digits: 32 bits, like a CRC checksum.
- 16 digits: 64 bits.
- 32 digits: 128 bits, like a UUID without dashes.
- 64 digits: 256 bits, like a SHA-256 hash or an AES-256 key.
Why hex is handy
Hex gives a compact, human-readable way to write binary data. A 256-bit key written in binary needs 256 characters, but only 64 in hex. Programmers can convert between the two easily because each digit maps onto exactly four bits, which is not true of decimal numbers. That is why memory addresses, colours, hashes and MAC addresses are almost always written in hex.
Choose the grouping that matches your target format. Pairs separated by spaces look like a hex dump or a MAC address without the colons. Groups of eight digits mirror the way hashes and UUID parts are often shown. If you need separators such as dashes or colons, paste the output into the Find and Replace Text tool and replace the spaces. Keep in mind that a hex string is text: to use it as raw bytes, a program must decode each pair into a byte first.
Random hex is also handy for creating fake data in bulk. Colour codes for design mock-ups, memory addresses in debugging examples, transaction hashes in blockchain demos and checksums in test fixtures all use the format. Pick the number of digits that matches the real thing, such as 40 for a Git commit hash or 64 for a SHA-256 hash, and you get believable placeholders that are obviously artificial to anyone who looks, because no real data produced them.
Using the result
For keys and secrets, generate on a device you trust, copy once into a password manager or secrets store and don't keep copies lying around. For test data, use grouped output with spaces to mimic dumps of binary data. If you need a unique ID rather than a secret, the UUID Generator produces standard identifiers with proper formatting.
Related tools
The Random String Generator picks from letters and symbols, the Number Base Converter changes between hex, binary and decimal, the Hash Generator makes digests from text, and the Color Converter switches colour formats.
Features
- 1 to 4,096 hex digits
- Up to 500 strings
- Capital or small letters
- 0x prefix option
- Groups of 2, 4 or 8 digits
- Secure random source
Frequently asked questions
How many digits make a 128-bit or 256-bit key?
Each hex digit is 4 bits. A 128-bit key is 32 hex digits and a 256-bit key is 64 hex digits. For an AES-256 key, generate 64 digits.
What is hexadecimal?
A base-16 number system. After 9 it continues with A for 10, B for 11 and so on up to F for 15. Hex is popular in computing because two digits describe exactly one byte.
Can I use these hex strings as passwords?
A long random hex string is strong, but not easy to type. For passwords, the Password Generator uses a bigger character set. Hex is better suited to keys, tokens and IDs.
How do I make a random hex colour?
Generate 6 digits and add a # in front, for example #3FA7C2. For a transparent colour, use 8 digits, with the last two as the alpha value.
What does the 0x prefix mean?
In many programming languages, 0x tells the reader that the digits are hexadecimal. Tick the box to add it to each string.
Is the output truly random?
It comes from the browser's cryptographically secure generator, which draws on operating-system entropy. That is suitable for keys and tokens, but check your own security requirements for high-stakes uses.