Free · Instant · Nothing uploaded

Image color palette extractor

Drop in a photo and get its dominant colors as hex codes — ready to copy or export as CSS variables.

Drop a photo here or browse

JPG · PNG · WebP — your photo stays on your device

🔒 Your photo is analyzed entirely on your device — never uploaded.

How to extract a color palette from a photo

Great for matching brand colors to a photo, building a mood board, or picking a UI theme from an image.

🖼️

1. Drop a photo

Any JPG, PNG or WebP — nothing is uploaded.

🎛️

2. Pick a color count

4 to 8 swatches, sorted from most to least dominant.

📋

3. Copy & use

Click any swatch for its hex, or export the whole palette.

Colors are found with median-cut quantization — the same family of algorithm behind classic image-palette tools — rather than a simple pixel average, so the result reflects the photo's real color groups instead of one muddy blend. Everything runs in your browser on a downscaled copy of the image for speed; your original photo is never uploaded. For palettes built from a base color instead of a photo, try the Color Palette Generator.

What happens to your photo

The file is turned into a local object URL and handed to an <img> element, which the browser decodes with the same code path it uses for any image on any web page. It is then drawn onto an off-screen canvas, scaled so its longest side is 150 pixels — a 4000×3000 photo becomes 150×113, about seventeen thousand pixels. Every pixel more transparent than half opacity is discarded, and the rest go into the quantizer as plain RGB triples. There is no upload, no network request and no temporary file: close the tab and the canvas is gone with it.

Median cut then runs. All the pixels start in one bucket. Each round, the tool finds the bucket whose red, green or blue values span the widest range, sorts that bucket along the offending channel, and splits it in half at the median — so the bucket holding the most colour variation is always the next one divided. Repeat until you have as many buckets as swatches requested. Each bucket becomes one swatch, coloured by the arithmetic mean of its pixels, and the list is ordered by how many pixels each bucket ended up holding. The percentage under each swatch is that bucket's share of the sampled pixels.

One deliberate detail: a bucket with zero colour variation is never chosen for splitting. Without that rule, a poster-style image containing only three colours asked for eight swatches would return the same colours several times over. Instead the tool stops at however many distinct groups the image actually has.

Where the algorithm misleads you

Median cut counts pixels, not importance. It has no idea what the photograph is of. A landscape that is 70% sky will spend most of its splits subdividing near-identical blues, and a small red jacket that your eye goes to first can end up folded into a neighbouring bucket and never appear. If the palette misses the thing you care about, that is the mechanism — not a bug.

Averaging can invent a colour that is not in the image. Each swatch is the mean of its bucket, so a bucket that still contains both warm reds and cool greens resolves to a muddy olive that appears nowhere in the original. This is most visible at low swatch counts on busy images; raising the count from 4 to 6 usually resolves it, because the offending bucket gets split.

The 150-pixel downscale runs before anything else. The browser smooths as it scales, which blends neighbouring pixels together — so a thin, high-contrast detail like a logo, a line of coloured text or a narrow stripe is averaged into its surroundings before the quantizer ever sees it. That is the trade for making the whole thing instant, but it means the tool describes broad colour regions, not fine detail.

Format support is the browser's, not the file picker's. Anything your browser can decode works — JPEG, PNG, WebP, GIF, BMP and, on current browsers, AVIF. HEIC is the common failure: iPhone photos in their native format decode on Apple platforms but not in Chrome or Firefox on Windows and Android, where the image simply never loads. Run those through the HEIC to JPG converter first.

Getting a palette you can actually use

Crop first, extract second. Because the result is driven purely by area, framing is the control you have over it — cropping to the subject before dropping the file in is far more effective than changing the swatch count afterwards. The image cropper does this in the browser too, so nothing is uploaded at either step.

Five or six swatches is the useful range for most photographs. Four tends to over-merge; eight usually spends the extra two on further subdivisions of whatever already dominated, which is why the eighth swatch is so often a near-duplicate of the seventh. If two swatches come back looking identical, that is the honest answer — the image does not contain a distinct eighth colour region.

Treat the output as raw material rather than a finished palette. The most common mistake is to take the top swatch by percentage and make it the brand colour; in most photographs the largest region is the background, the sky or the wall. Pick the swatch that carries the subject, then build tints, shades and harmonies around it in the colour palette generator, which gives you the full lightness ramp a real interface needs. The Copy CSS button here writes the swatches out as custom properties in dominance order, ready to rename.

What to expect from different images

Image typeTypical resultWhat helps
Portrait on a plain backdropBackdrop and skin tones dominate; clothing colours appear only if they occupy real area.Crop tight to the subject.
Landscape with a large skySeveral near-identical blues, with ground colours compressed into one or two swatches.Crop out most of the sky, or raise the count to 8.
Product shot on whiteThe first swatch is white or near-white and carries a very high percentage.Crop to the product; ignore the top swatch.
Flat illustration or screenshotAccurate and stable — flat colour regions are exactly what median cut handles best.Nothing; this is the ideal case.
PNG with transparencyTransparent areas are skipped entirely, so percentages describe only the visible pixels.Nothing — this is usually what you want.
Photo with one small bright accentThe accent is often absorbed into a larger bucket and missing from the palette.Crop to it, or use the colour picker to sample that pixel directly.

Image color palette FAQ

How are the colors picked?

Using median-cut color quantization — pixels are recursively split by their widest color range, and each group's average becomes one swatch.

Is my photo uploaded anywhere?

No — the image is decoded and analyzed entirely in your browser using a canvas.

How many colors can I extract?

Choose 4, 5, 6 or 8 dominant colors, sorted from most to least prominent.

What does the percentage under each swatch mean?

The share of sampled pixels that fell into that colour group. It is measured on the downscaled copy of your image and after fully transparent pixels have been dropped, so it describes visible area rather than visual importance — the largest percentage is very often just the background.

Why is a colour I can clearly see missing from the palette?

Because the algorithm ranks by how much area a colour covers, not by how much it stands out. A small, bright accent gets merged into a larger neighbouring group. Cropping the image to that region before extracting is the reliable fix; raising the swatch count sometimes works, but the extra splits usually go to whatever already dominated.

My iPhone photo does nothing when I drop it in.

It is almost certainly a HEIC file. The tool relies on the browser to decode the image, and HEIC is only supported on Apple platforms — in Chrome or Firefox on Windows or Android the image never loads, so no palette appears. Convert it to JPEG first and it works normally.