FormatterHQ

Image Color Palette Extractor

Upload or paste an image and get its dominant colours as a palette, ordered by how much of the picture each colour covers. Export as CSS, HEX list or JSON.

Loading tool…
Ready.

How to use the Image Color Palette Extractor

  1. Drop an image on the page, click to choose one, or paste a screenshot. Use sample image shows how it works.
  2. Move the Number of colours slider (2–12) to get a broader or more detailed palette.
  3. Read the proportion bar: each colour takes up as much width as its share of the image.
  4. Click a swatch to copy it, or use the CSS, HEX or JSON tab to copy or download the whole palette.

An image color extractor for designers and developers

Whether you want to match a website to a hero photo, build a theme from a product shot or document a brand from its logo, you need the colours that actually dominate the image. This image color extractor analyses the pixels in your browser and returns a palette of 2 to 12 colours with the percentage of the image each one represents.

How the colours are found

The image is scaled down (to about 320 pixels on the long side) so analysis is instant even for large photos. Transparent pixels are ignored. The remaining pixels are grouped with k-means clustering: the algorithm starts with well-separated seed colours, assigns every pixel to its nearest colour, moves each colour to the average of its pixels and repeats until the palette stops changing. The result is a set of colours that best represent the image as a whole, not just the brightest spots.

Because the seeds are chosen deterministically, the same image and colour count always produce the same palette — handy when you document a design decision.

Choosing the number of colours

  • 2–4 colours: the overall mood; good for a background and one accent.
  • 5–6 colours: a typical UI palette with neutrals, a primary and accents.
  • 8–12 colours: detailed palettes for illustration or data visualisation.

Small but striking details, such as a red logo on a white page, can disappear into a larger cluster when you pick too few colours. Increase the count until they appear as their own swatch.

Example output

:root {
  --image-1: #fcd34d;
  --image-2: #312e81;
  --image-3: #7c3aed;
}

Each swatch also shows its share, for example "34.5% of pixels", which helps you decide which colour should be the background and which the accent.

Related tools

To grab the exact colour of a single pixel, use the image color picker. For one representative colour — say, for a loading placeholder — the average color finder is quicker. Once you have your palette, generate lighter and darker steps with the tints and shades generator.

Tips for better palettes

Crop the image to the area you care about before extracting — a product shot with a large white studio background will otherwise return mostly whites and greys. Photos with strong gradients, such as sunsets, produce smoother palettes when you ask for more colours. For screenshots of websites, six colours usually recover the background, text and main accent colours accurately. If you plan to use the palette for text and backgrounds, remember that a colour taken from a photo says nothing about readability, so test your pairs with the contrast checker.

Exporting the palette

The code panel offers three formats. CSS produces numbered custom properties (--image-1 to --image-n) in order of coverage; the HEX tab is a plain list for design tools; JSON includes each colour's share so scripts can, for example, pick the most common colour automatically. Rename the variables after pasting to reflect their role, such as --surface or --accent.

Privacy

Everything happens locally in your browser with JavaScript and the Canvas API. Your images are never uploaded to our servers, so the tool also works with confidential screenshots and personal photos.

Frequently asked questions

Why is the extracted color slightly different from the color in my logo?
Anti-aliased edges, JPEG compression and shading add intermediate colours that are averaged into the cluster. Use the image color picker if you need the exact value of one pixel.
Does the tool work with transparent PNGs?
Yes. Pixels that are mostly transparent are skipped, so the transparent background does not appear as a colour in the palette.
What image formats are supported?
Any format your browser can display: JPG, PNG, WEBP, GIF, SVG, and on most browsers AVIF.
Why do I get the same palette every time?
The clustering is seeded deterministically, so identical input gives identical output. Change the number of colours to get a different breakdown.

Last updated October 3, 2026

Related tools

Image Average Color Finder Find the average and dominant colour of an image — useful for placeholders, card backgrounds and theme colours. Runs in your browser. Image Color Picker Pick exact pixel colours from an uploaded image with a zoom loupe. Get HEX, RGB and HSL values and keep a list of picked colours. Base64 to Image Preview and download images from Base64 strings or data URIs. Detects PNG, JPEG, GIF, WebP, BMP, ICO and SVG. Flip Image (Mirror) Flip an image horizontally or vertically — mirror selfies, reverse text in photos or turn images upside-down — in your browser. Image Compressor Compress JPG, PNG and WEBP images in your browser with a quality slider, before/after comparison, resizing and batch ZIP download. Image Cropper Crop images online with a draggable selection, aspect ratio presets (1:1, 4:3, 16:9…) and exact pixel values. Private and free. RGB to CMYK Converter Convert RGB colour values to CMYK instantly, with a live colour swatch preview, colour picker and copy buttons. RGB to Colortone Converter Generate the tints, shades and tones of a RGB colour as a palette with swatches and ready-to-copy codes. RGB to HEX Converter Convert RGB colour values to HEX instantly, with a live colour swatch preview, colour picker and copy buttons. RGB to HSL Converter Convert RGB colour values to HSL instantly, with a live colour swatch preview, colour picker and copy buttons. RGB to HSV Converter Convert RGB colour values to HSV instantly, with a live colour swatch preview, colour picker and copy buttons. RGB to RGBA Converter Convert RGB colour values to RGBA instantly, with a live colour swatch preview, colour picker and copy buttons.