Skip to content
CornerTools

Image Color Picker

Pick any pixel's colour from an image as HEX, RGB, HSL or OKLCH, and get its main colours as a palette to copy as CSS.

Drop an image here or paste it, or

Your images never leave your device

Read in this browser · JPG, PNG, WebP, GIF, BMP, AVIF, HEIC or TIFF · one at a time

Finds the exact colour of any pixel in an image, a photo, logo or screenshot, as HEX, RGB, HSL and OKLCH, and the image's main colours as a palette with each one's share. Copy a value, or the whole palette as CSS variables, Tailwind colours or JSON. The image is read in your browser and never uploaded.

How to use it

Add an image: JPG, PNG, WebP, GIF, BMP, AVIF, HEIC or TIFF, one at a time. Its centre pixel shows as the picked colour until you pick another. With a mouse, a loupe beside the pointer shows the 11 × 11 pixels around it, enlarged, with the centre one ringed and its HEX below; click to pick that pixel. On a phone or tablet, touch the image and drag: the loupe sits above your finger, and lifting it picks. Pinch, or use the zoom buttons, to zoom up to 800% and pick single pixels of a small detail.

With a keyboard, tab to the crosshair: the arrow keys move it one pixel at a time, ten with Shift, and Enter picks. A screen reader hears the crosshair's position and the colour under it.

The picked colour shows in HEX, RGB, HSL and OKLCH, each with a copy button; a pixel that is partly transparent adds its HEX with alpha (eight digits) and its opacity, and a fully transparent one has no colour to show. Open in Color Converter takes it to every other format and its contrast with white and black text. The last ten picks stay as swatches until you leave the page.

The Palette appears as soon as the image opens. Colours sets how many, from 2 to 12 (default 6, remembered on this device); click a swatch to see its values. Copy as gives a HEX list, CSS variables, a Tailwind v4 @theme block, a Tailwind v3 colors object or JSON, and Download PNG saves the colours as a strip of squares.

How it works

The palette is worked out on a copy of the image at most 256 pixels on its longer side, taken one real pixel per block rather than averaged. Pixels under half opacity (alpha below 128 of 255) are left out. The colours are grouped by k-means clustering in OKLab, a colour space in which equal distances look about equally different, so shades the eye sees as one land in one group. The starting points are chosen by k-means++ from a fixed seed, so the same image always gives the same palette in the same order.

Groups whose centres are closer than 0.02 in OKLab (a difference most people cannot see) are merged, so asking for six colours may give five, and the palette says so. Each swatch is then the real pixel closest to its group's centre, never the average itself, which may be a colour that occurs nowhere in the image. Its share is the part of the counted pixels in its group.

All values are sRGB at 8 bits per channel, as browsers read an image: a colour profile embedded in the file is applied as the image is decoded, and a 16-bit PNG is read at 8 bits.

Examples

Three blocks of colour

An image of three solid blocks covering 60%, 30% and 10% of it, with Colours at 6:

Colour 1
#1e3ca0 · 60%
Colour 2
#f0c828 · 30%
Colour 3
#c81e1e · 10%

Only 3 colours exist, so only 3 are given, each exactly as stored and with its share.

A smooth gradient

A gradient from green to pink across 256 columns, every column a different colour, with Colours at 4:

Colour 1
#d82780 · 30%
Colour 2
#1fe080 · 24%
Colour 3
#5ba480 · 23%
Colour 4
#956a80 · 22%

k-means cuts the gradient into four bands, and each swatch is a colour from inside its band, so every value is one you could pick from the image.

Frequently asked questions

In a JPG, compression stores small blocks approximately, so neighbouring pixels of what looks like one flat colour can differ by a few levels. The palette groups such near-identical shades into one; to pick a single pixel exactly, zoom in with the loupe.
Many palette tools give the average of each group, a colour that may not occur in the image, or group colours by their RGB numbers, which do not match how different they look. This tool groups in OKLab and gives a real pixel from each group, so its colours can be checked against the image itself.
Many phones save photos in Display P3, which holds more saturated colours than sRGB. Browsers convert the image to sRGB as they read it, so the most saturated colours come out as the nearest sRGB colour, which is what a web page can show anyway. The tool notes when an image carries such a profile.
Some browsers add slight random noise to pixels a page reads from an image, to stop sites from fingerprinting the device, such as Firefox with fingerprinting protection on, and Brave. Safari's protection leaves the pixels of images alone. The tool checks this when it opens, by drawing a known pattern and reading it back, and says so above the values when it finds noise. Values are then close to, but not exactly, the image's, and palette colours may not match a pixel exactly. For exact values, use a browser without that protection, or turn it off for this site.
HEX works everywhere and is what most design tools and older CSS expect. OKLCH, supported by current browsers, is written as lightness, chroma and hue that match how the colour looks, which makes lighter and darker shades easy to make by changing one number.
No. The image is read and its colours worked out in your browser; nothing is sent to CornerTools or anyone else. The first HEIC or TIFF image you add downloads a decoder from this site: a download to your browser, not an upload.

See also