How to Find the HEX Color Code in an Image
You need the exact color from a logo, screenshot or photo. Clicking the pixel gets you a code in a second; getting the right code takes a little more care, because compression, shading and smoothed edges all nudge pixel values. This guide covers the quick pick and how to trust the number you copy.
HEX, RGB and HSL in one minute
A screen color is three numbers: how much red, green and blue light to mix, each from 0 to 255. The three common codes are just different ways of writing those numbers down.
| Format | Example | How to read it | Where you will paste it |
|---|---|---|---|
| HEX | #F35C55 | Three pairs of base-16 digits: F3 = 243 red, 5C = 92 green, 55 = 85 blue. | CSS, Figma, Canva, brand guides, most design apps. |
| RGB | rgb(243, 92, 85) | The same three values in plain decimal. | CSS, Office and Google Slides custom colors, code. |
| HSL | hsl(3, 87%, 64%) | Hue as an angle on the color wheel (3° is red-orange), then saturation and lightness in percent. | CSS, and whenever you want a lighter or darker version of a color: change only the last number. |
HEX and RGB carry the same information. HSL is rounded to whole numbers, so for an exact match, copy the HEX.
The quick way: pick a color on the page
The Color Picker page opens your image right in the page. The image is read inside your browser tab and never leaves your device.
- Open the image. Go to /color-picker and choose a file or drop it anywhere on the page. JPG, PNG, WebP, GIF and iPhone HEIC photos all work, up to 100 megapixels.
- Aim with the magnifier. Move the pointer over the image. A round magnifier enlarges the 11 × 11 pixels around the pointer and shows the HEX code of the center one, so you can see whether you are on a flat area or on an edge.
- Click to pick. Click the pixel you want. The HEX code goes straight to your clipboard, and the panel shows a large swatch with the HEX, RGB and HSL values. The status line confirms “HEX copied”.
- Copy another format.
Each of the HEX, RGB and HSL rows has its own Copy button. Use it when the
place you are pasting into wants
rgb(…)rather than a hash code. - Check a few spots. Click two or three more points in the same area. Each lands in Your picks (the last eight are kept). If they disagree, see the accuracy section below.
- Grab the palette. Under Dominant colors, click any swatch to make it the current color and copy its HEX, or press Copy all HEX codes to copy the whole palette at once.
Get the whole palette
For a photo, or a color scheme that “feels like” an image, the Dominant colors list is faster. It groups similar pixels into up to eight clusters and shows each cluster’s average color with its share of the image, largest first.
A palette swatch is an average of many pixels. On our test flyer, the big navy panel drawn
as #1B2A41 came out as #1C2A42 (42% of the image), almost exact,
but the small coral logo was blended with warm sunset tones into a muddier
#D0736E. For small logos and buttons, pick directly.
Why the code can be slightly off
We drew the test flyer with exact colors, saved it as an ordinary JPG, and sampled it. Here is what came back:
| Element | Drawn as | Sampled | Why |
|---|---|---|---|
| Large navy panel | #1B2A41 | #1B2A41 | A big flat area compresses cleanly. |
| “Order now” button | #2F6FEB | #2F6FEB | Flat, and sampled away from its edge and label. |
| Coral logo ring | #F25C54 | #F35C55 | JPEG compression rounding: one step off per channel. |
| Thin amber stripe | #FFB020 | #F9B31F | Only 28 px tall next to navy; JPEG stores color at lower resolution than brightness, so neighbors bleed in. |
| Cream headline letters | #F6F1E7 | #DBDCDE | The click landed on an anti-aliased edge, half letter and half navy. |
The usual culprits, roughly in order of how often they matter:
- Edges and text. Edges use in-between pixels to look smooth, so a pick near an edge is a blend. Sample the middle of a shape.
- JPEG compression. JPG approximates colors in small blocks and keeps color detail at reduced resolution. Big flat areas come through almost unchanged; thin lines and small shapes drift. A PNG of the same logo would have sampled exactly.
- Lighting and shading. A photographed wall or product has no single color: shadows are darker, highlights paler. Sample an evenly lit area, and don’t expect it to match a paint chip.
- Noise. Phone photos, especially in dim light, have grain, so neighboring pixels differ by several values. Averaging fixes this (next section).
- Color profiles. Browsers generally convert images that carry a color profile, such as Display P3 from recent phones, into sRGB when they decode them, and the codes you get are sRGB codes, which is what CSS and most web tools expect. Saturated colors outside the sRGB range are pulled in to the nearest color that fits, so an extremely vivid red may read a little duller than the original file.
Averaging and saving colors in the editor
The page tool reads a single pixel. When you need an average, or want to keep a set of colors to paint with, open the image in the editor (the Edit further in the editor button on the Color Picker page hands the image over directly).
- Choose the Eyedropper. Press I, or pick Eyedropper in the toolbar. It shares a slot with the Ruler, Protractor, Count and Note tools.
- Set the Sample Size. In the options bar, change Sample Size from Point Sample to 3 by 3 Average or 5 by 5 Average. The 5 × 5 setting averages 25 pixels around the click, which smooths out JPEG drift and photo noise. Fully transparent pixels are skipped, so sampling next to a cut-out edge stays clean.
- Click the color. A click sets the active color, the foreground by default. Alt+click (Option+click on a Mac) sets the other one, so you can grab two colors without switching. The Eyedropper reads what you see: all visible layers combined, not just the active layer. Picking a color is not an edit, so it adds nothing to History.
- Read the code. Open the Color panel (Window › Color). Its Hex field shows the picked color, with R, G and B fields below. Hovering over the image updates the Info panel with the HEX, RGB, HSB and an approximate CMYK of the pixel under the cursor, plus its X and Y position, without clicking.
- Save it as a swatch. Press + (Add swatch) at the end of the swatch row in the Color panel. Swatches are kept in this browser between visits; click one to use it again, or its × to remove it.
On a flat graphic, point and average samples agree (both gave #F35C55 on the
coral ring). On a noisy photo the point samples scatter while the average stays put, so
use 5 by 5 Average by default and Point Sample only for one-pixel details.
Check the color before you use it
A color that looks fine in a logo can be hard to read as text. More › Color Tools… in the editor has a Contrast tab that computes the WCAG contrast ratio between two colors and shows pass or fail for normal and large text.
- Enter the color. Open More › Color Tools…. On the Convert tab, paste your HEX code into the HEX field. The tool starts at black each time, so paste the code even if it is already your foreground color.
- Set the background. Switch to Contrast and set Background to the color the text will sit on. The preview and the ratio update immediately.
- Read the result. AA (normal) needs 4.5:1 and is the usual minimum for body text; AA (large) needs 3:1 and applies to large or bold headings.
On our flyer the results were clear-cut. Navy on cream scored 12.83:1 and passed every grade. The blue button color scored 4.06:1, enough only for large text, and coral scored 2.88:1 and failed everything. So body text should use the navy. The Convert tab also shows the color as RGB, HSL, HSV and CMYK with copy buttons (the CMYK figures are a simple conversion, not a print proof).
Troubleshooting
Every click gives a slightly different code
The area is noisy or shaded. Use the editor’s Eyedropper with 5 by 5 Average, or pick several points and use the value that repeats.
The code was not copied
Some browsers block clipboard access in certain situations. The status line then shows only “Picked” and the code, without “HEX copied”. Select the code shown next to HEX and copy it with Ctrl+C (Cmd+C on a Mac).
The picker says the pixel is transparent
On a PNG with transparency, the panel notes how transparent the pixel is, and the codes show its color without the transparency. Pick inside the solid part of the shape.
Try it in Photoyam
Drop an image, hover, click, and the HEX code is on your clipboard. It runs in your browser, needs no sign-up, and your image never leaves your device.
FAQ
Why is the HEX code I picked slightly different from the official brand color?
Because the image is not the original artwork. JPEG compression, resizing, shading, noise and color-profile conversion all shift pixel values a little, so a logo exported as #F25C54 can read as #F35C55. If you need the official value, ask for the brand guide or the source file; a sampled color is a very close match, not a guarantee.
Can I get the average color of an area instead of one pixel?
The Color Picker page reads a single pixel. For an average, open the image in the editor, choose the Eyedropper (I) and set Sample Size in the options bar to 3 by 3 Average or 5 by 5 Average. Transparent pixels are left out of the average.
Does it work on a phone?
Yes. Touch and drag on the image: the magnifier floats above your finger so you can see what you are aiming at, and lifting your finger picks that pixel. The HEX code is copied, and the RGB and HSL rows have their own Copy buttons.
Is my image uploaded anywhere?
No. The image is decoded and sampled inside your browser tab. Nothing is sent to a server, which is why it also works on confidential mockups and client files.
Can I pick a color from my screen or another website?
Photoyam samples images you open, not the rest of your screen. Take a screenshot (on Windows, Win+Shift+S; on a Mac, Cmd+Shift+4), then open or paste it into the Color Picker page or the editor and pick from that.