/tools/extract-colors-from-image

Extract Colors from Image

Pull the main colors out of a photo, illustration or logo as a set of HEX codes, ordered from the color that covers the most of the image to the one that covers the least.

Private & secure
Upload image or drag & drop
JPG · PNG · WebP

How to use the Extract Colors from Image

01
Upload
Drop an image.
02
Click to pick
Click anywhere to grab a colour. A palette is extracted automatically.
03
Copy
Copy HEX, RGB or HSL, or the whole palette as CSS.

How the colors are extracted

The image is uploaded and reduced on the server to a small working copy, 200 pixels on the longest side, which keeps the overall color balance while making the calculation quick. Similar pixels are then grouped into the number of colors you asked for using median cut quantization, refined with a couple of k-means passes so each group's color sits close to the pixels it represents.

Finally the groups are counted and sorted by how many pixels each covers. The first color is the dominant one and is marked with a star. Pixels that are more than half transparent are ignored, so a logo on a transparent background gives you the logo's colors, not a phantom black or white.

Choosing how many colors to extract

You can extract 4, 6, 8, 10 or 12 colors, starting at 8. A small number gives the broad strokes and merges nearby shades into one. A larger number brings out accents, highlights and shadows that cover less of the image. If the image genuinely has fewer distinct colors than you asked for, such as a two-color logo, you get fewer swatches rather than near-duplicates.

Using the extracted colors

Each swatch shows its HEX code. Click one to see it as RGB and HSL with copy buttons. Copy palette as CSS puts the whole set on your clipboard as custom properties in a :root block, numbered --color-1, --color-2 and so on in order of coverage, ready to paste into a stylesheet and rename to suit your project.

Typical uses include matching a slide deck or web page to a hero photo, pulling brand colors from an existing logo file, and finding complementary accents for a product shot.

Supported formats

JPGPNGWebP

Files up to 25 MB. Large, high-resolution photos are supported.

Privacy

Your file is sent over HTTPS, processed in memory and returned straight away. It is never stored, never shared and never used for anything else. No account needed. How we handle files.

Extract Colors from Image FAQ

Why is a small bright color missing from the results?

It covers too few pixels to earn its own group at the current count. Increase the number of colors, or click that spot with the color picker to get its exact value.

Are the extracted colors exact pixel values?

They are representative colors for groups of similar pixels, so a swatch may not match any single pixel exactly. For one specific pixel, click it in the image.

Does transparency affect the result?

Pixels less than half opaque are left out, so transparent backgrounds don't add a color to the palette.

Can I get RGB codes instead of HEX?

Yes. Click a swatch and its RGB and HSL values appear with copy buttons.

Why did I get fewer colors than I asked for?

The image doesn't contain enough distinct colors, so duplicates are dropped instead of padding the list.

Are my images safe?

Your file is sent over HTTPS, processed in memory and returned straight away. It is never stored, never shared and never used for anything else.

Is it free?

Yes. No account, no watermark and no limit on how many images you process. Files can be up to 25 MB.

Related tools

See all 6 color tools →