Dominant Color Extractor

Free dominant color extractor. Pick 1-16 most prevalent colors from any image with median-cut quantization. Export HEX, RGB, CSS variables, JSON. Browser only.

Drag and drop an image here, or click to browse
Supports JPG, PNG, GIF, BMP, WebP
Drop a JPG, PNG, GIF, BMP, or WebP file (max 20 MB)

About Dominant Color Extractor

Dominant Color Extractor analyses an uploaded photo and returns the most prevalent colors as a small palette, ranked by how much area each color occupies. The algorithm starts by sampling the image at a reduced resolution to keep extraction snappy even on multi-megapixel photos, then runs median-cut quantization on the sampled pixels: the entire color cloud is recursively split along its longest axis, yielding evenly-populated color boxes whose averages become the palette entries. Each palette entry is reported with its HEX code, its RGB triplet, and the percentage of sampled pixels that mapped to it, so you can see at a glance which color truly dominates the image. The output is exported in four developer-friendly formats — newline-separated HEX, RGB, ready-to-paste CSS custom properties, and a JSON array — making it easy to wire the extracted palette into a website, a design mockup, a Tailwind theme, or a data-visualization color scheme. Everything runs locally in the browser using the Canvas API; no images are uploaded to a server.

What does "dominant color" actually mean for an image?

Dominant color is the color that occupies the largest visible area in a picture once all the slightly different shades are grouped together. A blue sky photo doesn't contain just one shade of blue — it has hundreds of subtly different blues spread across the sky. Color quantization solves this by collapsing visually similar shades into a single representative color, and the resulting bucket with the most pixels is the dominant color. This differs from the average color (a simple per-channel mean of every pixel, which often muddies into a beige-grey for any real photo) and from the most-saturated color (which is great for accents but rarely represents the picture as a whole). This tool reports the dominant color first in its swatch list and sorts the rest by descending coverage.

Why use median-cut instead of k-means clustering?

Median cut is a deterministic, single-pass algorithm originally introduced by Paul Heckbert in 1982 for converting 24-bit images to 8-bit indexed color. It builds the palette by recursively splitting the RGB color cube along its longest axis at the median, so every palette color gets roughly the same number of pixels behind it. K-means clustering can produce slightly higher-fidelity palettes for photos with strong bimodal color distributions, but it requires multiple iterations, randomized seed colors, and can occasionally land on a local minimum that misses an obvious cluster. Median cut runs in roughly linear time, gives reproducible output for the same input, and matches the algorithm used inside browsers for GIF encoding — meaning the colors it picks tend to survive well when the image is later saved as a quantized format. For nearly all UI-extraction and theming use cases, the two algorithms are visually indistinguishable.

Why is my dominant color washed-out compared to what I see in the image?

Two effects combine to produce paler-than-expected results. First, median-cut averages the pixels within each palette box; if your eye-catching red shirt is bordered by darker reds in the shadows, the box-average dilutes the vivid hue. Second, the human visual system disproportionately weights the most saturated patches, so a small bright-red logo on a beige background can feel like the "main" color visually even though it occupies less area than the beige. To get a more vivid palette, lower the requested color count (so the algorithm spends its budget on the most saturated regions), enable Ignore Near-White (which removes flat white backgrounds that dilute the average), or pre-crop the image to focus on the saturated subject. For brand-color extraction in particular, cropping to the logo before extracting is a robust trick.

Dominant Color Extractor — Free dominant color extractor. Pick 1-16 most prevalent colors from any image with median-cut quantization. Export HEX,
Dominant Color Extractor

How do I use the extracted palette in CSS or Tailwind?

The tool already produces a CSS variables block in the form `--color-1: #RRGGBB;`. Paste this into your :root selector and reference each color with `var(--color-1)`. For Tailwind, copy the HEX list and paste into your tailwind.config.js under theme.extend.colors with descriptive names: `primary: '#1a73e8'`, `accent: '#fbbc04'`, etc. The JSON output is also designed to be fed straight into a build script — each entry has hex, rgb, and count fields, so you can sort and filter programmatically. If you want a perfectly-spaced light-and-dark scale derived from one of the extracted colors, run the dominant HEX through a tool like our Color Shades Generator to produce a Material-style 50-900 palette.

Why does the extractor skip pixels with alpha below 128?

Pixels with low alpha are mostly transparent — they would barely contribute to the visible image once rendered against any background. Including them would let large transparent regions of PNGs (especially logos and stickers) pollute the palette with the ghost of whatever background was visible when the alpha values were calculated. The 128 threshold (half-transparent or more opaque) is a conservative choice: it preserves anti-aliased edges of solid shapes (which carry the true subject's color) while excluding deeply transparent halos. If you need to extract colors from a tiny opaque region on a transparent background, the algorithm still works fine — there just need to be at least a few hundred opaque pixels to produce a meaningful palette.

Is the image uploaded to a server?

No. The selected image is read directly with a JavaScript FileReader, drawn onto an offscreen Canvas, and analysed entirely inside your browser tab. No network requests are made with image data — you can verify by opening DevTools and watching the Network tab. This means the tool is safe for confidential designs, customer photos, screenshots of unpublished UI work, and other privacy-sensitive imagery. It also means the tool keeps working when you're offline once the page is cached. The only resources downloaded over the network are the page assets themselves, not your image.