1. Home
  2. Images
  3. Image Color Palette Extractor

Image Color Palette Extractor

Extract the dominant colors of a photo as HEX codes with their share.

Runs in your browser · No upload

This is a sample image. Upload or paste a photo.

Large photos are shrunk to about 200 px on a side so the analysis stays fast.

Extracted colors
No colors match. Try turning off the ignore options.
Export format

How to use

  1. Drop a photo on the page, click to choose one, or paste it with Ctrl+V.
  2. Set the number of colors between 2 and 16.
  3. The dominant colors appear on the right, largest share first. Check each color’s HEX, RGB and HSL code and press Copy HEX to copy it.
  4. For a product photo on a white background, turn on Ignore near-white background to get the colors of the product itself.
  5. Under Export palette, copy everything at once as a HEX list, CSS variables or JSON.

The photo is processed in your browser and never sent to a server.

How dominant colors are found

Pixels are grouped by similarity, and the biggest color groups are found.

  1. To keep it fast, large photos are shrunk to about 200 px on a side. That is plenty for finding dominant colors.
  2. Each channel is reduced to 32 levels so similar colors fall into one bin. The real colors in a bin are averaged, so exact colors are preserved.
  3. Median cut repeatedly splits the group with the widest color spread and the most pixels in half until you have the number of colors you asked for.
  4. Each group’s average color and share (its portion of all pixels) are computed.

No randomness is involved, so the same photo with the same settings always gives the same result. Semi-transparent pixels (alpha below half) are ignored.

For example, an image made of 75 pure red pixels and 25 pure blue pixels gives:

Order HEX RGB Share
1 #FF0000 rgb(255, 0, 0) 75%
2 #0000FF rgb(0, 0, 255) 25%

Color code formats

Format Example Notes
HEX #FF0000 The most common web notation; R, G and B as two hex digits each
RGB rgb(255, 0, 0) Red, green and blue as 0 to 255 numbers
HSL hsl(0, 100%, 50%) Hue (0 to 360 degrees), saturation, lightness; handy for picking related colors

For reference, green (0, 255, 0) is hsl(120, 100%, 50%), blue (0, 0, 255) is hsl(240, 100%, 50%) and gray (128, 128, 128) is hsl(0, 0%, 50%). To convert between formats, use the color converter.

Export formats

Format Result
HEX list One color per line (#ff0000)
CSS variables :root { --color-1: #ff0000; ... }, ready to paste into a stylesheet
JSON An array with HEX, an RGB array and the share (%) for each color

Tips

  • Matching a brand or thumbnail: paste colors from a logo or product photo into your design tool. If you need the exact color of one spot, the image color picker fits better.
  • Expanding a scheme: put one or two extracted colors into the color palette generator to build complementary and analogous sets.
  • Text legibility: check text and background pairs with the contrast checker. The label color on each swatch here is chosen automatically, black or white, whichever reads better.

FAQ

The colors differ from what I see.

A dominant color is an average of similar colors, so it may not match any single spot in the photo exactly. Compression and monitor settings also change how colors look. For a specific spot, use a color picker.

What happens to the shares when I raise the count?

More colors split the big groups, so each share gets smaller. The shares always add up to 100%.

The white background is always first.

When a product or logo sits on white, the background is the largest group of pixels. Turn on Ignore near-white background to leave it out. For a black background, turn on the black option.

What about transparent parts of a PNG?

Transparent pixels and those with alpha below half are left out of the calculation.

Does it work on large photos?

Yes. Images are shrunk internally to about 200 px on a side, so even large photos are quick. The photo is processed in the browser only and never sent to a server.

Can't find the tool you need?

Tell us what you want to do. We build the most requested tools first.