Color Code Extractor

Paste CSS, HTML, theme files or text and get one deduplicated color palette. Normalize to hex, RGB, HSL or export as CSV, JSON, CSS variables, Sass, Less, Tailwind or SVG swatches.

Try:
Extracted palette

About this tool

Color Code Extractor scans pasted CSS, HTML, JavaScript theme files, JSON design-token dumps or plain text and returns one deduplicated palette. It recognizes #rgb, #rgba, #rrggbb, #rrggbbaa, rgb()/rgba(), hsl()/hsla(), hwb(), named CSS colors and transparent.

Deduplication is by the actual color, not by spelling. For example #f00, #FF0000, red and rgb(255, 0, 0) all become one #ff0000 palette entry with a usage count. Alpha is part of the identity, so #ff0000 and rgba(255, 0, 0, .5) stay separate.

Worked example

Input:

.a { color: #f00; }
.b { color: #FF0000; }
.c { color: red; }
.d { color: rgb(255, 0, 0); }
.e { background: hsl(210 50% 40%); }

Default output is a plain list with counts:

#ff0000  ×4
#336699  ×1

Switch Output format to css_vars, scss, less, tailwind, csv, json or svg when you need a reusable palette artifact instead of a plain list.

Options

Limits and edge cases

Everything runs locally in WebAssembly in your browser; your stylesheet is not uploaded.

FAQ

Why did several different spellings collapse into one color?

The palette is deduplicated by normalized RGBA channels. That means #f00, red and rgb(255, 0, 0) represent the same opaque red and become one entry. The usage count and JSON spellings field still preserve how many forms were seen.

Can this extract colors from minified CSS?

Yes. The scanner works on raw text and does not need formatting or line breaks. Paste a whole minified stylesheet and use Sort palette = Most frequent first plus a limit to find dominant colors quickly.

Should I include named CSS colors?

Leave Include named CSS colors on for CSS or design-token files. Turn it off when scanning prose-heavy HTML or text, where normal words such as “orange”, “snow” or “tan” could be accidental matches.

Why are CSS variables skipped?

A value like color: var(--brand) depends on definitions and cascade context outside the literal text. This tool extracts concrete color literals only; resolve variables first if you need their computed values.

Developer & Automation Access

Run it from the terminal

Same engine as this page, headless — via the gizza CLI:

gizza tool color-code-extractor ".btn { color: #f00; background: rgb(255, 0, 0); border-color: hsl(210 50% 40%); }"

New to the CLI? Get gizza →

Open it by URL

Pre-fill and auto-run this tool with query parameters — the names match the API/CLI:

https://gizza.ai/tools/color-code-extractor/?text=.btn%20%7B%20color%3A%20%23f00%3B%20background%3A%20rgb%28255%2C%200%2C%200%29%3B%20border-color%3A%20hsl%28210%2050%25%2040%25%29%3B%20%7D&output_format=list&color_format=hex&sort=first_seen&include_counts=true&include_named=true&exclude_grey=true&exclude_monochrome=true&uppercase=true&limit=0&var_prefix=color

Machine-readable descriptor: tool.json — title + parameters JSON Schema for agents.