Random Hex Number Generator
Generates a random whole number within a range you choose and shows it in hexadecimal (base 16) alongside the decimal value — useful for teaching, debugging or generating test values.
What this generator does
Produces a random number in base 16 with its decimal equivalent, for number-base practice and for testing hexadecimal parsing.
How to use this tool
- Set a minimum and maximum.
- Press generate for a random number shown in hex and decimal.
Worked examples
- Format
- 0x2F9 (decimal 761)
Common use cases
- Computer science teaching examples
- Practising decimal-to-hex conversion
- Generating test values for code or colour work
How this generator works
A value is drawn uniformly across your range and written in base 16 with a leading 0x, alongside the decimal value it came from. Width is not padded — a small value in range prints as a short hex string, the same way it would in decimal.
Limitations and good to know
- The prefix is always 0x. # and a bare value are also common in different contexts and are not offered here.
- Width is not padded to a fixed number of digits, so values of different sizes print at different lengths.
- Digits are shown in one case throughout. Hex is case-insensitive, and mixing cases makes comparison harder for no gain.
- The range stops at 9,007,199,254,740,991 — 1FFFFFFFFFFFFF, fourteen hex digits — which is the largest whole number a browser's ordinary number type holds exactly, so nothing longer can be drawn here.
- The minimum cannot go below 0. A negative value has no agreed hex notation to show alongside a 0x prefix, so the range here is unsigned only.
Related generators
- Random Binary Number GeneratorA number shown in binary, alongside its decimal value for reference.
- Resistor Colour Code CalculatorTurns a resistance into its colour bands and reads them straight back, with the nearest value actually manufactured shown alongside.
- Hex Color GeneratorA colour shown as its hex code, with a live swatch preview.