Colour picker — get HEX, RGB and HSL codes and lighter or darker shades

Choose a colour with the picker or type any CSS colour, and you get its codes in every common notation, whether white or black text reads better on it, and a ladder of lighter and darker shades.

Live demo · real result from this tool
Use the picker or type any CSS colour.

Every notation

HEX#3b82f6
RGB
rgb(59, 130, 246)
RGB (CSS 4)
rgb(59 130 246)
HSL
hsl(217.2, 91.2%, 59.8%)
HSV / HSB
hsv(217.2, 76%, 96.5%)
HWB
hwb(217.2 23.1% 3.5%)
CMYK (naive)
cmyk(76%, 47%, 0%, 4%)
Lab (D50)
lab(54.62% 8.76 -65.79)
LCH (D50)
lch(54.62% 66.37 277.59)
OKLab
oklab(62.31% -0.0332 -0.1851)
OKLCH
oklch(62.31% 0.188 259.81)
Display P3
color(display-p3 0.3047 0.5035 0.9338)
Nearest CSS name
dodgerblue (≈ #1e90ff)

Readability

Contrast with white
3.68:1
Contrast with black
5.71:1
Better text colour on it
Black

Lighter and darker (OKLCH lightness)

Processed on your device — nothing is uploaded.

How to use the colour picker

  1. Click the Colour box to open the picker, or type any CSS colour into the text box beside it: HEX, rgb(), hsl(), oklch() or a name such as tomato.
  2. The results update straight away. Copy the notation you need from Every notation.
  3. Check Readability to see the contrast with white and with black, and which text colour works better on top.
  4. Use the swatches under Lighter and darker to pick hover states, borders or backgrounds in the same hue.

What it does and when to use it

This page is for the moment you have a colour and need its code: matching a brand colour in a stylesheet, moving a shade from a design file into an app, or choosing a button colour. You get HEX, RGB (classic and the newer space-separated CSS form), HSL, HSV/HSB, HWB, a simple CMYK estimate, CIE Lab and LCH, OKLab and OKLCH, Display P3 and the nearest named CSS colour.

The readability box gives a quick verdict on text. For a full check of a text and background pair against each WCAG level, open the colour contrast checker. If your colour arrives in an unusual notation, the colour converter explains gamut warnings in more detail. To turn two picked colours into a background, try the CSS gradient generator.

How it works

The colour is read and stored as sRGB values, then converted to each notation with the formulas in the CSS Color Module Level 4. Lab and LCH use the D50 white point, as CSS does; OKLab and OKLCH use Björn Ottosson’s published matrices.

The contrast figures use the WCAG 2.x method: each colour’s relative luminance L is worked out from its RGB values, and the ratio is (L of the lighter + 0.05) ÷ (L of the darker + 0.05). It runs from 1:1 (no difference) to 21:1 (black on white).

Worked examples

These are results from the tool.

A mid blue, #3b82f6. It is rgb(59, 130, 246) and hsl(217.2, 91.2%, 59.8%). Contrast with white is 3.68:1 and with black 5.71:1, so the tool recommends black text. The shade ladder runs from #002090 (darkest) to #cfe7ff (lightest).

A short HEX code, #F0C. It expands to #ff00cc, which is rgb(255, 0, 204) and hsl(312, 100%, 50%). The nearest CSS name is fuchsia.

Limits and tips

  • CMYK is an estimate. It uses the simple device formula, not a printer’s ICC profile, so ask your printer for proofs.
  • Transparency cannot be set in the native picker. Type an 8-digit HEX such as #3b82f680 or an rgba() value instead.
  • Screens differ. The same code can look slightly different on two monitors; the code itself does not change.
  • Nothing is uploaded. The colour maths runs in your browser.

Frequently asked questions

How do I find the HEX code of a colour?
Click the colour box to open your device's picker and choose a colour, or type a value you already have such as rgb(59, 130, 246). The HEX code is shown first in the results, ready to copy.
Can I pick a colour from my screen or an image?
The picker opens your browser's or operating system's own colour chooser, and some of them include an eyedropper. To pull the main colours out of a photo, use the image colour extractor.
What does the short code
Three-digit HEX is shorthand where each digit is doubled, so
Why does the tool say "Black" is the better text colour on a bright blue?
It compares the WCAG contrast ratio of white text and black text on your colour. For
How are the lighter and darker shades made?
The tool changes the colour's lightness in OKLCH by 10, 20 and 30 points each way while keeping its hue. OKLCH lightness tracks how bright colours look to people better than HSL lightness does, so the steps look more even.

Written by the ToolsRift team · Last updated

Pages are drafted with AI assistance and checked by automated tests. How we write and check pages.

Was this tool useful?

Report a problem

Start typing to search every tool.

↑ ↓ to moveEnter to openEsc to close