Random Hex Generator

Generate random hexadecimal strings of any length.

0 hex values

Random Hex Generator

Generate random hexadecimal strings of any length – from a 6-digit color code to 64-digit 256-bit secrets. Hex values use the sixteen digits 0–9 and a–f, and each digit carries 4 bits of randomness. Choose the length, how many values you need, upper or lower case, an optional 0x prefix and digit grouping.

Digits Bits Typical use
6 24 CSS color without the #
8 32 short IDs, CRC-like values, 32-bit integers
16 64 database keys, trace IDs
32 128 API tokens, cache-busting hashes, request IDs
40 160 Git-style commit hashes for test data
64 256 secrets, HMAC keys, blockchain-style addresses

Options explained

  • Group digits inserts a space every 2, 4 or 8 digits, which makes long values easier to compare and read aloud.
  • Uppercase prints A–F instead of a–f.
  • 0x prefix produces literals for C, C++, Java, JavaScript, Python and Go.

Why use random hex?

Hex strings are the standard way of writing binary data as text. Developers use them for tokens, salts and identifiers, testers use them to fill hash and checksum fields with realistic data, and designers use 6-digit values as random colors. Because each digit is drawn uniformly from the browser's secure generator, there are no patterns and no bias toward particular digits.

Privacy

Nothing is uploaded. Values are generated in your browser, shown once, and can be copied or downloaded as a text file.

For a GUID format with dashes use the GUID Generator; for separate bytes in several formats, use the Random Byte Generator.

Frequently Asked Questions

Each hexadecimal digit encodes 4 bits. A 32-digit value carries 128 bits of randomness, the same as a UUID's raw size, and 64 digits carry 256 bits – a common length for API keys and secrets.

Yes. Digits come from crypto.getRandomValues, so values are unpredictable. 32 or more digits are a sensible minimum for session IDs, reset tokens and nonces.

No. Hexadecimal is case-insensitive; 3F and 3f are the same number. Pick the case your code style or system expects.