Color Picker: Get Exact Colour Codes from Any Image or Screen
Use this color picker to grab a pixel from a photo, screenshot or your screen and copy it as HEX, RGB, HSL or OKLCH, then build shades, palettes and contrast-safe pairs. Your images stay on your device.
Color picker
Choose a color
Paste any format: HEX (3, 4, 6 or 8 digits), rgb(), hsl(), hsv(), oklch(), cmyk() or a CSS color name.
Current color
- HEX
- RGB
- HSL
- HSV / HSB
- OKLCH
- CMYK ≈
CMYK here is the plain RGB formula, not a print (ICC) profile — ask your printer for a proof before a print run.
Pick a color from an image
Your image is read only inside this browser tab. It is never uploaded or sent anywhere.
Drop an image here, paste it (Ctrl+V / ⌘V) or
PNG, JPEG, WebP, GIF, AVIF, BMP, SVG; HEIC works where your browser can open it. Up to 40 MB.
Tip: single pixels in photos and JPEGs are noisy — use a 3×3 or 5×5 average for a brand color.
Dominant colors
Your palette
Collect colors from the picker, the image or the swatches below. Saved only in this browser.
No colors yet — press “+ Add to palette” or “+ Palette” after picking from an image.
Shades, tints and tones
Even lightness steps (OKLCH)
Same hue and chroma, lightness in equal 8% steps — even-looking steps for UI palettes.
Tints (mixed with white)
Shades (mixed with black)
Tones (mixed with gray)
Color harmonies
Complementary
Analogous
Triadic
Split-complementary
Tetradic (rectangle)
Square
Contrast checker (WCAG 2.2)
contrast ratio
- AA · normal text 4.5:1
- AA · large text 3:1
- AAA · normal text 7:1
- AAA · large text 4.5:1
- UI parts & icons 3:1
Normal text — the quick brown fox jumps over the lazy dog.
Large text 24px
Button
WCAG compares the exact ratio: 4.499:1 does not pass 4.5:1. Large text = 24px, or 18.5px bold.
Use this color in code
Keyboard shortcuts
- C Copy HEX
- R Random color
- A Add to palette
- ←→↑↓ Move sliders or the image picker (Shift = ×10)
- Enter Pick the pixel under the image cursor
- Esc Close this window
This color picker reads the exact pixel you point at in an image, or anywhere on your screen in browsers that allow it, and gives you the colour as HEX, RGB, HSL, HSV, OKLCH and an approximate CMYK, with alpha when the pixel has it. From there you can build an OKLCH shade ramp, tints, shades and colour harmonies, collect several picks into a palette, check text contrast against WCAG and export everything as CSS, SCSS or JSON. Your image is decoded and sampled in your browser; it is never uploaded.
How to use the color picker
- Load an image. Drop a file, choose one, or paste a screenshot from the clipboard. PNG, JPEG, WebP, GIF, AVIF, BMP and SVG up to 40 MB work everywhere; HEIC only where your browser can open it, and a file it cannot open gets a plain message instead of a blank screen. The tool samples the full-resolution bitmap, not the scaled copy you see on screen. Only images above 16.7 megapixels are read from a reduced copy, and the tool tells you so. It also lists the dominant colours of the picture with their share.
- Aim with the loupe. The magnifier shows the pixel grid around your mouse pointer or finger, so you can see whether you are on a flat area or on an anti-aliased edge. From the keyboard, the arrow keys move the pick point one pixel (Shift: ten) and Enter picks it.
- Pick a sample size. 1 pixel gives the raw value; a 3×3 or 5×5 average smooths JPEG noise and photo grain. I use 1 pixel for logos and UI, an average for photos.
- Or pick from the screen. In Chromium browsers on a computer (Chrome, Edge, Opera) the eyedropper button lets you click any pixel on your display, even outside the browser window. Firefox and Safari have no such feature; the tool says so and points you to the image route.
- Or type a code. Paste
#1d4ed8(3, 4, 6 or 8 digits),rgb(29 78 216),hsl(224 76% 48%), anhsv(),oklch()orcmyk()value, or a CSS colour name, and every other format updates. A switch toggles the output between modern space-separated CSS and legacy commas. - Collect and export. Add picks to the palette board, which is saved in your browser, and copy or download it as CSS custom properties, SCSS, JSON or a plain HEX list.
HEX, RGB, HSL, HSV and OKLCH: which code to use
| Format | Value | What the numbers mean | When I reach for it |
|---|---|---|---|
| HEX | #1D4ED8 | Red, green, blue as two hex digits each (00–FF). 8 digits add alpha last: #RRGGBBAA. | Handing a colour to anyone: Figma, CSS, brand sheets. |
| RGB | rgb(29 78 216) | The same channels in decimal, 0–255. | Channel maths in code; the legacy comma form rgb(29, 78, 216) is one switch away. |
| HSL | hsl(224.3 76.3% 48%) | Hue angle, saturation, lightness. A geometric remap of RGB, not perceptual. | Quick hue tweaks by hand. |
| HSV / HSB | hsv(224.3 86.6% 84.7%) | Hue, saturation, value (brightness). Not a CSS function. | Matching the picker square in Photoshop or Figma. |
| OKLCH | oklch(48.82% 0.2172 264.38) | Perceived lightness 0–100% (or 0–1), chroma about 0–0.4, hue 0–360. | Design tokens, shade ramps, accessible palettes. |
| CMYK | cmyk(87% 64% 0% 15%) | Naive ink split with no printer profile. | A starting point to discuss with a printer, never a final print value. |
OKLCH comes from CSS Color Module Level 4 and is the cylindrical form of the Oklab space. Its L axis is built to track how bright a colour looks, which is exactly what HSL lightness gets wrong. Pure yellow and pure blue are both L 50% in HSL, yet one is almost white to the eye and the other is dark:
That is why I build every shade ramp in OKLCH: equal steps in L look like equal steps, across hues, and text contrast becomes far more predictable.
Worked example: converting #1D4ED8
HEX to RGB. Split into pairs and read each as base 16:
RGB to HSL. Scale to 0–1: R = 0.1137, G = 0.3059, B = 0.8471. Max = 0.8471 (blue), min = 0.1137, difference d = 0.7333.
S = d / (1 − |2L − 1|) = 0.7333 / 0.9608 = 0.7633 → 76.3%
H = 60° × ((R − G) / d + 4) = 60° × 3.7380 = 224.3° → hsl(224.3 76.3% 48%)
RGB to HSV. V = max = 84.7%; S = d / max = 0.7333 / 0.8471 = 86.6%; hue is the same 224.3°, so hsv(224.3 86.6% 84.7%).
RGB to CMYK. K = 1 − max(R, G, B) = 1 − 0.8471 = 15.3%; then C = (1 − R − K) / (1 − K) = 86.6%, M = 63.9%, Y = 0%, shown as cmyk(87% 64% 0% 15%). That is plain arithmetic, not an ink profile.
RGB to OKLCH. Each channel is linearised (undoing the sRGB gamma), converted to Oklab through two fixed matrices with a cube root in between, then a and b become chroma and hue. The result is oklch(48.82% 0.2172 264.38), which CSS also accepts as oklch(0.4882 0.2172 264.38). The OKLCH hue (264°) differs from the HSL hue (224°) because the hue wheels are laid out differently.
Why a picked colour can be off by a few values
Two people picking the same brand colour can get #1D4ED8 and #1E4FD6 without either tool being wrong:
- JPEG compression stores colour at reduced resolution and in 8×8 blocks, so neighbouring pixels in a flat area wander by a few units. If nine red values read 27, 29, 31, 28, 30, 29, 26, 32, 29, their average is 261 ÷ 9 = 29, which is the value the designer most likely used.
- Scaled screenshots blend pixels. A Retina screenshot shrunk to half size mixes every 2×2 block, so thin text and edges turn into in-between colours.
- Anti-aliasing on edges and type creates transition pixels that belong to neither colour. Pick from the middle of a flat fill, never the border.
- The screen eyedropper returns what is displayed, after colour management and features such as Night Shift or True Tone, and it reports an sRGB HEX. The file value can differ; for exact values, pick from the image itself.
Transparency. In #1D4ED880 the last pair is alpha: 80 hex = 128, and 128 ÷ 255 = 0.502, so about 50% opacity. Alpha is last in CSS; Android's ARGB puts it first, a common mix-up. What you see depends on the background: over white each channel becomes 0.502 × colour + 0.498 × 255, giving roughly #8EA6EB. The tool keeps the alpha of PNG, WebP and other formats that have it and warns you when the pixel you picked is not fully opaque. A fully transparent pixel is reported as transparent instead of being misread as black, and averages are weighted by alpha so see-through pixels do not drag the result towards black.
Shades, tints and palettes
Classically a tint is a colour mixed with white, a shade with black and a tone with grey. Mixing in RGB gives uneven steps, so the ramp here keeps hue and chroma in OKLCH and moves lightness in ten equal steps from L 96% down to 24%, reducing chroma only where a colour would fall outside the sRGB gamut; the step closest to your colour is marked. The tint, shade and tone rows are plain sRGB mixes with white, black and mid-grey in 10% steps, handy for quick hover and disabled states. You can copy the ramp as CSS variables or carry on in CSS itself with relative colour syntax, such as oklch(from var(--brand) calc(l + 0.15) c h).
For each colour the tool also names the nearest of the 148 CSS named colours, all of which are sRGB, measuring the distance in OKLab, and tells you whether the match is exact (#663399 is exactly rebeccapurple, #808080 is gray, also spelled grey) or only the nearest (#1D4ED8 is nearest to royalblue).
Six colour harmonies are built by rotating the hue: complementary, analogous, triadic, split-complementary, tetradic and square. Tetradic here is the rectangle (+60°, +180°, +240°), which is not the square (+90°, +180°, +270°). For #1D4ED8 the complement is #D8A71D, the second tetradic colour is #A71DD8 and the second square colour is #D81DAC. Each set copies as CSS variables.
Checking contrast against WCAG
The WCAG contrast ratio is (L1 + 0.05) / (L2 + 0.05), where L1 is the relative luminance of the lighter colour and L2 of the darker one. Luminance is 0.2126 R + 0.7152 G + 0.0722 B on linearised sRGB channels, which is why green counts ten times as much as blue.
- AA: 4.5:1 for normal text, 3:1 for large text (at least 18 pt, or 14 pt bold).
- AAA: 7:1 for normal text, 4.5:1 for large text.
- Non-text contrast for icons, input borders and focus rings: 3:1.
WCAG says the computed ratio must not be rounded, so 4.499:1 fails 4.5:1. The classic case is two neighbouring greys on white. For #767676: 76 hex = 118, 118 ÷ 255 = 0.4627, linearised ((0.4627 + 0.055) / 1.055)^2.4 = 0.1812, ratio 1.05 / 0.2312 = 4.54:1. For #777777: linear value 0.1845, ratio 1.05 / 0.2345 = 4.48:1.
The checker in the tool uses exactly this formula. It shows the ratio, five pass or fail badges (AA and AAA for normal and large text, plus 3:1 for UI parts and icons), a gauge and a live preview. The ratio has two decimals, but when rounding would cross a threshold it shows three, so #007BC8 on white reads 4.499:1 and fails instead of showing a misleading 4.50. Semi-transparent text is blended over the background before measuring. When a pair fails AA, the tool suggests the closest colour that passes: it keeps the OKLCH hue and chroma and moves only the lightness, so #777777 on white becomes #767676.
Our example blue #1D4ED8 on white gives 6.70:1: fine for body text at AA, short of AAA. In my own work I aim for 4.5:1 on all text, even large headings, because the margin covers cheap screens and bright rooms.
How the color picker works and how it is checked
Images are decoded into a canvas on your device and read pixel by pixel; nothing is sent to a server, and the palette board (up to 48 colours) lives only in your browser. The screen eyedropper uses the EyeDropper API, which needs a secure (HTTPS) page and a click to start, and works only in Chromium-based browsers; in Firefox and Safari use the image route. Conversions follow the CSS Color 4 formulas for sRGB, HSL, HSV and OKLCH. Values are rounded only for display (HSL and HSV to one decimal; OKLCH lightness as a percentage with two decimals, chroma to four and hue to two); contrast pass or fail is decided on the unrounded ratio. CMYK uses the simple formula K = 1 − max(R, G, B) with no ICC profile, so treat it as approximate.
| Input | Expected result |
|---|---|
#1D4ED8 | rgb(29 78 216), hsl(224.3 76.3% 48%), hsv(224.3 86.6% 84.7%), oklch(48.82% 0.2172 264.38), cmyk(87% 64% 0% 15%), nearest name royalblue |
#4169E1, #808080 | exact names royalblue and gray (also grey); all 148 CSS names parse to the right HEX |
#8B5CF6, #0E9F6E | nearest names mediumslateblue and seagreen; #0E9F6E = oklch(62.22% 0.1333 162.27) |
#1D4ED880 | rgb(29 78 216 / 50.2%); legacy rgba(29, 78, 216, 0.502) |
OKLCH ramp of #1D4ED8 | L 96% #EBF2FF, L 48% #1B4BD5 (marked as nearest), L 24% #01006C |
50% tint, shade, tone of #1D4ED8 | #8EA7EC, #0F276C, #4F67AC |
Harmonies of #1D4ED8 | complementary #D8A71D; triadic #D81D4E and #4ED81D; tetradic (+60°) #A71DD8; square (+90°) #D81DAC |
#777777 on #FFFFFF | 4.48:1, fails AA for normal text, passes large text and UI; suggestion #767676 |
#767676 on #FFFFFF | 4.54:1, passes AA, no suggestion needed |
#007BC8 on #FFFFFF | 4.499:1 shown unrounded, fails AA |
#1D4ED8 on #FFFFFF | 6.70:1, passes AA, fails AAA for normal text |
#1D4ED880 on #FFFFFF | blended to #8EA6EB first, 2.39:1 |
| Test image: 1 px, 3×3 and 5×5 averages, transparent and half-transparent pixels, arrow keys, touch | values match the hand-computed ones; no network request |
Go deeper
Guides
Things people ask
How do I find the hex code of a colour in an image?
Drop or paste the image into the color picker, move the loupe over a flat area and click. The HEX code appears with RGB, HSL and OKLCH; for photos and JPEGs switch to a 3×3 or 5×5 average so grain does not skew the value.
Why does the screen eyedropper not work in Firefox or Safari?
It relies on the EyeDropper API, which only Chromium-based browsers such as Chrome, Edge and Opera support, and only on HTTPS pages. In other browsers the tool says so; take a screenshot and pick from it as an image.
Is my image uploaded?
No. The image is decoded and read inside your browser and never leaves your device. Saved palettes are kept in your browser's local storage only.
Should I use OKLCH instead of HSL?
For palettes and design tokens, yes. OKLCH lightness matches how bright colours look, so equal steps give even shades across hues, while HSL gives pure yellow and pure blue the same 50% lightness. It is supported in all current major browsers.
Why is my picked colour slightly different from the brand colour?
JPEG compression, scaled screenshots, anti-aliased edges and display colour management all shift single pixels by a few values. Average an area in a flat part of the image, or ask for the official brand values.
Does 4.48:1 count as passing WCAG AA?
No. WCAG says the ratio must not be rounded, so anything below 4.5:1 fails AA for normal text. It does pass the 3:1 minimum for large text, which is at least 18 pt, or 14 pt bold.