A HEX color code is a six-character value used to describe a color on the web. It starts with a hash symbol, then combines numbers and letters that represent red, green, and blue. If you've ever seen a value like #7C3AED, that's a HEX code — and it's the format you'll run into most often in CSS, design tools, and browser inspectors.
How HEX works in CSS
Each pair of characters stands for one RGB channel: the first pair controls red, the second green, the third blue. A higher value means more of that channel is present, which is why #FFFFFF is white (every channel maxed out) and #000000 is black (every channel at zero). #7C3AED breaks down as 7C red, 3A green, ED blue — a mid-low red and green with a high blue, which is what gives it that violet tone.
HEX vs. RGB: which should you use?
| Format | Best for | Example | Good choice when |
|---|---|---|---|
| HEX | CSS, design handoff | #7C3AED | You want a short value that's easy to paste and reuse |
| RGB | Manual color tuning | rgb(124, 58, 237) | You want to see and adjust the individual channel values |
Most teams end up using both: HEX in the stylesheet because it's compact and universally supported, RGB in design conversations because it's easier to read when someone is describing "a bit more red" or "less saturated." A color picker that shows both at once removes the need to convert between them by hand.
Why designers still use HEX
- It's short and easy to paste directly into CSS.
- It works in essentially every design and development tool.
- It's easy to share with a teammate or client over chat — one short string, no ambiguity.
Finding the exact HEX value from a screenshot
Sometimes the best color source isn't a palette file or style guide — it's a screenshot, a logo, or a page you already like. A color picker with an image-sampling mode lets you open that image, select the exact pixel, and read off the HEX (or RGB) value instead of guessing by eye. That's useful for logo matching, recreating a competitor's button color, or pulling a palette out of a piece of inspiration art.
One thing to watch for: if the source image has gradients, shadows, or JPEG compression artifacts, sample a flat area of the color first, then compare a couple of nearby pixels if you need a precise match for hover or secondary states — compression can shift individual pixels slightly off the "true" color.
How to get the right HEX value fast
The easiest way is to open a color picker, choose or sample the shade you want, and copy the HEX code directly rather than typing it from memory. That avoids transcription errors — a single mistyped character produces a completely different, often jarring color — and makes it much easier to compare two near-matching shades side by side.
Copy the exact HEX value
Use the free color picker to sample a color and copy the HEX or RGB code instantly.
🎨 Open Color Picker →Related Guides
→ Best Color Picker Online for HEX and RGB (Palettes & Accessibility)
→ What Is Lorem Ipsum Placeholder Text?
→ Favicon Generator Online Guide