Color Palette Extractor
Upload any image to extract its eight most dominant colours. Copy each colour as a hex code, RGB value, or HSL string | or copy the entire palette at once. Export a PNG swatch sheet. Everything runs in your browser, no upload required.
Drop your image here
auto-extract · click to pick colours · export CSS / JSON
All processing happens locally in your browser. No files leave your device.
How to extract colours from an image
- 1
Upload your image
Drop a JPEG, PNG, or WebP file onto the upload area, or click to browse. The palette is extracted automatically | no button to press.
- 2
Browse the palette
Eight dominant colours appear, sorted by how much of the image they represent. The colour strip at the top of the card shows their proportions at a glance.
- 3
Copy colours
Click any row to copy that colour in the selected format (HEX, RGB, or HSL). Switch between formats using the tabs. Use Copy all to copy the entire palette as a newline-separated list.
- 4
Export a swatch PNG
Click the PNG button to download an 80×100px swatch sheet with all colours labelled | useful for documentation or sharing colour specs with a team.
How the palette is extracted
The image is scaled down to at most 180×180 pixels before analysis. This reduces the number of pixels to process while preserving the colour distribution. The tool then runs k-means clustering with k = 8 on the RGB pixel data: it groups all pixels into eight clusters so that pixels of similar colour belong to the same group. The centre of each cluster | the average colour | becomes a palette entry.
K-means runs for 12 iterations, which is enough to converge for typical images. The clusters are sorted by their size (number of pixels), so the most prominent colour appears first. The percentage bar in each row shows that colour’s share of the total pixels analysed.
Colour format reference
- HEX:
- A six-character hexadecimal code prefixed with #. The most widely used format in web development, CSS, and design tools like Figma. Example: #3B82F6.
- RGB:
- Red, green, and blue values on a 0–255 scale. Useful when working directly with CSS rgb() functions or programming environments. Example: rgb(59, 130, 246).
- HSL:
- Hue (0–360°), saturation (0–100%), and lightness (0–100%). The most human-readable colour model | hue describes the colour family, saturation describes vividness, and lightness describes brightness. Example: hsl(217, 91%, 60%).
Frequently asked questions
Why do I get 8 colours and not more?
Eight is a practical ceiling for dominant palette extraction. More clusters begin splitting closely related shades into near-duplicate entries rather than adding meaningful new colours. If you need finer granularity, run the tool on a cropped region of your image.
Why does a photo with a blue sky show mostly blue?
K-means finds the most dominant clusters by pixel count. If a large area of the image is a single colour (like a sky or background), that colour will dominate the palette. Crop the image to the area of interest before extracting if you want the palette to focus on the subject.
Are transparent pixels included?
No. Pixels with an alpha value below 50% are excluded from analysis. This means images with transparent backgrounds will not have the transparency counted as a colour.
Can I extract colours from a screenshot or non-photo image?
Yes. The tool works on any image | photos, illustrations, UI screenshots, gradients, or artwork. Flat-colour illustrations and UI screenshots tend to produce cleaner, more distinct palettes than photographs.
Does the palette change each time I run it on the same image?
Slightly. K-means centroid seeding is deterministic in this implementation (seeds are evenly spaced through the pixel list), but the exact output can vary by a few RGB units between runs due to quantization. The colours will always be visually representative of the image.
