On-device AI — professional-grade, fully private.

Images

Color Picker From an Image: Find the HEX, RGB or HSL Code of Any Color

How to get the exact color code from an image or logo, which format to copy (HEX, RGB or HSL), and why one sampled pixel can lie. Runs on your device.

Updated November 1, 20267 min read

To find the color code of something in a picture, open the image in the color palette generator, pick the spot with its eyedropper or read the swatch, and copy the HEX code. Then paste that code into the color picker to see it as RGB, HSL and ten other formats. One honest note first: the color picker itself does not read pixels from an uploaded image. It takes a color you choose or type and converts it. The image step belongs to the palette generator, and the two work well as a pair.

Does the color picker take colors from an image?

No. The color picker has a color chooser (Pick a colour), a Colour value box that accepts any CSS color such as #FF4D4D, rgb(255 77 77) or red, and a Whole file mode that rewrites every color in a stylesheet or token file. Its file box reads CSS, SCSS, SASS, LESS, JSON, SVG and TXT only. If you drop a PNG or JPG on it, it refuses the file and points you to the palette generator. That is the right place for pictures, so use each tool for what it does.

You want to…UseWhat you get
Find the color of a spot in a photo or logoColor palette generatorSwatches with HEX codes, plus an eyedropper on the image
See one color as RGB, HSL, CMYK and moreColor pickerTwelve formats at once, each with a Copy button
Check if a color is readable on white or blackColor pickerContrast ratios with AA and AAA pass or fail
Turn a HEX code into plain RGB numbersHEX to RGBThe three channel values

Get the color code from an image, step by step

1

Add the image

Open the palette generator and drag the picture onto it, paste it with Ctrl+V (⌘V on a Mac), or use Browse. PNG, JPG, WebP, AVIF, GIF, BMP, SVG and ICO all work.

2

Extract the palette

Choose an algorithm and press Extract palette. For a logo, pick Frequency: it anchors each swatch on a color that really covers an area, which is what you want for a brand color. For a photograph, K-means separates the distinct color groups better.

3

Read the swatch, or use the eyedropper

Each swatch shows its HEX code. If the automatic answer is close but not the exact spot you meant, press or drag on the image to replace a swatch with the color under your pointer.

4

Copy the HEX code

Copy the code of the swatch you want. A swatch is the average of the pixels it represents, so a flat #ff0000 logo comes out as exactly #ff0000.

5

Paste it into the color picker

Open the color picker and paste the code into the Colour value box. HEX, RGB, HSL, CMYK and the rest appear together, and each has its own Copy button.

Convert a color into twelve formats, check contrast and see how it looks with color-vision deficiencies. Free: one color is not capped, and a whole file converts up to 200 colors (10 MB). It all runs on your device, not our servers.

Open the color picker

HEX, RGB or HSL: which code should you copy?

CodeLooks likeCopy it when
HEX#3B82F6You are pasting into CSS, a design tool or a brand sheet. It is the shortest and the most widely accepted.
RGBrgb(59, 130, 246)You need the three numbers, or a tool asks for red, green and blue separately.
HSLhsl(217, 91%, 60%)You want a lighter, darker or softer version. Change lightness or saturation and the hue stays put.
CMYK76, 47, 0, 4Someone asked for print values. Treat it as a guide only, because it is a conversion, not a measurement of ink.

All of these describe the same color, and converting between HEX, RGB and HSL loses nothing. If you want the reasoning behind each model and how to read a hex code by eye, the guide to HEX, RGB, HSL and CMYK covers it. When you need a whole set of colors from one picture rather than a single code, see creating a color palette from an image.

Why a sampled pixel can mislead you

A pixel is a measurement of one tiny spot, and a spot is rarely a fair picture of the color you mean. These are the usual reasons the code you read is not the code you wanted.

CauseWhat happensWhat to do
JPEG noiseCompression changes neighbouring pixels by a few steps, so two pixels in a flat area give two different codesUse an averaged swatch, not one pixel, and prefer a PNG or SVG original
Shadow or highlightLightness changes while the hue stays about the same, so a shaded part gives a darker codeSample the evenly lit area, or sample then lighten using HSL lightness
Anti-aliased edgesPixels on an edge are a blend of the shape and its backgroundSample well inside the shape, never on the outline
Photo lightingA logo photographed on a table is tinted by the room lightUse the original logo file, not a photo of it
TransparencyTransparent pixels store black, which can drag an average toward blackKeep the generator's Transparent pixels setting on Ignore

JPEG deserves a special mention. It stores brightness at full detail but color at reduced detail, in blocks of pixels, so thin colored lines and the edges of text carry color errors that a flat area does not. If a brand color matters, ask for the PNG, SVG or the brand guide instead of reading it from a compressed screenshot. The guide to PNG, JPG and WebP explains which formats keep colors exactly.

How to sample well

  • Sample the middle of a flat area, away from edges, gradients and text.
  • Take two or three samples of the same area. If the codes differ by a few steps, the image is noisy and an averaged swatch is more honest than any single pixel.
  • Use the largest, cleanest version of the image you have. A tiny thumbnail has fewer pixels and more blur at every edge.
  • For a logo, use the Frequency algorithm so the swatch is a color that really covers an area, not a blend of two real colors.
  • Compare the copied code against the image by eye. If the swatch looks different from the original, you sampled a shadow or an edge.

Screen color is not print color

The same code can look different on two screens. Monitors differ in brightness, warmth and gamut, and some images carry a color profile that tells software how to interpret the numbers. Most web color is sRGB, and HEX, RGB and HSL codes written in CSS are read as sRGB. A photo taken on a phone with a wide-gamut display may hold colors outside sRGB, and converting it to a code means choosing the nearest sRGB color. The color picker shows a note and the closest sRGB color when a value is outside what an sRGB screen can show.

Print is a further step. CMYK values on screen are a conversion, and the printed result depends on the paper and the press. If a printed color must match, ask the printer for a proof rather than trusting any number.

After you have the code

The color picker does more than convert. It shows the nearest CSS color name and how close the match is, the contrast ratio of your color against white, black or any color you type, with AA and AAA results, and a simulation of how the color looks with protanopia, deuteranopia, tritanopia and no color vision. It remembers your last twelve colors on this device so you can compare candidates without retyping. These checks matter before you use a sampled color for text or a button, because a code that matches the logo perfectly can still be unreadable on a white page.

Frequently asked questions

How do I find the color code of something in an image?

Add the image to the color palette generator, extract the palette, then read a swatch's HEX code or press on the image with the eyedropper to replace a swatch. Paste the code into the color picker to see it in other formats.

Can the color picker pick a color straight from my image?

No. The color picker converts a color you choose or type and cannot read pixels from an uploaded picture. It refuses image files and sends you to the palette generator, which does read images.

How do I get the HEX code from a logo?

Use the original PNG or SVG if you have it, extract the palette with the Frequency algorithm, and copy the swatch's HEX code. A flat color in a logo comes out as the exact code.

Why does the code I picked look different from the color on screen?

You may have sampled a shadow, an anti-aliased edge or a noisy JPEG pixel, or your screen may show colors differently from the file. Sample the flat middle of an area and compare against the original.

Should I use HEX, RGB or HSL?

Copy HEX for most web and design work. Use RGB when you need the three numbers, and HSL when you plan to make the color lighter, darker or softer while keeping the same hue.

Is the color picker free, and are my images uploaded?

Converting one color has no cap, and a whole file converts up to 200 colors on the free plan. It all runs on your device, not our servers. The palette generator extracts up to 8 colors free from one image up to 25 MB.

Keep reading

More in Images →