How to Pick a Color From an Image (HEX and RGB Codes)
To grab an exact pixel color from any photo, logo, or screenshot, open the Image Color Picker, upload your image, and click the spot you want to read its HEX and RGB values. If you want the overall color scheme instead of one pixel, use the Color Palette Generator to pull up to 8 dominant swatches in one click.
In this guide
- Which color tool to use
- Step 1: Upload your image
- Step 2: Click the pixel you want to sample
- Step 3: Copy the HEX and RGB codes
- How to extract a full palette (up to 8 swatches)
- Why the same logo gives different codes in different spots
- How to convert HEX to RGB by hand (worked example)
- Using picked color codes in CSS
- Common mistakes when sampling colors
- Nothing is uploaded
- Frequently asked questions
- Related tools and guides
Which Color Tool Should You Use?
Sampling one specific pixel and summarizing an entire photo are two different jobs. Use this table to pick the right tool before you start:
| I need | Use | You get |
|---|---|---|
| One exact pixel color (logo, button, UI background) | Image Color Picker | Live preview swatch plus exact HEX: and RGB: values |
| Overall color scheme of a photo or design | Color Palette Generator | Up to 8 dominant color swatches with click-to-copy HEX codes |
| Color of a thin 1px border or tiny icon | Image Color Picker with the browser page zoomed in | A bigger target: zoom the page with Ctrl or Cmd and the plus key, and the click still maps to the true image pixel |
| To shift hues, saturation, or contrast of a graphic | HSL Adjuster | Recolored PNG using separate Hue, Saturation, and Lightness sliders |
How to Pick One Exact Color From an Image
Step 1Upload your image
Open the Image Color Picker and click Upload Image to Pick Color, or drag any JPG, PNG, or WebP file onto the drop box. The image opens inside a scrollable canvas with a crosshair cursor.
Step 2Click the pixel you want to sample
Click or tap the exact area you want to inspect. Even if CSS scales the preview down to fit your screen, the tool maps your click back to the image's true pixel coordinates and reads that single pixel directly from the decoded image data.
Step 3Copy the HEX and RGB codes
Look at the result card beneath the canvas. The preview square updates to your sampled color and shows two text readouts: HEX: (for example #2e86ab) and RGB: (displayed as three numbers, such as 46, 134, 171). Note that the picker outputs HEX and RGB only (no HSL or CMYK), and you select and copy the text you need directly from the card.
Sample exact pixel colors in your browser
Reads decoded pixel data straight from your JPG, PNG, or WebP.
Open Image Color PickerHow to Extract a Color Palette (Up to 8 Swatches)
When you want the whole mood of an image rather than one point, use the Color Palette Generator:
- Click Select Image to Find Color Palette and choose a JPG, PNG, or WebP file.
- Wait a split second while ColorThief (an in-browser quantization library that groups similar pixels together) builds the palette under Extracted Palette (Click Swatch to Copy Hex). You receive up to 8 swatches ordered roughly from the largest color groups to smaller ones (or 1 swatch if the image is a single solid color).
- Click any swatch, or tab to it and press Enter or Space, to copy its HEX code to your clipboard. The label changes to Copied! for 1.5 seconds and announces the code below the row. If your browser blocks clipboard access, the status line prints the HEX code so you can copy it manually.
Why the Same Logo Gives Different Codes in Different Spots
If you click three spots on a solid blue brand badge and get #1c64f2, #1e66f0, and #749cf5, the picker is not broken. Two file-level effects alter neighboring pixels:
- JPEG compression artifacts: JPEG saves space by dividing images into 8x8 pixel blocks and discarding subtle color precision. That creates faint blotches across flat graphics and ringing noise near sharp text.
- Anti-aliased edges: To keep diagonal lines and curved letters from looking jagged, graphics software blends edge pixels halfway between the foreground shape and the background color. Clicking near a border often grabs a 50/50 mix rather than the true logo hue.
How to sample accurately: Whenever possible, pick from a lossless PNG screenshot or export instead of a compressed JPG. Click dead center inside the thickest solid region, well away from edges and shadows. If the detail is tiny, zoom the browser page in (Ctrl or Cmd and the plus key) so the pixel becomes a bigger target; the picker still reads the true image pixel. An image wider than the preview pane is shown scaled down, so crop it first in the Image Cropper to work on it at full size. On natural photos (skin, sky, fabric), sample three or four spots in the same area to see the typical range.
Converting HEX to RGB by Hand: One Worked Example
HEX (hexadecimal, base-16) and RGB (Red, Green, Blue, base-10 from 0 to 255) represent the exact same numbers in two notations. Every two characters in a six-digit HEX code equal one RGB channel, using digits 0-9 plus letters A=10, B=11, C=12, D=13, E=14, F=15.
Here is how to convert #2E86AB by hand:
- Split into three pairs: Red =
2E, Green =86, Blue =AB. - Multiply the first digit by 16 and add the second digit:
- Red (
2E):(2 x 16) + 14 = 32 + 14 = 46 - Green (
86):(8 x 16) + 6 = 128 + 6 = 134 - Blue (
AB):(10 x 16) + 11 = 160 + 11 = 171
- Red (
- Write the RGB result:
rgb(46, 134, 171).
Using Picked HEX and RGB Codes in CSS
Once you copy the values from the picker or palette swatches, store them as CSS custom properties in :root so you only change them in one place. Keep HEX for solid colors and use the RGB numbers when you want built-in transparency with modern CSS slash syntax:
:root {
--brand-primary: #2e86ab;
--brand-surface: rgb(46 134 171 / 0.12);
}
.button-primary {
background-color: var(--brand-primary);
color: #ffffff;
}
.callout-banner {
background-color: var(--brand-surface);
border-left: 4px solid rgb(46, 134, 171);
}For a complete workflow covering how to structure extracted colors into dominant, secondary, and accent roles, plus contrast checking, see a color workflow: extract, build, adjust.
Common Mistakes When Sampling Colors
- Sampling a photo of a printed card or screen: Lighting, glare, and camera white balance shift the real color. Always sample from the original digital image or PNG screenshot when you want exact brand codes.
- Expecting small accent colors in the palette generator: Because ColorThief groups pixels by total area, a tiny bright button inside a huge white screenshot can be outvoted by grays and whites. Use the Image Color Picker for small accents, or crop to that button first.
- Copying straight from an anti-aliased edge: Clicking on the 1px border of text gives a blended transition color instead of the true foreground color.
- Using a failing text contrast pair untouched: Extracted photo colors often lack 4.5:1 text contrast. Adjust lightness in CSS or shift the image cleanly in the HSL Adjuster.
Nothing Is Uploaded
Both the Image Color Picker and the Color Palette Generator decode your image onto a local canvas inside your browser tab. Unreleased brand designs, client mockups, and private screenshots never leave your device.
Frequently Asked Questions
Which color formats does the Image Color Picker output?
It outputs HEX and RGB only, alongside a live color swatch preview. It does not output HSL or CMYK values.
How many colors does the Color Palette Generator extract?
It extracts up to 8 dominant color swatches from the image, or 1 swatch if the image is a single flat color. Clicking any swatch copies its HEX code to your clipboard.
Why do two spots on the same logo give slightly different HEX codes?
JPEG compression creates slight color shifts across flat areas, and anti-aliasing blends edge pixels with the background color. Sample from the solid center of a shape, and use a PNG screenshot when possible.
How do I pick a color from a thin line or tiny icon?
Zoom the browser page in with Ctrl or Cmd and the plus key so the detail is a bigger target. The picker maps your click back to the true image pixel. If a large image is shown scaled down, crop it first with the Image Cropper.
Can I convert a HEX code to RGB by hand?
Yes. Split the six-character HEX code into three two-digit pairs for red, green, and blue, then convert each base-16 pair to a decimal number between 0 and 255.
Related Tools and Guides
- Image Color Picker - click any pixel to read its exact HEX and RGB code.
- Color Palette Generator - pull up to 8 dominant click-to-copy HEX swatches from any photo.
- A Color Workflow: Extract, Build, Adjust - turn raw extracted swatches into a structured UI palette.
- HSL Adjuster - shift hue, saturation, or lightness to fix failing text contrast.
- Duotone Generator - remap shadows and highlights onto two chosen brand colors.
- Image Cropper - isolate small details or crop out busy backgrounds before sampling.