RandomNr

Bases and Numerals

Random Hex Number Generator

Generate random hexadecimal values of any length, useful for colours, keys, identifiers and test fixtures.

Random Hex Generator

3F9A2C7E

8 digit hex

How many values

Length

Generate random hexadecimal

This tool produces random hex values of any length. Hex is base 16, using the digits 0 to 9 and the letters A to F, and it is the everyday notation for colours, keys, identifiers and raw data. Set the number of digits and generate one value or many.

Options for every use

Add a 0x prefix when the value goes into code, and switch between upper and lower case to match a style. Six hex digits make a colour like 3F9A2C, while longer strings suit keys and tokens for test fixtures.

Fair and private

Every hex digit is drawn from the browser cryptographic random source, so the value is unpredictable. Nothing leaves your device.

Popular generators

Frequently asked questions

What is hexadecimal

Base 16, using 0 to 9 and A to F. Two hex digits make one byte, which is why hex is common for colours and raw data.

Can I add a 0x prefix

Yes. Tick the option to prefix each value with 0x, the form used in most programming languages.

Can I choose the case

Yes. Switch between upper and lower case letters to match your code style.

Can I make a colour code

Yes. Six hex digits give a colour value such as 3F9A2C, ready to paste into CSS or a design tool.

Is it free

Yes, free and with no sign up.

Related generators

Convert a value to hex with the number base converter, or draw binary or octal.