Color Palette from Image
Local only — nothing is uploaded unless you save or share it.
Drop in a picture and get its dominant colors as HEX, RGB and HSL, sorted by how much of the image each one covers.
- Drop in a photo, logo or screenshot: JPEG, PNG, WebP, HEIC and more
- Choose how many colors you want, from 3 to 12; the palette updates at once
- Copy any HEX, RGB or HSL value, or copy the whole palette as CSS variables
- Download the palette as a PNG strip, a CSS file or JSON
Palette
Pairs readable as text
Color pairs from this palette with a contrast of at least 4.5:1, the WCAG AA level for normal text. The numbers are the palette's.
No two colors here reach 4.5:1, so use black or white for body text on them.
Save this tool
Keep Color Palette from Image handy
Use your browser's Share menu, then “Add to Home Screen”.
Embed
Put Color Palette from Image on your website
Paste this into your page. It shows the tool, free, with a link back to it.
About this tool
A color palette from an image is the quickest way to borrow a mood: the sandy beige and teal of a holiday photo, the brand colors of a logo, the muted greens of a painting. Drop the picture in and this tool reads its dominant colors, from three to twelve, and lists them in order of how much of the image each covers, with the share as a percentage, so the background and the accent are not mistaken for one another. Every color is given as HEX, RGB and HSL with a copy button beside each, and the whole palette can be copied as CSS variables or downloaded as CSS, as JSON for a script or a design token file, or as a PNG palette strip to drop into a mood board. It also lists which pairs of colors in the palette are readable as text on each other by the WCAG AA rule of 4.5:1, which is the first question once a palette becomes a website. How the colors are picked matters. The image is sampled on a grid, the samples are grouped by k-means clustering in CIELAB, a color space built so that equal distances look equally different, and each color is the true average of the pixels in its group. The clustering starts from a fixed seed, so the same image always gives the same palette. Colors nobody could tell apart are merged, so a three-color flag gives three colors, not five shades of the same red. Transparent pixels are ignored. Nothing is uploaded: the image is read in your browser.
Frequently asked questions
How do I extract colors from an image?
Drop the image on the page and the palette appears straight away, largest color first. Each color shows its HEX, RGB and HSL code with a copy button, and its share of the picture as a percentage. Change the number of colors and the palette is worked out again.
How are the dominant colors chosen?
The image is sampled on a grid and the samples are grouped with k-means clustering in CIELAB, a color space where equal distances look equally different to people. Each palette color is the average of the pixels in its group, and the share is how many of the counted pixels fell into it. A fixed starting seed means the same image always gives the same palette.
Why did I get fewer colors than I asked for?
Because the image does not have that many clearly different colors. Colors closer together than a person can easily tell apart are merged into one, so a two-color logo gives two colors rather than a list of near-identical shades. The summary under the picture says when that has happened.
Can I use the palette in CSS or Figma?
Yes. Copy CSS puts the palette on the clipboard as CSS custom properties, --palette-1 to --palette-12, each with its share as a comment. Download as JSON gives HEX, RGB and HSL values for a script or design tokens, and the PNG strip can be dropped straight into Figma, Canva or a mood board.
Which colors from the palette can I use for text?
Under the palette, every pair of its colors that passes WCAG AA for normal text, a contrast of at least 4.5:1, is listed with its ratio and drawn as text on its background. If no pair passes, the palette needs black or white for body text; the contrast checker can test those.
Does it ignore transparent backgrounds?
Yes. Pixels that are more than half transparent are left out, so a logo on a transparent background gives the logo's colors, not a large share of empty black or white.
Is my image uploaded?
No. The image is read and analysed in your browser and never leaves your device. There is an API for developers that runs the same code on our server, and that one does receive the image you send it.
Help improve this tool
Found a bug, want a change, or need a tool we don't have?
You have an unsent draft.
Thanks — that's with us. You'll find the reply in your inbox.Go to my messages