How to get a HEX colour code from any image

Option 1 is our own tool. The others are built into your browser or computer, or free from Microsoft.

You’ve spotted the perfect colour in a logo, a photo or a screenshot, and you need its exact code for CSS, Canva, PowerPoint or a brand guide. Guessing by eye never quite matches. Here’s how to get the precise value, what the different codes mean, and how to pull a whole palette from an image.

Quick answer

Situation Best option
An image file or screenshot, any device 1. Our Image Colour Picker
A palette of the main colours in a picture 1. Our tool’s palette
A colour on a web page you’re looking at 2. Browser developer tools
Anywhere on screen on a Mac 3. Digital Color Meter
Anywhere on screen on Windows 4. PowerToys Color Picker

HEX, RGB and HSL in brief

These are three ways of writing the same colour. For example, this teal:

  • HEX: #1f7a8c
  • RGB: rgb(31, 122, 140)
  • HSL: hsl(190, 64%, 34%)

RGB gives the amount of red, green and blue, each from 0 to 255. HEX is the same three numbers written in hexadecimal, two digits each: 1f is 31, 7a is 122 and 8c is 140. It’s the shortest form, and most design tools and CSS accept it.

HSL describes the colour the way people think about it: hue is the position on the colour wheel from 0 to 360° (0 is red, 120 green, 240 blue), saturation is how vivid it is, and lightness runs from black at 0% to white at 100%. It’s handy for making a lighter or darker shade: keep the first two numbers and change the last.

All three describe colours in sRGB, the standard colour space for the web.

1. UsefulTools Image Colour Picker (our tool): best overall

The easiest way is our own Image Colour Picker. It works in any modern browser on a computer, tablet or phone.

  1. Open usefultools.fyi/image-color-picker.
  2. Drop an image on the box, press Choose image, or paste a screenshot with Ctrl+V (⌘+V on a Mac).
  3. Move the pointer over the image. The magnifier shows the 11 × 11 pixels around it, and the HEX, RGB and HSL codes update as you move.
  4. Click or tap to save the colour. It’s added to Picked colours with all three codes, and its HEX code is copied to your clipboard. Click any code to copy it.

On a phone, drag your finger across the image to preview, then press Save this colour. A quick tap saves straight away.

Why we rank it first: the image is read by your browser and never uploaded, so it’s safe for private screenshots and unreleased designs. It reads the full-resolution image, not the smaller preview, so you get the real pixel value. It opens PNG, JPG, WebP, GIF, AVIF and iPhone HEIC photos. Your last 20 picked colours are kept in your browser for next time, and Clear removes them.

You can also use the keyboard: press Tab to focus the image, move with the arrow keys (hold Shift to move ten pixels) and press Enter to save. In Chrome and Edge on a computer, Pick from screen picks a colour from anywhere on your screen, even outside the browser.

Build a palette from an image

Once an image is open, the Palette section sums it up in 5, 6, 7 or 8 colours, starting with the most common. Choose the number with the buttons above it.

Each palette colour is the average of a group of similar pixels, so it may not match any single pixel exactly. That makes it good for mood boards and colour schemes, but if you need an exact brand colour, pick it by hand from a flat area instead.

Copy as CSS variables copies a ready-made :root block for a stylesheet, and Copy as JSON copies a plain list of HEX codes.

2. Browser developer tools

If the colour is on a web page, your browser can pick it without any extra software.

  • Chrome and Edge: press F12 to open the developer tools. In the Styles pane, click any small colour square to open the colour picker, then use its eyedropper icon and click a colour on the page.
  • Firefox: open the Inspector in the developer tools and use the eyedropper button in its toolbar. Clicking a colour copies its HEX code.

This is quick for web designers, but it reads the pixels as shown on screen, so a scaled-down image can give slightly blended colours.

3. Digital Color Meter on a Mac

Every Mac has Digital Color Meter, in Applications → Utilities or through Spotlight.

  1. Open it and move the pointer over any colour on screen.
  2. Set the drop-down menu to Display in sRGB, so the values match what web and design tools expect.
  3. Switch the values to hexadecimal in the View menu if you want a HEX code, and use the Color menu to copy the value.

The default setting shows your display’s native values, which can differ noticeably from the sRGB code, so the second step matters.

4. PowerToys Color Picker on Windows

Microsoft’s free PowerToys includes a system-wide colour picker.

  1. Install PowerToys from the Microsoft Store and make sure Color Picker is turned on.
  2. Press Win+Shift+C, point at any colour on screen and click.

The HEX code is copied to your clipboard by default, and the editor that opens keeps a history of picked colours in other formats too.

Common problems

  • The colour changes from pixel to pixel. Photos and JPG images are full of tiny variations. Use the magnifier and pick from the middle of an even patch.
  • The code is slightly off from the original design. JPG compression shifts colours near edges, and smoothed text and lines are blended with their background. Use a PNG or the original file if you can.
  • A photo from a recent phone looks different. Many phones capture in wide-gamut Display P3. To show it, the browser converts it to sRGB, which can change the code a little.
  • A screen picker gives a different value from an image picker. Screen pickers read what your display shows, after scaling and colour management. For the exact value stored in the file, open the file itself.
  • A transparent area shows no colour. Fully transparent pixels have no visible colour, so there’s nothing to save.

Saved the image from a website as a WebP file that other apps won’t open? Our WebP to PNG converter turns it into a PNG that works everywhere.

Tools in this post

Frequently asked questions

How do I find the HEX code of a colour in a picture?
Open the picture in our Image Colour Picker, point at the colour and click. The HEX, RGB and HSL codes are saved to the list, and the HEX code is copied to your clipboard.
What is the difference between HEX and RGB?
None in the colour itself. Both give the amount of red, green and blue from 0 to 255. RGB writes the numbers in decimal, as in rgb(31, 122, 140), and HEX writes them as three pairs of hexadecimal digits, as in #1f7a8c.
Can I pick a colour from my screen instead of an image file?
Yes. In Chrome and Edge on a computer, the Pick from screen button in our Image Colour Picker works anywhere on the screen. On Windows you can also use PowerToys Color Picker, and on a Mac, Digital Color Meter.
Why doesn't the colour I picked match the brand colour exactly?
JPG compression, smoothed edges and colour conversion all shift pixels slightly. Pick from the middle of a large flat area, and use a PNG or the original design file if you can.