Color Picker

    Pick a colour and copy it as HEX, RGB, RGBA, HSL or HSLA, with its WCAG contrast against white and black worked out for you.

    Runs in your browser. Nothing is uploaded.No signup requiredBuilt byDATAMETA LAB

    Pick a Color

    #2563EB

    Color Formats

    hex

    #2563EB

    rgb

    rgb(37, 99, 235)

    rgba

    rgba(37, 99, 235, 1)

    hsl

    hsl(221, 83%, 53%)

    hsla

    hsla(221, 83%, 53%, 1)

    WCAG Contrast Check

    White Text

    Contrast Ratio: 5.17:1

    AA Large ✓AA ✓AAA ✗

    Black Text

    Contrast Ratio: 4.06:1

    AA Large ✓AA ✗AAA ✗

    How to use this tool

    1. Click the large colour swatch to open your operating system's colour picker, or type a hex code straight into the field.
    2. Every format updates together: HEX, RGB, RGBA, HSL and HSLA.
    3. Click the copy button beside whichever format your code needs.
    4. Read the contrast panel to see how the colour scores against white text and against black text.
    5. A ratio of 4.5:1 or better passes WCAG AA for body text; 3:1 passes for large text; 7:1 passes AAA.

    About this tool

    Pick a colour, get every code you might need for it, and find out immediately whether text will be readable on top of it. The conversions are the easy half. HEX is what you paste into CSS and design tools. RGB says the same thing as three 0 to 255 channels, which is what canvas APIs and most image libraries want. RGBA and HSLA add an alpha channel for transparency. HSL describes a colour as hue, saturation and lightness, which is far easier to reason about when you are building a palette: keep the hue, drop the lightness, and you have a matching darker shade without guessing at hex digits. The contrast half is the part most pickers leave out, and it is the part that decides whether a colour is usable. The panel computes the WCAG contrast ratio of your colour against white and against black using the official relative luminance formula, not a rough brightness estimate. Ratios run from 1:1 for identical colours to 21:1 for pure black on pure white. WCAG AA asks for 4.5:1 for normal body text and 3:1 for large text; AAA asks for 7:1 and 4.5:1. That matters because mid-tone colours are a trap. A medium blue or green often fails against both white and black text, which means no text colour works on it and the colour needs to move lighter or darker before it can be a background at all. Knowing that while you are choosing costs nothing; discovering it after a site is built is expensive. Nothing here is uploaded. If you need to compare two specific colours rather than a colour against white and black, use the Contrast Checker.

    Frequently asked questions

    How do I convert a HEX colour to RGB?

    Type or paste the hex code into the picker and read the RGB line, then click its copy button. Each pair of hex digits is one channel in base 16, so #FF8800 is red 255, green 136, blue 0. The tool does the arithmetic in both directions as you change the colour.

    What is the difference between HEX, RGB and HSL?

    They describe the same colour three ways. HEX and RGB both give red, green and blue amounts, one in base 16 and one in decimal. HSL gives hue, saturation and lightness instead, which is much easier to work with when you want a lighter or darker version of a colour: hold the hue and saturation, change the lightness, and the result stays in the same family.

    What do RGBA and HSLA add?

    An alpha channel, which is opacity. The final value runs from 0 for fully transparent to 1 for fully opaque. Use them when a colour needs to sit over something else, such as a tint over an image or a translucent overlay.

    What contrast ratio do I need for accessible text?

    WCAG level AA requires 4.5:1 for normal body text and 3:1 for large text, which means 18pt and above, or 14pt bold and above. Level AAA raises those to 7:1 and 4.5:1. The panel shows the ratio against both white and black text and marks which levels pass.

    Why does my colour fail against both white and black text?

    Because it sits in the middle of the lightness range, roughly equidistant from both. Mid-tone blues, greens and reds do this constantly. There is no text colour that will rescue it: the background itself has to move meaningfully lighter or darker before anything can be read on top of it.

    How is the contrast ratio calculated?

    With the WCAG relative luminance formula: each channel is normalised, gamma-corrected, then weighted 0.2126 red, 0.7152 green and 0.0722 blue. The ratio is the lighter luminance plus 0.05 divided by the darker luminance plus 0.05. The green weighting is why a bright green looks far lighter to the eye than a bright blue with the same numeric value.

    Can I pick a colour from an image or from my screen?

    The swatch opens your operating system's own colour dialog, and on most desktop systems that dialog includes an eyedropper you can use to sample any pixel on screen, including one inside an image. What is available depends on your OS rather than on this page.