Color palette from image: extract the main colors of a picture
Upload a photo or design and get its 5 to 8 dominant colors as HEX, RGB and HSL, ready to copy as CSS variables. The image never leaves your browser.
100 % in your browser: your files and text never leave your device and nothing is uploaded.
How it works
Drop an image, or choose one. It is shrunk on your device and its most common colors are found with the median cut method, from the most to the least frequent. Use the slider to get between 5 and 8 colors. Press any value to copy a HEX, RGB or HSL code, or press the CSS button to copy all colors as variables you can paste into a stylesheet. Transparent areas are ignored. A very flat image, such as a logo with two colors, can return fewer colors than requested.
How to use it
- Drop one image on the drop area, or choose it from your files. A preview is shown.
- Use Number of colors to choose between 5 and 8. It starts at 6 and the palette updates as you move it.
- The colors are listed from the most to the least frequent in the picture. Each one shows HEX, RGB and HSL values.
- Press any value to copy it, for example the HEX code to paste into a design tool.
- Press Copy as CSS variables to copy the whole palette as a :root block with --colour-1, --colour-2 and so on, ready to paste into a stylesheet.
Worked example
You drop a sunset photo and keep the default of 6 colors. The list starts with the dominant deep blue of the sky, followed by oranges, a pink and a dark foreground tone. Pressing Copy as CSS variables gives a block that begins with :root { --colour-1: #1c2a4a; and continues up to --colour-6. Move the slider to 8 to pick up the smaller accent colors. The exact values depend on your picture.
Frequently asked questions
Is my image uploaded?
No. The image is shrunk on your device to about 200 pixels on its longest side and analysed there. Nothing is sent to a server.
How are the colors chosen?
With the median cut method: the pixels are grouped into boxes of similar colors and each box gives one color. They are sorted from the most to the least common, so the first one is the dominant color.
Why do I get fewer colors than I asked for?
A flat image, such as a logo with two colors, does not have eight clearly different groups of pixels, so the tool can return fewer. Transparent pixels are ignored.
Why do the colors differ a little from the exact color I see?
Each color is an average of a group of similar pixels, so it can be slightly different from any single pixel. For one exact pixel use a color picker tool of your editor or browser.
Which image formats can I use?
Any image your browser can open, usually PNG, JPG, WebP or GIF. If the image is fully transparent, the tool tells you no colors were found.