Skip to content
Color Picker
01 · Tips

How to pick a colour from an image (exact pixel values)

To pick a colour from an image, upload or drop the picture into the colour picker, click the pixel you want and copy the HEX, RGB or HSL value it shows. That takes ten seconds. Getting the right value takes a little judgement, because a pixel in a file is rarely the colour you think you see.

I pick colours from logos, screenshots, photos and client mood boards every week, and the same handful of things go wrong. This guide gives you the steps first, then explains why values drift and how I deal with it.

A 3 by 3 block of slightly different red pixels averaged into one swatch with the value #CA1F29
Nine neighbouring pixels disagree a little. Their average is the colour you actually want.

How to pick a colour from an image, step by step

  1. Load the image. Drag the file onto the picker, paste it from the clipboard or choose it from disk. PNG is ideal; JPEG, WebP, GIF, AVIF, BMP, SVG and screenshots all work, up to 40 MB. HEIC photos from an iPhone open only where the browser can read them (Safari can, Chrome and Firefox cannot), so export those as JPEG or PNG first; the picker tells you when a file will not open. Images above 16.7 megapixels are read from a reduced copy, and the picker says so.
  2. Zoom in before you click. Use the loupe so you can see the individual pixels under the cursor or finger. Aim for the middle of a flat area, never the edge of a shape. The arrow keys move the pick point one pixel at a time and Enter picks it, which beats a shaky mouse on a small icon.
  3. Set the sampling size. For a logo or a flat UI colour a single pixel is fine. For a photo, a gradient or a JPEG, switch to a 3 × 3 or 5 × 5 average.
  4. Click, then read the value. You get HEX, RGB, HSL, HSV, OKLCH and an approximate CMYK for the same pixel, plus the nearest CSS colour name. Copy the format your destination wants: HEX for most CSS and design tools, OKLCH if you build palettes in code.
  5. Check it twice. Click two or three other points in the same area. If the values differ by a few units per channel, the area is noisy and you should average. If they differ a lot, you are probably sampling a gradient.
Rule of thumb: pick from the largest flat area you can find, at 100% zoom or higher, and average at least 3 × 3 pixels unless the source is a clean PNG you made yourself.

Why the value is not what you expected

The picker reports exactly what is stored in the decoded image. The surprise is almost always in the image itself.

CauseWhat happensWhat I do
JPEG compressionEach 8 × 8 block is rounded off, so a flat red becomes a scatter of near-reds, with visible noise next to edges.Average a block, or ask for the PNG or SVG original.
ScalingA shrunk or enlarged screenshot blends neighbouring pixels. Edges pick up in-between colours that exist nowhere in the design.Pick from the original size, or from the middle of a large flat area.
Colour profileA photo tagged Display P3 or Adobe RGB has the same numbers but means a different, more saturated colour. Browsers convert to sRGB for display, so your eye and the file can disagree.Work in sRGB. If the brand colour matters, export the image as sRGB first.
Anti-aliasingText and curves are smoothed with partly blended edge pixels. A pixel on a letter might be 40% letter and 60% background.Click the thick middle of a stroke, never the outline.
TransparencyA PNG or WebP pixel can be semi-transparent. The RGB numbers are real but the colour you see is blended with whatever sits behind.Check for an alpha value below 100%; flatten against the real background before copying.
Photo grain and lightingA “white” wall is rarely neutral. Light, shadow and sensor noise move every pixel.Average a larger block, then judge by eye whether you want the lit or the shaded tone.

Two of these deserve a longer word. The first is colour profile. Almost all web pages, screenshots and UI mock-ups are plain sRGB, and then nothing is converted and the numbers you read are the numbers that were drawn. Photos from a phone are often tagged with a wider profile. The browser maps them into sRGB when it decodes them, so the value you read is the converted one. That is what you want for the web, but it can differ from what Photoshop shows with a different working space.

The second is transparency. The picker warns you when the pixel is partly see-through, and a fully transparent pixel is reported as transparent rather than as black. If it shows an alpha below 100%, copy the colour as 8-digit hex or as rgb(r g b / a) only if you actually want a see-through colour. For a solid brand colour, blend it with the background first, or find a fully opaque pixel.

Average a few pixels instead of trusting one

A single click is a sample of one. An average of a block smooths out compression noise and grain without moving the colour. In the figure above the nine pixels range from 190 to 212 in the red channel. Their mean is 201.7, which rounds to 202, and the same exercise gives green 31.3 → 31 and blue 40.6 → 41. The result is rgb(202 31 41), which is #CA1F29: CA = 12 × 16 + 10 = 202, 1F = 1 × 16 + 15 = 31, 29 = 2 × 16 + 9 = 41.

SourceSampling size
Flat PNG, logo or screenshot you trust1 pixel (3 × 3 as a safety net)
JPEG logo, web banner3 × 3 or 5 × 5
Photo of a wall, fabric, skin or sky5 × 5, picked from several spots
Gradient1 pixel at each stop; never average across the gradient

The average is weighted by opacity, so see-through pixels do not drag the result towards black. Do not average over an edge. Averaging the border of a red button and a white card gives you pink, and pink exists nowhere in the design.

Image picker or screen eyedropper?

Browsers built on Chromium also offer a screen eyedropper, the EyeDropper API. It lets you sample any pixel on your screen, including other windows, with a magnifier cursor. Two limits matter. It needs a secure (HTTPS) page and a button click, and it is missing in Firefox and Safari, so a good picker has to keep the image route as its fallback. In those browsers this picker says so and sends you to the image route: take a screenshot and drop it in.

  • Use the image route when you have the file. It reads the pixels of the decoded image at full resolution, with no screen scaling in between.
  • Use the screen eyedropper when the colour lives in a video, a PDF viewer or another app, and you cannot get the file.

The screen route returns what is displayed, which is affected by display scaling, night-shift or True Tone, HDR and the screen’s profile. If the number matters, turn night shift off or work from the file.

Is the image uploaded anywhere?

In this picker, no. The file is decoded in your browser and the pixels are read locally, so nothing leaves your device. You do not have to take my word for it: open your browser’s developer tools, look at the Network tab, load an image and watch for uploads. Or switch off your connection after the page has loaded; picking will still work. Be careful with any online tool that cannot pass that test, especially for unreleased work or client files.

From one pick to a palette

One colour is a starting point, not a palette. This is the routine I follow after I have picked from an image:

  1. Pick three to five colours from different areas: a dominant, a darker one, a lighter one and one accent. The picker also lists up to six dominant colours of the whole image with their share, a quick way to spot the main background and the accent.
  2. Give each a job: background, text, primary action, accent. If two picks do the same job, drop one.
  3. Build shades and tints of the primary colour, so you have hover, disabled and border states from one hue. The guide to HEX, RGB, HSL and OKLCH explains why OKLCH gives the most even steps.
  4. Test text against backgrounds with the WCAG contrast guide. A colour that looks right in the photo often fails 4.5:1 as text.
  5. Copy the values as CSS variables and keep the source image next to them, so the next person can see where they came from.

The colour picker keeps your picked colours together on a palette board that is saved in your browser, so you can compare them side by side before you commit. Export it as CSS variables, SCSS, JSON or a plain HEX list, then copy or download it.

Things people ask

How do I find the hex code of a colour in an image?

Load the image into the colour picker, zoom in on a flat area and click it. The HEX value (for example #CA1F29) appears next to the RGB, HSL, HSV and OKLCH values, ready to copy.

Why does the colour I picked look different from the image?

The file may contain noise (JPEG compression, grain), a partly blended edge pixel, a transparent pixel or a colour profile that is converted for display. Average a 3 x 3 or 5 x 5 block from the middle of a flat area.

Does the image get uploaded when I pick a colour?

No. The picture is read inside your browser, so the pixels never leave your device. You can confirm it in the browser's Network tab.

Why doesn't the screen eyedropper work in Firefox or Safari?

The EyeDropper API is only available in Chromium-based browsers, and only on HTTPS pages after a button click. The picker tells you so in other browsers; load the image into it instead, which works everywhere.

Can I pick a colour from a screenshot?

Yes. Use the full-size screenshot rather than a shrunk copy, because scaling blends neighbouring pixels. Pick in the middle of a flat area, not on an edge.

Back to the color picker

Related reading