Skip to content

Random Hex Color

Generate random hex color codes.

Count
Output

No result

About Random Hex Color

Random Hex Color generates colour codes in the six-digit hexadecimal form, complete with the leading hash. Each result is ready to paste straight into a stylesheet, an inline style attribute or a design tool.

The draw is uniform across the whole colour space the format covers, which has a practical consequence worth expecting: the results look dark and muddy more often than they look pleasant. Most of that space sits at low to middling brightness, and genuinely light colours are a small fraction of it, so a batch of truly random values is not a palette — it is a set of candidates to pick from.

For anything beyond that, the values are exact and predictable in form: six hexadecimal digits, no shorthand, always with the hash prefix, which means they can be pasted into code without editing. Whether the result suits a design is a judgement the generator cannot make.

How to use Random Hex Color

  1. 1 Set how many colours you want.
  2. 2 Copy the values, one per line, including the hash prefix.
  3. 3 Pick the ones that suit the design rather than using the batch as a palette.

Frequently asked questions

Are the colours generated evenly across the spectrum?

Evenly across the hexadecimal space, which is not the same as evenly pleasing to the eye. Since most of that space is dark or desaturated, a batch of random colours tends to look muted, and light pleasant colours are relatively rare.

Are these accessible as text colours?

No guarantee. Contrast depends on the colour they are paired with, and a random draw has no awareness of what the background will be. Check any pairing with a contrast checker before shipping it as a text colour.

Can I get a colour in another format?

This tool emits hexadecimal only. The colour converter accepts a hex value and returns its equivalents in the other common notations, so a value taken from here can be translated when a format other than hex is needed.

Free, online, and private

Free to use

Random Hex Color is completely free. There is no account to create, no login, and no hidden charge or usage limit.

Runs online in your browser

It is a free online tool that runs entirely in your browser. Nothing to download or install — open the page and start using it right away.

Your data stays private

All processing happens locally on your device. Your input is never uploaded, stored, or tracked, so it never leaves your browser.

How Random Hex Color behaves in detail

These are the specifics of this implementation — the exact ranges, defaults and fixed settings you are working with.

Parameter Value
Output shape seven characters — # followed by six lowercase hex digits
Draw method Math.floor(Math.random() × 0xffffff), left-padded with zeros to six digits
Reachable values 0x000000 through 0xfffffe — 0xffffff is outside the reachable set
Batch output 1 to 100 colours, default 10, one per line

Compiled from the implementation of this tool and checked against it by itoolnet.

What Random Hex Color does not do

Knowing the edges of a tool saves more time than another list of its features. These are the cases where it will not do what you might expect.

  • Pure white #ffffff can never be produced, because the multiply-then-floor caps the value at floor(0.999… × 16,777,215) = 16,777,214, which is #fffffe — one colour in the space is unreachable by construction.
  • Only #rrggbb comes out. There is no alpha form, no #rgb shorthand, no rgb() or hsl() notation, and no way to constrain a batch to a palette, a hue or a lightness band.
  • Instances are drawn from Math.random() with no accessibility check, so a batch can produce colours that are unusable as text on white, and nothing pairs the values with their contrast ratio.

Tested and documented by itoolnet, the team that builds and maintains this site.

Share & embed this tool

Writing a guide or article? You are welcome to link to Random Hex Color with the snippet below. It is free, runs entirely in your browser, and needs no signup.