Hex Colour Codes

Preview a hex colour, see its RGB and HSL values and contrast, and keep a palette.

Hex Colour Codes— runs in your browser
Aa
Hex
RGB
HSL
On white
On black

Palette

    How to use it

    1. Type a hex code such as 005ca3 or #fa0, or use the colour picker.
    2. Read off the RGB and HSL values and the contrast with white and black text.
    3. Press Save to palette to keep a colour. Click a saved colour to load it again.

    About

    Hex codes describe a colour as three pairs of hexadecimal digits for red, green and blue. This shows the colour large enough to judge, converts it to the rgb() and hsl() forms CSS also accepts, and works out its contrast ratio with white and black text.

    The contrast figures use the WCAG 2 formula. Normal text needs at least 4.5:1 to pass level AA, and large text needs 3:1. The preview uses whichever of black or white reads better.

    Your palette is saved in this browser’s local storage, so it’s still there next time but isn’t shared with anyone.

    Questions

    What's a three-digit hex code?

    A shorthand where each digit is doubled, so #fa0 is the same as #ffaa00.

    Where is my palette stored?

    Only in this browser. Clearing site data or using another device starts a fresh palette.