Design Tools
Online Color Picker with HEX, RGB and HSL Codes
Pick a colour or type any CSS colour value to get HEX, RGB, HSL, HWB, HSV and CMYK codes, the nearest CSS colour name and contrast against white and black.
How to use Online Color Picker with HEX, RGB and HSL Codes
Type a colour value such as #1a73e8, rgb(26 115 232) or tomato, or choose one with the colour picker. Every format updates instantly; tick Upper-case HEX if your style guide wants capitals.
- Enter or pick a colourType HEX with 3, 4, 6 or 8 digits, rgb(), hsl(), hwb() or a CSS colour name, or use the picker.
- Read the converted codesHEX, short HEX, RGB in both syntaxes, HSL, HWB, HSV and an approximate CMYK value are listed together.
- Check text contrastSee the ratio against white and against black, and which of the two reads better on top of the colour.
How the colour codes relate
A six-digit HEX code is three pairs of base-16 digits: in #1a73e8, 1a is 26, 73 is 115 and e8 is 232, giving rgb(26, 115, 232). The same colour is hsl(214, 82%, 51%), hwb(214 10% 9%) and hsv(214, 89%, 91%). Three-digit shorthand doubles each digit, so #fff is #ffffff, and an eight-digit code adds alpha: #1a73e880 is rgba(26, 115, 232, 0.502). CMYK comes from a simple formula with no colour profile, so treat cmyk(89%, 50%, 0%, 9%) as a starting point, not a print-ready value.
Contrast figures and the nearest colour name
Contrast uses the WCAG 2.x formula. #1a73e8 scores 4.51:1 against white and 4.66:1 against black, so black text is suggested on it, although white also clears the 4.5:1 AA level for normal text. The nearest name is found by colour distance across the 148 CSS named colours: #1a73e8 comes out as royalblue, marked approx. because it isn't an exact match, while tomato returns tomato. A translucent colour is first laid over white before its contrast figures are worked out.
Accuracy and data handling
Review colours, dimensions and visual settings in the real component, type size and target display. The calculation runs in your current browser; the tool code does not send the input to a processing API.
FAQ
How do I convert a 3-digit HEX colour like #fff?
Type it in as it is. Each digit is doubled, so #fff becomes #ffffff and #1a3 becomes #11aa33. A fourth digit is read as alpha, so #fff8 is white at about 53% opacity.
Should I use RGB or HSL in CSS?
Browsers support both. RGB maps directly to values from design files, while HSL makes variations easy: keep the hue and saturation and change only the lightness to get a hover or pressed shade.
Can I pick a colour from anywhere on my screen?
The picker opens your browser's own colour dialog. In some desktop browsers, such as Chrome and Edge, that dialog includes an eyedropper for sampling the screen, and the chosen colour is then converted here.
More Design Tools
Related toolsCreate linear, radial and conic CSS gradients, including gradient text, with a live preview.
Make a 50–900 colour scale or a colour-wheel scheme and export it as CSS, SCSS or Tailwind.
Get the WCAG contrast ratio, AA and AAA results and the nearest passing text colour.
Convert HEX to RGB and RGB to HEX, one colour or up to 200 at a time.
Reduce sizes to a ratio, resize proportionally and get CSS aspect-ratio code.
Design a CSS box-shadow with offsets, blur, spread, opacity and inset, previewed live.