Color Picker

Published Updated

Click any pixel of an image to read its HEX, RGB and HSL codes, with a 6x magnifier under the cursor and up to five dominant colors listed beside the picture.

One click, one pixel

The image is painted onto a canvas at its original resolution, and each click reads the red, green and blue values of the single pixel under the pointer. The preview may be scaled down; the reading is not.

That precision cuts both ways. Photos are noisy, and JPEG is a lossy format, so a brand color saved as JPEG may read a few units off near edges or text. In a PNG screenshot, one click is enough.

One color, three notations

HEX and rgb() describe the same red, green and blue amounts, and both are sRGB colors in CSS Color 4. hsl() describes the color as a hue angle plus saturation and lightness percentages. Outputs from the tool's own formatter:

HEXRGBHSLHSL converted back
#1E90FFrgb(30, 144, 255)hsl(210, 100%, 56%)#1F8FFF
#C8102Ergb(200, 16, 46)hsl(350, 85%, 42%)#C6102E
#FFCC00rgb(255, 204, 0)hsl(48, 100%, 50%)#FFCC00, unchanged
#121212rgb(18, 18, 18)hsl(0, 0%, 7%)#121212, unchanged

Because the HSL numbers are rounded, only 10.6% of the 16,777,216 RGB colors survive the trip to HSL and back unchanged (counted with the tool's own conversion code). Use HSL to adjust a shade by eye, and copy HEX or RGB for a design token. The Color Converter shows all formats, CMYK included.

How the dominant colors are found

Next to the image you get up to five swatches. They are counted, not guessed:

  • Between 20,000 and 40,000 pixels are sampled evenly across the picture, or every pixel of a small image.
  • Pixels that are more than about half transparent (alpha below 125) are skipped.
  • Each sampled color is dropped into one of 4,096 boxes, 16 steps per channel.
  • The five fullest boxes win, and each swatch shows the average color of its box.

Large areas therefore dominate, close shades merge, and small accents may not appear at all. To build a scheme around one color, try the Color Palette Generator.

Picking a color step by step

  1. Step 1

    Open an image

    Any format your browser can display. It is drawn at its full pixel size, so a click reads one real pixel, not the shrunken preview.

  2. Step 2

    Hover, then click

    A round magnifier shows the spot six times larger with its HEX code underneath. Clicking fixes that color in the side panel.

  3. Step 3

    Copy the code you need

    HEX, RGB and HSL each have their own Copy button. Clicking one of the dominant-color swatches loads its codes the same way.

When the numbers look slightly off

Color space: the canvas works in sRGB by default. In our test a PNG tagged as Display P3 was converted on the way in by Google Chrome 156, Chromium 153 (Playwright build, not Google Chrome) and Playwright's WebKit build (not the Safari app), so an editor showing the stored P3 values reports other numbers; Firefox 155 kept the stored numbers (see the test table below).

Privacy settings: MDN notes that with fingerprinting protection, some browsers add subtle random noise to canvas reads. If one pixel reads differently on a second click, or a flat area shows tiny variations, that may be why.

Pixel readings from test images in four engines

We opened generated test images in this tool in Chrome 156, Chromium 153, Firefox 155 and the WebKit build, clicked single pixels on its canvas and read the HEX and RGB rows back from the page.

Test imageStored in the fileWhat the tool showed
PNG, 64 colored squares, no color profile64 known colorsAll 64 the same as stored, in all four engines, both at the center of each square and one pixel inside its corner
The same squares saved as JPEG, quality 9064 known colors10 or 11 of the 64 centers the same as stored; the others up to 6 units off (12 in the WebKit build). One pixel inside a corner: up to 58 or 59 units off
PNG tagged with a Display P3 color profile200, 100, 50215, 93, 31 in Chrome 156, Chromium 153 and the WebKit build; 200, 100, 50 in Firefox 155
Same P3 file50, 150, 1000, 153, 95 in the two Chrome builds and the WebKit build; 50, 150, 100 in Firefox 155
PNG with a gamma chunk (gAMA 1.0) and no profile128, 128, 128188, 188, 188 in the two Chrome builds and the WebKit build; 128, 128, 128 in Firefox 155
PNG pixel with alpha 0200, 100, 50#000000 in all four engines
PNG pixel with alpha 128200, 100, 50#C76432 in the two Chrome builds and the WebKit build, #C96533 in Firefox 155

Three lessons from this test. A flat area of a PNG read back as stored. Most centers of the JPEG did not, even in the middle of a 25-pixel square, and its edges were far off because this test JPEG stores color at half resolution (4:2:0); click the middle of a large flat patch. A file with a color profile or gamma chunk can read differently from one browser to the next: here three engines converted it before the click and Firefox 155, as run in our test, passed the stored numbers through. An image editor that shows the stored values will then agree with Firefox and not with the others.

A fully transparent pixel has no color left to report once the browser has drawn it, so it reads as black, and the opacity of a half-transparent pixel is not shown at all.

Why a dominant swatch can be missing

The swatches come from a sample of the pixels, and a regular pattern can fool the sample. These results were the same in Chrome 156, Chromium 153, Firefox 155 and the WebKit build:

Test imageSwatches shown
1000 x 100: every fifth column red (20% of the pixels), the rest blue (80%)Only the red, #DC143C. The blue is missing
The same pattern, 1001 pixels wide#1E90FF (the blue), then #DC143C
400 x 400 gradient from white to grey with a red square covering 1%Five greys (#F8F8F8, #E8E8E8, #C8C8C8, #B8B8B8, #D8D8D8) and no red
Two blues side by side: 32, 144, 255 and 47, 159, 240One swatch, #2898F8, the average of the two

The stripes explain the sampling. The code reads one pixel in every N, where N is the number of pixels divided by 20,000, rounded down. For 1000 x 100 that is every fifth pixel, and because each row is 1,000 pixels long, every sample lands in columns 0, 5, 10 and so on, which are the red columns. At 1001 pixels per row the samples drift across the columns and the blue appears. Any pattern that repeats in step with N can do the same, so treat the swatches as a quick summary and click the image for a reading you rely on.

HSL rounding, counted over every color

We ran the tool's conversion code (lib/colorConversion.ts) in Node 22.23.1 on all 16,777,216 RGB colors. 1,775,240 of them (10.58%) come back unchanged from the rounded HSL, 9,123,139 are off by one unit in their most-changed channel, and the largest change is 5 units (108 colors). A few cases:

HEXHSL shownHSL converted back
#7F7F7Fhsl(0, 0%, 50%)#808080
#FF0001hsl(360, 100%, 50%)#FF0000
#010101hsl(0, 0%, 0%)#000000
#4B0082hsl(275, 100%, 25%)#4A0080
#2E8B57hsl(146, 50%, 36%)#2E8A56
#336699hsl(210, 50%, 40%)#336699, unchanged

9,351 colors show a hue of 360, which is the same hue as 0; it appears when a red is a touch more blue than green, such as #FF0001. 330 colors that are not grey show 0% saturation after rounding. Parsed back with the same code, the HEX and RGB strings gave the original color for every one of the 172,968 colors we sampled for that check.

Color picker questions

How accurate is the picked color?

It is the exact value of that one pixel after your browser decodes the image, with no averaging. JPEG is lossy, so neighboring pixels can differ by a few units; click the middle of a flat patch.

Why doesn't the HSL value convert back to the same HEX?

HSL is shown rounded to whole numbers. Converting that rounded value back lands on a slightly different color for most inputs: #1E90FF shows as hsl(210, 100%, 56%), which converts back to #1F8FFF. Copy HEX or RGB when the exact color matters.

Can I get CMYK values for print?

Not here. The Color Converter shows CMYK for any HEX or RGB value, using the standard formula without a printer profile, so treat it as a starting point.

Does it work on a phone?

Yes, a tap picks the color under your finger. The magnifier and the floating HEX label follow a mouse pointer, so they do not appear on a touch screen.

Why is my logo's main color missing from the dominant colors?

The palette ranks colors by how much of the picture they cover, so a plain background easily outnumbers a small logo. Click the logo itself instead.

Can I pick a color from a website or my screen?

Not directly. Take a screenshot of the page or app, open it here and click the spot you want.

Why is the picked color different from the value in my design app?

A color profile is the usual reason. In our test a PNG tagged as Display P3 with a stored pixel of 200, 100, 50 read as 215, 93, 31 in three of the four browser engines we tried and as 200, 100, 50 in the fourth (Firefox 155). A JPEG adds its own shifts, up to 12 units at the center of a flat test square.

Why does a transparent area pick as #000000?

A fully transparent pixel keeps no color once the browser has drawn it, so it reads as black. That happened in all four browser engines we tried. The tool shows red, green and blue only, not the opacity.

Why does HSL say 360 instead of 0?

The hue is rounded to a whole degree, and a red that leans very slightly toward blue rounds up to 360, the same hue as 0. #FF0001 shows hsl(360, 100%, 50%). Counted over every RGB color with the tool's code, 9,351 colors do this.

Why is a color that fills most of my image missing from the swatches?

The palette samples one pixel in every N, and a pattern that repeats in step with N can hide a color. A 1000 x 100 image that was 80% blue and 20% red, in one-pixel stripes, showed only the red swatch; at 1001 pixels wide both colors appeared.

Related Tools