File & privacy

Random Hex Generator

Random Hex Generator

Secure random hexadecimal strings from 128 to 1024 bits.

About this tool

About Random Hex Generator

Need a random hex value for an encryption key, a token, a salt, a test fixture or a config file? This generator produces lowercase hexadecimal strings from your browser's cryptographically secure random generator, the same quality as openssl rand -hex. Choose the size in bits (128, 192, 256, 384, 512 or 1024) and you get exactly twice as many hex digits as there are bytes: a 256-bit key is 64 characters. Make up to 50 at once, copy one or all, or download them. Switch Output to .env line to get NAME=value lines ready for an environment file. Hex is the format OpenSSL's -K and -iv options, most database tools and many frameworks expect for raw keys, and it survives copy and paste anywhere. If you need a shorter text form, switch the encoding to Base64. Values are generated on your device and never leave it.

Built and maintained by Abhi JainUpdated

How to Generate Random Hex

  1. 1

    Choose the size

    Pick a Key size: 128-bit gives 32 hex digits, 256-bit gives 64.

  2. 2

    Keep Hex selected

    Leave Encoding on Hex, and choose Key only or .env line.

  3. 3

    Copy

    Copy a value, Copy all, or Download the list.

Random Hex Generator: questions and answers

How many hex characters is a 256-bit key?

64. Each byte is two hex digits, and 256 bits is 32 bytes.

Is this the same as openssl rand -hex 32?

Yes in format and quality: 32 cryptographically random bytes printed as 64 lowercase hex digits. Here they come from crypto.getRandomValues, which the operating system seeds.

Can I get uppercase hex?

The output is lowercase, which every parser accepts. Hex is case-insensitive, so you can uppercase it in your editor if a system insists.

Is a random hex string a good password?

It is strong but awkward to type. A 32-digit hex string has 128 bits of entropy. For passwords people type, a passphrase is friendlier.