Random Colour Generator

Press Generate for a random colour with its hex, RGB and HSL codes, the closest named colour and whether black or white text reads best on it. Make a palette of up to 24.

History (this visit only)

Nothing yet. Results appear here.

    Quick answer: in Any colour mode, every one of the 16,777,216 colours a screen can show (256 × 256 × 256) is equally likely. In Named CSS colours mode, you get one of the 148 colours that have a name in web design, such as tomato or rebeccapurple.

    Examples

    You want…Setting
    A colour to design around1 colour, any
    A five-colour palette to try out5 colours, any, no repeats
    A colour with a name for a game or storyNamed CSS colours
    Team colours4 named colours, no repeats

    What the codes mean

    • Hex: red, green and blue as two-digit hexadecimal numbers, e.g. #FF7F50 (coral).
    • RGB: the same three channels from 0 to 255.
    • HSL: hue (0–360°), saturation and lightness, which is easier to adjust by hand.
    • Closest named colour: the nearest of the 148 CSS colours, measured in the CIELAB colour space, which roughly follows how different two colours look to the eye.
    • Best text: black or white, whichever has the higher WCAG contrast ratio. 4.5:1 is the usual minimum for body text.

    How it works

    Each colour is one random whole number from 0 to 16,777,215, drawn with your browser’s cryptographic random generator and unbiased rejection sampling, then split into red, green and blue. Named colours are picked from the list in the W3C CSS Color specification. More detail.

    Questions

    Why do so many random colours look muddy?

    Truly random colours are spread evenly across all combinations, and most of those are mid-tones. For brighter results, generate several and keep the ones you like, or use named colours.

    Is “gray” the same as “grey”?

    Yes. CSS accepts both spellings for every grey, with identical values, so both are in the named list.

    Page reviewed 1 December 2026.