Random Hex Generator

Generate random hexadecimal strings (0-9 and a-f) of any length: 32 characters for a request ID, 40 for a test commit hash, 64 for a 256-bit token. Choose lowercase or uppercase, make one or a few hundred, and copy or download them. The digits come from your browser's secure random generator.

What to make
characters
Randomness
128 bits
Length
32 chars
Character set
16
Generated
0

Generating runs in your browser. What you type never leaves this device.

Features

  • Any length from 1 to 1,024 hex characters

  • Lowercase (0-9, a-f) or uppercase (0-9, A-F)

  • Up to 500 values at once, one per line

  • Each hex character carries 4 bits: 32 characters = 128 bits, 64 = 256 bits

  • Switch to Secret key mode for byte-exact keys in hex, Base64 or Base64URL

  • Secure randomness from crypto.getRandomValues

  • Runs in your browser: nothing is sent or saved

Where random hex is used

IDs and trace tokens

Request IDs, correlation IDs and trace IDs in logs are often 16 or 32 hex characters.

Test fixtures

Fake commit hashes (40 characters), fake MD5 or SHA-256 values (32 or 64) for test data and screenshots.

Keys and salts

A 64-character hex string is a 256-bit key, the format many libraries and config files expect.

Colour codes

Six hex characters make a colour code; for colours with previews use the [random color generator](/tools/random-color-generator).

Hex lengths at a glance

Characters, bytes and bits

  • 2 hex characters = 1 byte = 8 bits.
  • 16 characters = 64 bits, 32 = 128 bits (the size of a UUID or an MD5 value), 40 = 160 bits (SHA-1, Git commit), 64 = 256 bits (SHA-256, AES-256 key).

Hex or Base64 for a key?

Both hold the same bytes. Hex is longer (two characters per byte) but uses only safe characters and is easy to compare by eye. Base64 is a third shorter. If a library asks for a 32-byte key, a 64-character hex string or a 44-character Base64 string are the same size; check which form it reads. The secret key generator makes either.

Random Hex Generator - FAQ