Photoshop finds a color's hex code by converting the color from whatever model it is stored in—usually RGB on screen—into a hexadecimal notation, and it exposes that value in several places: the Color panel's options, the Color Picker, the Info panel, and the Eyedropper tool's sample readouts. There is no separate "hex detector" in the program. Hex is simply a way of writing an RGB color, so any tool that can read a pixel's RGB value can also tell you its hex code.

That distinction matters because the search question can mean at least two things. One reader wants to know how to read a hex value out of Photoshop for a color they already have selected or sampled. Another wants to know where the number comes from—why a given pixel produces, say, #3A7BD5. Both are answered here, along with the situations where Photoshop's reading can legitimately differ from what another app reports.

What a hex code actually is inside Photoshop

A hex code is a six-digit Base-16 number that encodes three 8-bit color channels: two digits for red, two for green, two for blue. #FF0000 is pure red, #000000 is black, #FFFFFF is white. Photoshop stores almost everything you see on the canvas in RGB (or in grayscale, CMYK, or Lab, depending on the document's mode), so the hex readout is a translation layer, not a native format.

That translation is where the details live. Photoshop does not scan an image looking for text that says "hex." It reads the numeric channel values of the selected color or the sampled pixel and formats them as hex. Everything follows from that.

Where to find the hex code of a color you've already selected

The fastest route depends on which panel you have open.

The Color panel. Open it from Window > Color. Click the panel menu (the four-line icon) and choose Color Swatches, or simply switch the panel's display mode; versions contemporary with current Creative Cloud releases offer a hex field directly in the panel. When the field is visible, the six-character value is shown as text, and you can type a new one to set a color precisely.

The Color Picker. Click the foreground or background color swatch in the toolbox. The picker opens with an H, S, B, R, G, B set of fields, and a # field that holds the hex value. Editing the hex field live-updates the color, and the small swatch above it splits to show the new color against the old one so you can compare.

The Swatches panel. Click any swatch, and the Color panel and Picker update to show that swatch's values, including hex. Double-clicking a swatch opens an editor where you can rename it and read its value.

Where to find the hex code of a pixel in an image

This is the interpretation most people mean when they say they want Photoshop to "find" a hex code: they're looking at a photo, a screenshot, or a design and want the exact color of one spot.

The Eyedropper tool and its sample readout

Select the Eyedropper (I). In the options bar you'll see Sample Size—Point Sample, 3 by 3 Average, 5 by 5 Average, and larger, up to 101 by 101 Average. This setting is the single most common reason two people get different hex values from the same image. Point Sample reads one pixel; an averaged sample reads the mean of a block and reports the resulting color, which is almost always smoother and almost never identical to any single pixel in that block.

Click the spot you want. The foreground color becomes that sampled color, and the Info panel (Window > Info) displays the reading. By default the Info panel shows RGB and CMYK readouts, but you can change either to Web Color—which is the hex display—by clicking the small eyedropper icon next to a readout and choosing from the menu. Once set to Web Color, the Info panel shows the hex value for whatever the pointer hovers over, without requiring a click.

The Color Sampler tool

The Color Sampler, grouped with the Eyedropper, lets you place up to ten persistent sample points on the image. Each point gets a numbered readout in the Info panel, and each readout can be independently set to Web Color. This is the practical tool for comparing several candidate colors at once—say, the shadow, midtone, and highlight on a product photo—without re-clicking.

Adjustment layers and the Properties panel

Solid Color fill layers and many adjustment layers have a color well in their Properties panel; clicking it opens the same Color Picker, hex field included. If you've applied a Gradient Map, each color stop can be inspected and edited the same way.

How Photoshop computes the hex value, step by step

Take a pixel whose RGB values are R = 58, G = 123, B = 213.

1: Convert each channel to two hexadecimal digits. 58 in decimal is 3A in hex; 123 is 7B; 213 is D5. 2: Concatenate them in R-G-B order, with no separators: 3A7BD5. 3: Prefix with # for CSS and most design tools: #3A7BD5.

Values below 16 need a leading zero, so R = 5 becomes 05, not 5. Photoshop handles that padding automatically, which is why its hex readouts always have exactly six digits.

A subtlety: Photoshop's color engine may be operating in a working space such as sRGB, Adobe RGB, or ProPhoto RGB, and the numeric value it reports is the value in the document's color space, not necessarily what a browser will display. For sRGB documents—the default for web work—the numbers match what CSS will render. For documents in a wider space, the same hex digits can appear to describe a different color when opened elsewhere, because the digits alone don't carry a color profile. If exact cross-application matching matters, convert the document to sRGB before sampling (Edit > Convert to Profile) and sample again.

Why your hex reading can differ from what you expect

Several legitimate mechanisms produce mismatches, and none of them are bugs.

Anti-aliasing and compression. Text edges, curved shapes, and JPEG-compressed photos rarely contain a single flat color. What looks like "the" blue of a logo may span dozens of slightly different values. Sampling with a 5 by 5 or larger average, or picking the value at the center of a flat region, gives the intended color more reliably than a point sample on an edge.

Sample size setting. As above, this is the most frequent culprit. Two readers comparing notes on the same file can get different hex codes purely because one is on Point Sample and the other on 5 by 5 Average.

Display profile vs. document profile. The color on your monitor is filtered through your display profile; the number Photoshop reports is the document value. If your monitor is calibrated and wide-gamut, the on-screen appearance of #3A7BD5 may not be the appearance that exact value produces on a standard sRGB display. The hex code is the same; the rendering is not.

Color management policies and Proof Colors. With View > Proof Colors enabled, you're seeing a simulation of another output condition, but the Info panel's readout still reflects the underlying document values unless you've configured it otherwise. Readouts and appearance can therefore diverge by design.

Blend modes and layer effects. The color under the cursor in a flattened composite is the result of compositing, not the layer's original fill color. Sample the layer itself (with the composite hidden, or by reading the layer's fill in the Properties panel) if you want the source color rather than the result.

A direct-sampling workflow that avoids the usual mistakes

1: Duplicate the layer or work non-destructively; sampling never alters pixels, but you may want the original for comparison. 2: Set the Eyedropper's Sample Size to 3 by 3 Average for photos, or Point Sample only when you need a literal single-pixel value. 3: Open the Info panel and set one readout to Web Color. 4: Use the Color Sampler to drop up to ten points on the colors you care about; label your reasoning in a note if you'll return to the file later. 5: Copy the hex string from the Info panel or the Color Picker's # field. In the Info panel, you can right-click (or Control-click) the readout for a context menu that includes copying the value. 6: If the target output is the web, convert the document to sRGB first so the digits mean what a browser will render.

A short comparison of the places hex appears

Location What it shows Best for
Color Picker # field Hex of the current foreground/background color Setting a color from a known hex, or copying the selected color's value
Color panel hex field Hex of the active color Quick typing and reading while designing
Info panel (set to Web Color) Hex of the pixel under the pointer, or of each Color Sampler point Sampling from images, comparing multiple spots
Swatches panel The color stored in a saved swatch Reusing brand or project colors consistently

Does Photoshop have a "find hex code" command? No. There's no search function that locates hex text inside an image; hex is metadata about color, not content. The tools above read channel values; nothing scans the canvas for a string of characters.

Can I get a hex code without the Eyedropper? Yes—select a color in the Color panel or Picker, or click a swatch. The value appears in the hex field. You can also use File > Export > Export As or Save for Web to see color tables, but those are output-oriented and less direct for single-color lookups.

Why does the hex code I copied look different in my browser? Almost always a color-profile issue. Confirm the document is in sRGB and that your display profile is correctly set; if the hex digits match and the appearance doesn't, the difference is in rendering, not in the code.

What about CMYK documents? The Info panel can be set to show hex even in CMYK mode, but the conversion is an approximation because hex describes RGB. For print work, trust the CMYK values and treat hex as a convenience for screen previews.

Is hex the same as RGB? Same information, different notation. RGB writes three decimal numbers; hex writes the same three 8-bit values in Base-16 with two digits each. #FFFFFF and rgb(255, 255, 255) are the same color.

The bottom line

Photoshop finds a hex code by converting the RGB channel values of whichever color it is currently pointed at—a selected swatch, a picker entry, or a sampled pixel—into six Base-16 digits. To get one, open the Color Picker or Color panel for a selected color, or set the Info panel's readout to Web Color and sample the image with the Eyedropper or Color Sampler. The value you see is the document's channel data formatted for the web, so mismatches with other apps usually trace back to sample size, color profile, or compositing rather than to Photoshop "finding" the wrong number.