Image Toolkit

Color Palette Extractor

Extract Dominant Colors from Images

Find the main colours in any image, with the hex code, RGB value and share of the image for each, then copy them or export CSS variables, SCSS, Tailwind or JSON. It all happens in your browser, so your image is never uploaded.

Drop an image to get its colours

JPG, PNG, WebP, SVG or iPhone HEIC. It never leaves your device.

or paste from the clipboard (Ctrl/Cmd+V)

Guide by Ashley Whitehair, web designer at Norwich Website Design

How to get a color palette from an image

  1. Add your image

    Drop a photo, logo or screenshot onto the box above, or click it to choose one. JPG, PNG, WebP, SVG and iPhone HEIC files all work.

  2. Choose how many colours

    Set Number of colors from 3 to 12 (6 is the default), then press Extract Palette. If you change the number afterwards, press it again.

  3. Copy the colours

    Click any colour to copy its hex code, or press Tab to reach it and Enter to copy; Copied shows it worked. For code, choose CSS, SCSS, Tailwind or JSON under Export format and press Copy.

How the colours are chosen

The extractor looks for the colours that cover most of your image:

  • It shrinks a copy to 200 pixels on its longest side, which is enough to find the main colours quickly.
  • It skips pixels that are more than half transparent, so the empty background around a logo doesn’t count as a colour.
  • It groups similar shades, counts the pixels in each group and picks the most common, skipping any too close to one it already has. You get distinct colours, not six versions of the same blue sky.

Each percentage is how much of the image is closest to that colour, so together they make about 100%, largest first. Flat artwork gives exact colours: a logo filled with #E11D48 gives #E11D48. In a photo, each colour is the average of a group of very similar shades.

Because it counts pixels, a four-colour graphic gives four colours even if you ask for 12, and a small bright detail on a large plain background barely registers, so crop to the part you want first. Shares of 0% or 1% are often edge pixels where two colours blend.

Brand colours and design apps

For brand colours, start from the original PNG or SVG of your logo rather than a screenshot or a JPG: JPEG compression and screenshots can shift colours slightly. Crop away anything that isn’t the logo, set the number of colours to match it, and extract. If your brand guidelines list official hex codes, those are the final word.

Figma, Canva, Photoshop and most other design apps accept hex codes. Click a colour here, paste it into the app’s colour picker, and save it as a style or swatch for next time.

Using the palette on a website

The CSS export gives you CSS variables. This is its output for a test image of a blue sky and green hills, with a small red square in one corner:

:root {
  --color-1: #81b0d4;
  --color-2: #639be5;
  --color-3: #438c43;
  --color-4: #415f41;
  --color-5: #236a23;
  --color-6: #fe0000;
}

Paste it into your stylesheet, rename the variables to say what they’re for, such as --brand, and use them as var(--brand). Change a hex code once and every use updates. The other exports:

  • SCSS gives Sass variables ($color-1 and so on).
  • Tailwind gives a colors block for tailwind.config.js, as used up to Tailwind CSS 3. Tailwind 4 sets colours in CSS instead: add them to an @theme block with names like --color-brand to get classes such as bg-brand.
  • JSON lists each colour’s hex code, RGB values and percentage.

Colour formats explained

FormatExampleWhat it’s for
HEX#81B0D4Two digits each for red, green and blue. The format most apps and websites ask for; click a colour to copy it.
RGBrgb(129, 176, 212)The same colour as three numbers from 0 to 255. Shown next to each colour and in the JSON export.
HSLhsl(206, 49%, 67%)Hue, saturation and lightness, handy for making lighter or darker versions. Not given here, but Figma and browser developer tools convert a hex code for you.
CMYKVariesInk amounts for print. The right values depend on the paper and press, so ask your printer.

Check the contrast before you use it

Colours from photos are often mid-tones, which can be hard to read as text or behind it. The Web Content Accessibility Guidelines (WCAG) set minimum contrast ratios. For level AA, normal text needs 4.5:1 against its background; large text (about 24 px, or 19 px bold), icons and button outlines need 3:1.

In the palette above, white text on #438c43 scores 4.1:1, fine for a large heading but not for body text, while white on #415f41 scores about 7:1. Check each pair with a contrast checker (the colour picker in Chrome’s developer tools shows the ratio), and don’t let colour alone carry meaning.

Your image never leaves your device

The colours are worked out by your browser, on your own device, so your image is never uploaded. That matters for unreleased designs and client work.

You can check this yourself: open your browser’s developer tools, watch the Network tab and extract a palette. The only requests are anonymous page-view counts, described in our privacy policy.

Frequently asked questions

How do I find the hex code of a colour in an image?

Add the image, press Extract Palette, then click the colour: its hex code is copied, ready to paste. The tool finds the main colours rather than one exact pixel, so for a particular spot, crop tightly around it first.

Is this color palette extractor free?

Yes. There’s no sign-up and no limit on how many palettes you make.

How many colours can I extract?

From 3 to 12. If the image has fewer distinct colours than you ask for, you get fewer.

Why is a colour slightly different from my brand colour?

Usually because the image isn’t the original artwork: JPEG compression, screenshots and resizing all shift colours a little. Use the original PNG or SVG, and trust the hex codes in your brand guidelines over any image.

Are transparent backgrounds ignored?

Yes. Pixels more than half transparent are skipped, so a transparent PNG gives the colours of the artwork, not the background.

Can I get HSL or CMYK values?

Not here: you get HEX and RGB values, and the CSS, SCSS, Tailwind and JSON exports. Figma and browser developer tools convert a hex code to HSL. For CMYK, ask your printer, as the right values depend on the paper and press.

Does it work with Tailwind CSS?

Yes. The Tailwind export is a colors block for tailwind.config.js (Tailwind 3). In Tailwind 4, add the colours to an @theme block in your CSS instead, such as --color-brand: #81b0d4;.

Does it work with iPhone photos?

Yes. HEIC photos are converted on your device first, then their colours are extracted as usual.

Is my image uploaded to a server?

No. The palette is worked out in your browser, on your device.