한국어
Home › Guides › Image

Extract HEX and RGB color codes from an image: how accurate the eyedropper and palette really are

Image · 7 min read

Pulling a color from a logo or product photo to match slides, product pages or thumbnails is a common task. One click with an eyedropper gives you a HEX code, but whether that code is the true color depends on the image. On December 1, 2026 we ran the Color Palette Extractor on this site and recorded the values to see how far you can trust them.

1. HEX and RGB are two ways to write the same color

Screen colors mix red, green and blue light, each from 0 to 255. RGB writes those three numbers directly, and HEX writes the same numbers as two hexadecimal digits each. #1F6FEB splits into 1F, 6F and EB. 1F is 1×16+15 = 31, 6F is 6×16+15 = 111, and EB is 14×16+11 = 235, so it is the same color as rgb(31, 111, 235). Upper and lower case mean the same thing. The notation is defined in the W3C CSS Color 4 specification (checked December 1, 2026).

A difference of one step in any channel is a different code. If the goal is an exact brand match, counting how many steps your code is off is the most reliable check.

2. Test 1: a logo image with colors we chose

To have a reference, we drew a 1200 x 800 image ourselves: a white background (#FFFFFF), a blue panel (#1F6FEB), an orange circle (#F2A93B) and dark text (#1B1F24), plus white text on the blue panel. Counting pixels gave 53.7% white, 33.7% blue, 10.5% orange and 1.6% dark text. We saved it as PNG (45.5KB) and as JPEG at quality 92% (28.4KB), 75% (19.7KB) and 50% (16.0KB), then loaded each file into the tool.

True colorPNG eyedropperPNG palette (6 colors)JPEG 50% eyedropper
Blue #1F6FEB#1F6FEB#1F6FEB (33%)#1C6FE7
Orange #F2A93B#F2A93B#F2A93C (11%)#F1A93A
Dark text #1B1F24#1B1F24#21252A (2%)#1B1F22
White #FFFFFF#FFFFFF#FFFFFF (52%)#FFFFFF

Three things stand out.

The shares were accurate, though. The 6-color palette gave white 52%, blue 33%, orange 11% and dark text 2%, all within 2 percentage points of the real pixel counts. For seeing which color dominates an image, that is plenty.

Color Palette ExtractorPull the main colors from a photo
Open tool

3. Test 2: a photo of a wall painted in one color

Next, a real photo: a wall painted blue, light blue, red, yellow and pink (1600 pixels wide, 983KB JPEG). We picked six spots on the same blue paint.

HEX values picked at six spots on the same blue wall, and palettes extracted with 5 and 12 colors
Same blue wall, a different code at every spot. Below are the 5-color and 12-color palettes. The outlined pink swatch appeared only with 12 colors. Photo: Rohit Tandon, Unsplash

The six values ranged from #0367CC to #0544B3. Red stayed at 2 to 5, but green spread from 68 to 110 and blue from 179 to 217. Sunlight, shade, mortar lines and the camera's processing differ from pixel to pixel. A photo records the color the camera saw at that moment, not the color of the paint in the can.

The number of palette colors changed the result too.

Palette sizeColors found (by share)What to notice
3#196FBB 46%, #C4BDAB 32%, #AA290E 22%Blue and light blue merge into one
5#C4BDAB 32%, #0556C4 25%, #B52C0E 21%, #3AA7C7 16%, #12284D 6%Yellow and pink blend into one grayish beige
12#C8CEB8 15%, #0464D0 15% ... #D0A1A4 7% ...Pink (#D0A1A4) shows up on its own for the first time

Pink covers about 7% of the photo, yet it did not appear with 5, 6 or 8 colors. Small areas need more palette slots before they show up. Also, the top color at 5 slots, #C4BDAB, is not painted anywhere on the wall. It is an average of yellow and pink. Use the palette for the overall mood, and the eyedropper when you need one exact color.

4. Matching a brand color, step by step

  1. Look for the official code first. A brand guide, the original logo file (SVG or PNG) or the company website's CSS will have the defined HEX. That is the answer.
  2. If there is none, pick a flat area of a PNG screenshot. In Test 1 an uncompressed PNG was exact. Avoid text and thin lines. The tool's eyedropper reads one point of the preview, which is scaled to fit the screen (up to 820 x 520 pixels), so thin details easily mix with neighboring colors.
  3. If you only have a JPEG, pick several spots. Even at quality 50% a flat area was only a few steps off. Pick about three spots and use the value that comes up most.
  4. Treat colors from photos of objects as approximate. As Test 2 showed, the same paint varied by 42 steps in green. If you must match a physical product, ask the maker for the color code.

5. Putting text on an extracted color: the 4.5:1 rule

If you use an extracted color as a background, check that text on it stays readable. Success criterion 1.4.3 of WCAG 2.2 asks for a contrast ratio of at least 4.5:1 for normal text and 3:1 for large text (18 point, or 14 point bold) (checked December 1, 2026). The ratio is calculated from the relative luminance of the two colors, and the formula is in the same document. These are the results from the contrast checker in the Color Converter for the colors in this article.

BackgroundWhite textBlack textTakeaway
#1F6FEB (logo blue)4.63:14.53:1Both barely pass, with no margin for small text
#F2A93B (logo orange)2.00:110.51:1White fails even for large text. Dark text #1B1F24 gives 8.29:1
#0367CC (wall, spot 1)5.50:13.82:1White text passes
#0544B3 (wall, spot 6)8.45:12.48:1Same wall, very different contrast

The logo blue is the one to watch. White text at 4.63:1 clears the 4.5:1 line by only 0.13, so a slightly lighter value picked from a photo could fall below it. And the two spots from the same wall gave 5.50 and 8.45 with white text. Which spot you pick can change a design decision.

Color ConverterConvert HEX, RGB and HSL instantly
Open tool

When you have several colors, copy them all at once with the palette tool's CSS variables button, then check contrast only for the pairs you will actually use as background and text. To blend two of them into a background, paste the same codes into the CSS gradient tool.

Tools in this article

Color Palette ExtractorPull the main colors from a photo
Open tool
Color ConverterConvert HEX, RGB and HSL instantly
Open tool
CSS Gradient GeneratorBuild a gradient, copy the CSS
Open tool