Skip to content

Menu

Color Palette Extractor

Extract dominant colors from images with CSS, SCSS, and Tailwind export.

Runs entirely in your browserDesignFree, no sign-up
Loading tool

01What is Color Palette Extractor?

Color Palette from Image pulls the main colors out of a picture and hands them back as code you can paste. You upload a file, and the browser decodes it and draws it onto a hidden canvas inside the page. No upload request is made, so the photo stays on your machine. Large images are scaled down to roughly 10,000 pixels first, which keeps extraction quick. Pixels with alpha below 128 (mostly transparent) are skipped. The colors come from the median cut algorithm, first described by Paul Heckbert in 1982 for color quantization. All pixels start in one box. The tool picks the box with the biggest spread, measured as its pixel count times the range of its widest red, green or blue channel. It sorts that box along that channel and splits it at the median. This repeats until there are as many boxes as colors you asked for: 4, 5, 6, 8 or 10. Each box is averaged into one palette color, and the palette is sorted by how many sampled pixels each box holds. You get a color strip, a card per color with HEX, RGB and HSL values, and an export box. Export formats are CSS custom properties, SCSS variables, a Tailwind config snippet or JSON. A worked case helps show the behaviour. We fed the extraction code 256 pixels of an even black-to-white gray ramp and asked for 4 colors. It returned #202020, #606060, #a0a0a0 and #e0e0e0, each covering 64 pixels. That is the midpoint of each quarter, which is exactly what median cut should do. Now the honest part. Because boxes split at the median pixel, not at a color boundary, a box can straddle two flat colors. With an image of 60% pure red and 40% pure blue, 4 colors gave #ff0000, #0000ff twice, and #cc0033, a blend that is not in the image. Duplicate swatches and in-between colors are normal for images with only a few flat colors. Photos and illustrations behave better. Hex codes come out in lowercase. If you change the color count after uploading, click Re-extract to run it again.

Web designers and front-end developers who need a quick, code-ready palette from a logo, photo or mood-board image. The tool runs entirely in your browser, so your data never leaves your device.

02How to use Color Palette Extractor

  1. Click Upload Image and choose an image file your browser can display, such as JPEG, PNG, WebP or GIF.
  2. Pick how many colors you want from the Colors menu: 4, 5, 6, 8 or 10. The default is 8.
  3. Click a swatch in the color strip, or the copy icon on a card, to copy that hex code.
  4. Choose CSS Variables, SCSS Variables, Tailwind Config or JSON under Export Palette, then click Copy.
  5. If you change the Colors value after uploading, click Re-extract to recompute the palette.

03Worked examples

Input: Gray ramp of 256 pixels from #000000 to #FFFFFF, Colors 4
Result: #202020, #606060, #a0a0a0, #e0e0e0 (64 pixels each)
Produced by running the tool's median cut code on a synthetic pixel list. Each color is the middle of one quarter of the ramp.
Input: Same gray ramp, Colors 4, Export Palette SCSS Variables
Result: $color-1: #202020; $color-2: #606060; $color-3: #a0a0a0; $color-4: #e0e0e0;
SCSS export numbers colors in palette order, most common first.
Input: First two colors of that palette, Export Palette Tailwind Config
Result: colors: { 'palette-1': '#202020', 'palette-2': '#606060', }
Trimmed to the colors block. The full export wraps it in module.exports = { theme: { extend: { ... } } }.
Input: Image that is 60% pure red and 40% pure blue, Colors 4
Result: :root { --color-1: #ff0000; --color-2: #0000ff; --color-3: #0000ff; --color-4: #cc0033; }
Median splits can land inside a run of identical pixels, giving a duplicate blue and a blended #cc0033 that is not in the image.
Input: Image that is 90% #F0F0F0 and 10% #DC1E1E, Colors 4
Result: #f0f0f0, #f0f0f0, #e04848, #f0f0f0
The red accent is averaged with some background pixels, so it comes out lighter than the real #dc1e1e.
Input: First gray ramp color, Export Palette JSON
Result: [{ "hex": "#202020", "rgb": "rgb(32, 32, 32)", "hsl": "hsl(0, 0%, 13%)" }]
Reformatted onto one line here. The tool prints it with two-space indentation.

04Common use cases

  • Pulling a starting palette from a client's logo or product photo to draft a website theme
  • Matching UI accents to a hero image so buttons and headings pick up colors from the artwork
  • Getting a ready-to-paste :root block of CSS variables from a mood-board screenshot
  • Exporting a Tailwind colors snippet from a brand illustration to seed a tailwind.config.js
  • Checking which colors dominate a screenshot of an old site before a redesign
  • Handing a JSON list of hex, rgb and hsl values to a script that generates design tokens

05Tips

  • Crop to the part you care about first. A large plain background can fill two or three slots with the same color.
  • Small vivid details, like a red button in a big screenshot, get averaged with their neighbours. Raise the count to 8 or 10 to give them their own slot.
  • Logos with a few flat colors can produce duplicates and blended in-between swatches. Delete those by hand before exporting.
  • The palette is ranked by coverage, not readability, so check text contrast before using any of these colors for type.
  • The exports use generic names like --color-1 and palette-1. Rename them to roles like --brand or --accent before they go into a real theme.

06Related concepts

Median cut, Color quantization, Design tokens, Canvas API, Dominant color.

Frequently Asked Questions

What is Color Palette Extractor?

Color Palette Extractor is a free, browser-based developer tool on AIDToolStack. Extract dominant colors from images with CSS, SCSS, and Tailwind export. It requires no installation or sign-up and works entirely in your browser.

Is Color Palette Extractor free to use?

Yes. No sign-up, no fees and no usage cap.

Does Color Palette Extractor store my data?

No. It runs in your browser; nothing is uploaded.

Related Tools

Reviews and commentsShow

Reviews

Sign in to leave a review.

Loading reviews…

Comments

Sign in to leave a comment.

Loading comments…

What changed in AI dev tools, once a month

Renames, shutdowns, pricing changes and new MCP setups, each with a source.

Subscribe