Toolstia / Colour picker from image

Pick colours from an image

Designers and developers often meet a colour in a picture and need its exact code: the blue in a client's logo, the green of a product photo, a background in a screenshot of a competitor's site. Eyeballing it never works. This tool lets you drop in any picture, click on a spot, and get the colour there as a HEX code, an RGB value and an HSL value, each with its own copy button.

It also looks at the whole picture and lists the main colours in it as small labelled swatches, which is a quick way to build a palette from a photo, a painting or a brand sheet. Your last ten picks stay on screen as swatches, and clicking one copies its HEX code again.

The picture is read inside your browser and never uploaded. The notes below explain exactly how the pixel is read, how the main colours are chosen, why the HSL value is rounded, and what limits to expect with very large images.

Drop an image here, or click to choose

JPG, PNG or WebP. Nothing is uploaded.

How it works

  1. Drop in your picture.
  2. Click a spot on the picture to pick its colour.
  3. Copy the HEX, RGB or HSL code.

Exact pixel colour

The colour is read from the single pixel you click. On a photo, nearby pixels can differ slightly because of light and noise, so click a few places and compare.

Main colours

The list of main colours groups similar shades and shows the most common ones, which is handy for building a palette from a photo, a logo or a screenshot.

Recent picks

Your last ten picks stay on screen as small swatches. Click one to copy its HEX code again.

Colours on screen

The code is the colour stored in the file. How it looks can change with your screen settings and colour profile.

A worked example

Suppose you click a pixel whose stored red, green and blue values are 26, 115 and 232. The tool shows #1a73e8 as the HEX code, rgb(26, 115, 232) as the RGB value and hsl(214, 82%, 51%) as the HSL value. HEX is just the same three numbers in base 16: 26 is 1a, 115 is 73 and 232 is e8, with the hash sign in front, in lower case.

All three describe one colour. Use HEX or RGB in CSS and design tools that expect them, and HSL when you want to adjust lightness or saturation by hand. For other conversions, such as to CMYK or named colours, use the colour converter.

HSL is rounded

Hue is shown in whole degrees and saturation and lightness in whole percent. That is convenient to read but it throws away fractions. If you take hsl(214, 82%, 51%) and convert it back to RGB you get 28, 116, 233, which is slightly different from the 26, 115, 232 you started with. For exact work, copy the HEX or RGB value and treat HSL as a description.

How the pixel is read

The picture is drawn onto a canvas in the page, and a click reads the single pixel under the pointer. Pictures with a long side over 1600 pixels are first scaled down to 1600, and the reading comes from that scaled copy. On a smooth area this makes no difference. At a sharp edge, for example the border between a red logo and a white background, the scaling can blend the neighbours, so a click exactly on the border may give an in-between shade. Click well inside the area you care about.

Real photographs are noisy. Two neighbouring pixels of a blue sky can differ by a few values in each channel because of sensor noise and compression. If you need one representative value, click in several places and compare, or use the main colours list.

How the main colours are chosen

For the list of main colours, a small copy of the picture, at most 160 pixels on the long side, is analysed. Pixels that are mostly transparent are ignored. The rest are grouped into buckets by their top four bits per channel, so each channel has 16 levels, and the buckets are ordered by how many pixels fall in them. Starting from the biggest, a bucket is kept as its own colour unless its average is within a distance of 48 (in RGB space) of one already kept, in which case it is merged into that one. Up to 8 colours are listed, each as the average of its pixels.

Hovering over a swatch shows its HEX code and the share of the picture it covers, in percent. A flat logo might give only three or four swatches, because there are not 8 clearly different colours. A photo of a sunset will usually fill the list. The list is a summary, not a perfect match: a thin accent line may be too small to appear even though it matters to the design, so pick it directly with a click.

Transparent areas and screen differences

A click on a fully transparent pixel returns black, #000000, because the transparent pixel stores no colour and the tool does not look at the opacity when picking. If a PNG has see-through parts, click on pixels that you can see. The code is also what is stored in the file. The way it looks depends on your monitor, brightness and colour profile, and some browsers adjust colours when they show images with an embedded profile.

Limits

Pictures above 100 million pixels are refused with a message, because a browser cannot safely hold them. If your browser cannot decode the format, you will be asked to try a JPG, PNG or WebP. The recent picks and the main colours list are cleared when you load another picture. Nothing is saved after you close the page, so copy any codes you need.

Questions

Is my picture uploaded?

No. It stays in your browser.

What formats are shown?

HEX (like #1a73e8), RGB and HSL.

Can I convert between formats?

Yes, with the colour converter.

Does it work on a phone?

Yes. Tap the picture.

Can I pick a colour from a part of my screen outside the browser?

No. This tool reads a picture you load into it. To sample from another window, take a screenshot and drop the screenshot in.

Why does the same spot give slightly different codes on two clicks?

Neighbouring pixels in photos differ a little, and a one-pixel difference in where you click can change the value. Click in a flat, evenly coloured area and compare a few clicks.

Does the picked colour include transparency?

No. You get red, green and blue only, with no alpha value. A fully transparent pixel returns black.

How do I check that two colours have enough contrast?

Copy both HEX codes and use the colour contrast checker, which reports the contrast ratio used in accessibility guidelines.