Random Hex Generator

A random hexadecimal number to copy, two, four or six digits long, in capital letters.

Between 0 and 255

  1. 49

73 in decimal · 0100 1001 in binary · Odd · 1 of 256 possible hex numbers

Your range type the lowest and highest

256 hex numbers from 0 to 255

Options
Quick ranges
More optionsorder

How it works

This hexadecimal random number generator draws a whole number, every value equally likely, and writes it in base 16. Leading zeros stay, so ten is 0A and not A. The table under the tool gives the worth of each digit.

Read the full guide

How to read a hex number

Say the result is B2. The right digit counts ones and the left digit counts sixteens. In the table B is eleven, so B2 = 11 × 16 + 2 = 178. With four digits the places are worth 4,096, 256, 16 and 1.

Generate a random hex number of 4 or 6 digits

After the first draw, tap 4 digits for 0000 to FFFF or 6 digits for 000000 to FFFFFF, the length of a web color code. How many gives several at once.

Tips
  • One hex digit is four bits, so two digits make a byte: F is 1111 and FF is 1111 1111.

Questions and answers

What do the letters A to F mean in hexadecimal?

They are digits. Base 16 needs sixteen of them and there are only ten numerals, so A stands for ten, B eleven, C twelve, D thirteen, E fourteen and F fifteen.

How many values can a 2-digit hex number have?

256, from 00 to FF, because 16 × 16 = 256. Four digits give 65,536 values and six digits give 16,777,216.

Is every hex number equally likely?

Yes. The page draws one whole number from the range, each with the same chance, and then writes it in base 16. That suits test data and lessons, not passwords or keys.

All 16 digits

The ten numerals 10

  • 0 Zero in decimal, 0000 in binary.
  • 1 One in decimal, 0001 in binary.
  • 2 Two in decimal, 0010 in binary.
  • 3 Three in decimal, 0011 in binary.
  • 4 Four in decimal, 0100 in binary.
  • 5 Five in decimal, 0101 in binary.
  • 6 Six in decimal, 0110 in binary.
  • 7 Seven in decimal, 0111 in binary.
  • 8 Eight in decimal, 1000 in binary.
  • 9 Nine in decimal, 1001 in binary.

The six letters 6

  • A Ten in decimal, 1010 in binary.
  • B Eleven in decimal, 1011 in binary.
  • C Twelve in decimal, 1100 in binary.
  • D Thirteen in decimal, 1101 in binary.
  • E Fourteen in decimal, 1110 in binary.
  • F Fifteen in decimal, 1111 in binary.
How this list was compiled

The 16 digits of base sixteen, 0 to 9 and then A to F, each with its value in decimal and as four bits. Computed by script (Python format and int) and never typed; the script turns every digit and every bit pattern back into its value and checks the two agree. The worked example in the guide, B2 = 11 x 16 + 2 = 178, is recomputed by the same script. No outside fact is stated. Licence: own work