Extract dominant colors from images and convert between HEX, RGB, HSL, and CMYK
Drop an image or click to browse
PNG · JPG · WebP · GIF · max 10 MB
Dominant colors
#3B82F6
Click any field to edit
Tailwind closest
Color Toolkit is two utilities in one tab. The extractor drops an image onto a canvas and surfaces the five dominant colors as HEX swatches with click-to-copy. The converter is a live four-way translator between HEX, RGB, HSL, and CMYK — edit any field and all others update instantly. No server, no dependencies, no upload.
Color Extractor
Color Converter
Extractor: The image is drawn onto an off-screen <canvas>. Every Nth pixel is sampled (N scales with image size to keep it fast — a 4 MP photo samples roughly 1 in 40 pixels). The sampled RGB triplets are then quantized using a simplified median-cut algorithm: the sample space is iteratively bisected along its longest color axis until you have 5 buckets. The centroid of each bucket becomes a representative color. This produces perceptually distinct dominant colors, not just the most frequent raw pixel values.
Converter: All formats convert through RGB as the canonical intermediate:
HEX → RGB: parse 6-digit hex, divide each channel by 255RGB → HSL: compute lightness as (max + min) / 2, saturation based on the delta, hue from which channel is maxHSL → RGB: reverse the hue-sector formula, scale back to 0–255RGB → CMYK: K = 1 - max(R,G,B), then C = (1-R-K)/(1-K), etc.CMYK conversion is device-independent — no ICC profile. For print workflows, use professional software.
Color formats exist for different audiences and use cases, and you constantly need to translate between them.
HEX is the lingua franca of the web. Every HTML color attribute, every CSS value, every Tailwind config expects hex. It’s compact and unambiguous, but completely unintuitive for humans — #1a2b3c tells you nothing about whether that’s a dark blue or a dark green until you render it.
RGB is the hardware model. Screens mix red, green, and blue light. When you’re doing arithmetic on colors in code — blending, darken/lighten transforms, generating palettes — you need RGB. JavaScript canvas operations work in RGB. WebGL shaders work in RGB.
HSL (Hue, Saturation, Lightness) is the designer’s model. It separates the color identity (hue: 0–360°) from how vivid it is (saturation) and how light or dark (lightness). This makes it possible to say “make this color 20% lighter” by just incrementing the L value. Tailwind v4 generates its palette in HSL internally for exactly this reason. When you’re building a design system with systematic color relationships, HSL is the format to work in.
CMYK is the print model. Screens add light (additive color). Printers subtract light by mixing ink (subtractive). The same hex value looks different on screen vs. on paper. CMYK conversion here is a reference, not a print specification.
For a real-world workflow: extract brand colors from a logo using the extractor, convert to HSL to generate tint/shade variations, paste the hex values into your Tailwind theme.extend.colors block. For Tailwind v4 which uses CSS custom properties (--color-brand-500), HSL is directly usable in @theme blocks.
For informational purposes only. Not financial, medical, or legal advice. You are solely responsible for how you use these tools.