Skip to main content

Image Tools · No account required

Extract a Color Palette from an Image

Find representative colors in a photo, preview swatches, copy HEX values and export the palette as JSON or CSS variables.

Instructions, examples and limitations ↓

What this tool does

Find a compact set of representative image colors with HEX and RGB values. Choose three to twelve requested colors, copy individual swatches, or export the palette as JSON and reusable CSS variables.

Enable JavaScript to use the local processing controls. Instructions and examples are available below.

Practical guide

Extract a Color Palette from an Image

By MultiZest · Updated

How to use this tool

  1. Choose one supported image up to 20 MB and 40 megapixels, or load the example.
  2. Choose the requested number of colors and extract the palette.
  3. Inspect the swatches, copy HEX values and download JSON or CSS.

Worked example

A simple image with only two opaque colors may return two swatches even if you request six. The tool does not invent extra distinct colors to fill the requested count.

Representative colors, not every pixel

The image is sampled at a maximum of 192 pixels on its longest side. Weighted color clustering groups similar RGB samples into a small palette, ordered by approximate sample share. Percentages may not add to exactly 100 after rounding.

Mostly transparent pixels are ignored. Colors on thin edges, small details or partially transparent overlays can differ from a full-resolution analysis. Use the image color picker for a specific original pixel.

Use palettes as a design starting point

Copy a swatch by clicking it. JSON includes RGB values and approximate shares; CSS exports variables named --palette-1 and onward. Neither export changes your website automatically.

A color palette does not establish accessible combinations. Check text/background pairs with the contrast checker before using them in an interface.

Turn a photograph into a starting palette

A café photograph might contain warm wood, cream walls, dark lettering and a green plant. The palette extractor can help you notice those relationships when planning a menu or website. Treat the swatches as suggestions from the image rather than a finished brand system; colors need clear roles before they become useful design choices.

Choose one background color, one text color and a small number of accents. A frequent color in the photo is not automatically suitable for body text or buttons. You may need a darker or lighter variation to create contrast while retaining the feeling of the original photograph.

Separate representative colors from exact measurements

The palette summarizes sampled image colors, so a small logo or important detail may not appear among the dominant swatches. Crop the image to the region of interest if that detail should guide the palette. Use the pixel color picker when you need the value from one particular flat area.

Copy a swatch into your actual design and test it against its neighbors. Shadows, photo compression and antialiasing can influence the values. Check foreground and background pairs with the contrast checker before using them for essential text, and label exported CSS variables according to their purpose rather than only their hue.

Questions and troubleshooting

Why do I receive fewer colors than requested?

A flat or simple image may contain fewer distinct sample clusters. Transparent images can have few or no sufficiently opaque pixels.

Are these guaranteed to be accessible colors?

No. Contrast depends on the foreground/background pair and context. Use a contrast check after choosing a palette.

Can the extractor recover the official colors of a brand?

A photo or screenshot may contain shadows, compression and altered colors. Use the brand’s original design files or published specifications when exact brand values are required.

Continue with a related tool

Sources and further reading

Found an error or an unclear instruction? Report it. Read our editorial policy and privacy policy.