Palette Extractor

Color Palette Generator

Drop any photo, illustration or logo and instantly extract its dominant color palette. Get HEX, RGB, HSL codes, CSS variables, and downloadable swatches.

4–12

Colors

HEX + RGB + HSL

All Formats

CSS

Ready

Private

No Uploads

Drop any image here

PNG, JPG, WebP, GIF, SVG or AVIF. Works well on photos, illustrations and logos.

Your file never leaves this device.

Choose image

How color extraction works

The tool uses a color quantization algorithm called Median Cut. Rather than simply averaging all the pixel colors in the image (which would produce a single muddy middle color), Median Cut intelligently divides the color space to find colors that together best represent the full range of hues in the image.

  1. 1

    Downsample

    The image is scaled down to a maximum of 200x200 pixels before processing. Color distribution is accurately represented at this size, and the smaller pixel count keeps extraction fast even on large source images.

  2. 2

    Read pixel colors

    All pixel colors are read from the canvas as RGB values. Fully transparent pixels are excluded since they carry no color information. This leaves a flat array of all the colors present in the image.

  3. 3

    Median Cut quantization

    The algorithm finds which color channel (red, green or blue) has the greatest range across all pixels, sorts the pixels by that channel, and splits the set exactly in half at the median. This repeats for each half until the desired number of color groups is reached.

  4. 4

    Average each group

    Once the recursion reaches the target depth, all pixels in each group are averaged to produce one representative color. This color is the dominant color for that region of the color space.

  5. 5

    Sort by luminance

    The final colors are sorted from lightest to darkest using perceived luminance weighting (which accounts for the human eye's different sensitivity to red, green and blue).

What people use color palette extraction for

Building UI color systems

Extract colors from a hero image or product photo and use them as the foundation of a website palette. The CSS variables output pastes directly into a stylesheet.

Brand color identification

Upload a company logo or brand asset to identify its exact color codes. Useful when you have the visual asset but not the original design files.

Photo-matched design

Design landing pages, social posts or presentations that match the color mood of a specific photograph by building the UI palette from the photo itself.

Illustration and art reference

Extract the color palette from a reference illustration, film still or painting to use as inspiration or to match a specific visual style.

Content consistency

Ensure blog posts, social media graphics and marketing materials use colors that match a featured image by extracting its palette before designing.

Design system documentation

Use the PNG swatch download to document color palettes in design specs, Notion pages, Confluence docs or Figma files as image assets.

Export formats explained

CSS variables

:root {
  --color-1: #f5c842;
  --color-2: #e87d3e;
  --color-3: #2b4c8c;
}

Paste directly into your stylesheet. Reference colors anywhere with var(--color-1). Change the prefix in the tool to match your naming convention.

HEX list

#f5c842
#e87d3e
#2b4c8c

A plain list of HEX codes, one per line. Paste into Figma, Sketch, Canva, or any tool that accepts HEX codes. Also useful for storing in a plain text file.

JSON

{
  "color1": "#f5c842",
  "color2": "#e87d3e",
  "color3": "#2b4c8c"
}

For developers storing palettes in config files, design token systems, or passing colors through an API. Compatible with Style Dictionary and similar design token tools.

PNG swatch sheet

Downloadable image with color blocks and HEX/RGB labels.

For documentation, design specs, client presentations, Notion pages and anywhere you need a visual reference of the palette as an image file.

Frequently asked questions

How does the color extraction work?

The tool uses the Median Cut algorithm to extract dominant colors from your image. The image is downsampled to 200x200 pixels for speed, then all pixel colors are read via the browser Canvas API. The algorithm recursively finds the color channel (red, green or blue) with the greatest range, sorts pixels by that channel, and splits the set at the median. This repeats until the desired number of color groups is reached. Each group is averaged to produce one representative color. Colors are then sorted from lightest to darkest by perceived luminance.

What is the difference between this and the Image Color Picker?

The Image Color Picker lets you click a specific pixel to read its exact color. It is for when you need a precise color from a specific point in the image. The Color Palette Generator automatically analyzes the entire image and extracts the most dominant colors across all regions. It is for when you want to understand what colors an image is built from, or when you want to build a UI palette inspired by a photo, illustration or brand asset.

How many colors should I extract?

4 colors works well for simple images, logos and graphics with flat color. 6 colors is a good default for most photos and illustrations. 8 colors captures more variation and works well for complex or colorful images. 12 colors is for images with a wide range of distinct hues such as festival photography, detailed illustrations or design mockups. For web UI use, 4 to 6 dominant colors is usually enough to build a complete palette.

What is the CSS variables output for?

The CSS output is a :root block containing the extracted colors as CSS custom properties (CSS variables). You can paste this directly into your stylesheet. Each variable is named with the prefix you set (defaulting to --color-1, --color-2, etc.) and you can then reference them anywhere in your CSS with var(--color-1). This is the fastest way to turn a palette extracted from an image into a set of usable design tokens for a web project.

Is my image uploaded to a server?

No. The entire extraction runs in your browser using the Canvas API. Your image is drawn onto a hidden canvas element and the pixel data is read locally. Nothing is sent to any server. You can disconnect from the internet after the page loads and the tool still works.

Why does the palette look different from the original image?

The algorithm finds the most statistically dominant colors across the entire image, not the colors that look most visually prominent. On photos with a large sky or background, muted sky blues may dominate even if a smaller subject is more visually striking. This is a property of algorithmic color quantization. If you need a specific color from a specific part of the image, use the Image Color Picker to click directly on the area you want.