Hex Color Extractor

Pull every hex color code out of CSS or text and count each unique value.

The Hex Color Extractor scans any block of CSS, code, or plain text and collects every hexadecimal color code it can find, then presents them as a tidy table with a usage count beside each unique value. Instead of scrolling through a stylesheet hunting for color declarations, you get an instant inventory of exactly which colors a file uses and how often each one appears.

It recognises the three common hex notations: the short three-digit form such as #fff, the standard six-digit form such as #ff8800, and the eight-digit form that includes an alpha channel such as #ff8800cc. Matching is boundary aware, so partial strings and IDs that merely look like hex are ignored, leaving you with genuine color values rather than false positives.

Everything runs locally in your browser using JavaScript, so nothing you paste is uploaded or stored anywhere. Designers, front-end developers, and anyone auditing a theme can drop in a stylesheet, review the extracted palette, and export the list, all while keeping proprietary code entirely on their own machine.

Features

  • Detects three-digit, six-digit and eight-digit hex color codes, covering shorthand, full and alpha-channel notations.
  • Uses word-boundary matching so unrelated hex-like strings are far less likely to be picked up by mistake.
  • Counts how many times each unique color appears, revealing the dominant colors in a stylesheet at a glance.
  • Optionally lowercases every code so that mixed-case values such as #FFF and #fff are treated as one color.
  • Sorts the results by frequency so the most-used colors surface at the top of the extracted palette.
  • Reports total matches and the number of distinct colors, giving a quick measure of palette complexity.
  • Exports the color table to CSV or XLSX, or copies it to the clipboard for pasting into design docs.

How to use Hex Color Extractor

  1. Paste your CSS, code, or any text containing hex color codes into the input box.
  2. Leave the lowercase option enabled to merge case variants, or turn it off to keep original casing.
  3. Read the table, where each row shows a unique hex color alongside the number of times it appears.
  4. Check the stats to see the total number of color codes found and how many are distinct.
  5. Identify overused or near-duplicate colors that could be consolidated into a smaller palette.
  6. Export the table to CSV or XLSX, or copy it, to document the palette or feed it into other tools.

Benefits

  • Front-end developers audit a stylesheet to understand its true color palette before a refactor.
  • Designers extract the working colors from a prototype or theme to build a formal palette.
  • Teams spot near-duplicate colors that should be unified into shared design tokens or variables.
  • Anyone reviewing inherited code gets an instant overview of the colors a project actually uses.
  • Accessibility reviewers gather every color in play as a first step toward contrast checking.
  • Because processing is local, proprietary stylesheets and brand colors never leave your device.

Hex colors are the most common way to specify colors in CSS and many design tools. A leading hash is followed by three, six, or eight hexadecimal digits: three-digit codes are a shorthand that doubles each digit, six-digit codes give full red-green-blue precision, and eight-digit codes add an alpha channel for transparency. This tool understands all three so your inventory is complete regardless of which notation a file prefers.

The usage count is often more useful than the raw list. A color that appears dozens of times is likely a core brand or theme color, while one that appears a single time may be an accidental one-off or a candidate for consolidation. Sorting by frequency makes these patterns obvious, which is invaluable when you are trying to shrink a sprawling palette into a manageable set of design tokens.

All extraction happens in your browser with JavaScript, so nothing you paste is transmitted or saved, making the tool safe for confidential or unreleased code. Keep in mind that it only recognises hexadecimal notation, so named colors, rgb() and hsl() functions are not included; if your stylesheet mixes formats, treat this as a hex-specific audit rather than a full color census.

Frequently asked questions

Related tools