Extract Hex Colors finds every hex color code in your CSS or text and lists each one on its own line. Paste your code, click the button and copy the result. It is free and runs in your browser.
background: #fff; color: #2c7be5; margin: 0 auto;
#fff #2c7be5
Bookmark: press Ctrl+D (Windows) or Cmd+D (Mac) to save this tool.
This tool finds the hex color codes in your CSS or text and puts each one on its own line. Everything else is removed from the result.
A hex color code starts with # and has 3, 4, 6 or 8 hex digits, like #fff or #2c7be5. The 4 and 8 digit forms include a transparency value. A # followed by anything else, such as #12345 or an HTML entity like ', is skipped.
Use it to collect the colors of a stylesheet, build a palette, or check which colors a design uses. Repeated codes can be listed once.
Each example shows the CSS or text before and after extracting. Duplicates are removed unless the option is off.
| Case | Before | After |
|---|---|---|
| CSS example | background: #fff; color: #2c7be5; margin: 0 auto; | #fff #2c7be5 |
| Several codes in one line | Colors: #FF5733, #33FF57 and #3357FF | #FF5733 #33FF57 #3357FF |
| Codes with alpha (8 digits) | overlay: #00000080; | #00000080 |
| No # sign is skipped | color ff0000 and #ABC | #ABC |
| Not a color code is skipped | Issue #12345, #abcdefg and #1a2b3c | #1a2b3c |
| Duplicates removed | #fff #FFF #000 #fff | #fff #000 |
| Duplicates kept (option off) | #fff #000 #fff | #fff #000 #fff |
Listing the colors used in a stylesheet or theme file, building a palette, comparing a design with its code, and cleaning up colors before a redesign.
Only codes that start with # are found. Colors written as rgb(), hsl() or a name such as red are not included, and the result replaces your text, so use Undo if you need the original.
To see a color try Hex Code Visualizer. To make new colors try Random Color Generator.
It finds every hex color code in your CSS or text, such as #fff or #2c7be5, and puts each one on its own line. Everything else is removed from the result.
Paste your CSS or text, or import a text file, then click Extract Hex Colors. The codes replace the text in the box. Click Copy to use them, or Undo to go back.
Codes that start with # and have 3, 4, 6 or 8 hex digits (0-9 and a-f), for example #fff, #ffff, #2c7be5 and #2c7be580. The last two forms include an alpha (transparency) value.
No. A code must start with #. A plain ff0000 or a color name such as red is not matched.
Yes, by default. A code used more than once is listed once, and #FFF and #fff count as the same code. Untick Remove duplicate colors to keep every match.
Yes. A # followed by a number of digits that is not 3, 4, 6 or 8, or by letters outside a-f, is not a color code, and entities such as ' are ignored.
The text is left as it is and you see the message No hex color codes found.
Yes. It is free, needs no account and runs in your browser, so your text is not uploaded to a server.
Last updated: 8 November 2026