Photoshop finds a color code by reading the numeric values stored in a document's color data at a specific pixel, then converting those values into the color model and notation you ask for—RGB, Hex, HSB, CMYK, or Lab—based on the active color mode, the document's assigned profile, and the tool or panel you use. There is no single hidden "color code" embedded in an image pixel; the code is calculated from the pixel's stored color values according to the document's color settings. That distinction explains most of the confusion around this topic, because the same pixel can legitimately produce different codes depending on how Photoshop is configured and where you sample.

Why One Pixel Can Have Several "Correct" Codes

A digital image stores color as numbers, not as a hex code. In a typical 8-bit RGB document, each pixel holds three values—one for red, one for green, one for blue—each ranging from 0 to 255. A hex code such as #3A7BD5 is simply a compact way of writing those same three numbers in base-16: 3A is 58, 7B is 123, and D5 is 213. When Photoshop displays a hex value, it is not looking up a code attached to the pixel; it is formatting the pixel's R, G, and B values into hex notation.

Three factors can change which code appears:

Document color mode. An RGB document and a CMYK document store different underlying numbers. The Hex field belongs to the RGB world; CMYK documents still show RGB-based hex values through the Info panel and Color panel, but those conversions are not lossless. Assigned color profile. If the document has a working space such as sRGB IEC61966-2.1, Photoshop interprets the stored numbers through that profile. Sample the same pixel after assigning a different profile, and the displayed RGB and hex values can shift—because the same numbers now describe a different color. Sampling tool settings. The Eyedropper can sample a single pixel, a 3×3 average, a 5×5 average, or a larger area (up to 101×101 in recent versions). An averaged sample on a textured or anti-aliased region will return a value that matches no single pixel exactly.

The Main Tools Photoshop Uses to Report Codes

The Eyedropper Tool and the Options Bar

The Eyedropper is the most direct method. Select it (shortcut I), then click the pixel you want. The foreground color swatch in the Tools panel updates to that color, and the Color panel shows the numeric values. For an exact readout, open the Color panel's menu and choose the mode you want—RGB Sliders, HSB Sliders, CMYK Sliders, Lab Sliders, or Web Color Sliders, which displays the hex value.

In the Options bar, you can set the Sample Size (Point Sample, 3 by 3 Average, 5 by 5 Average, and larger). Photoshop also offers Sample: All Layers versus Current Layer, which matters when a top layer covers the pixels beneath. If you sample All Layers, you get the composited result—what your eye sees. If you sample Current Layer, you get the underlying layer's raw values, which may be entirely different.

The Eyedropper also has a Show Sampling Ring option (enabled by default in recent releases). While you drag, a ring appears with the sampled color in the lower half and the original color in the upper half, giving you a live preview before you commit.

The Info Panel

The Info panel (Window > Info) is the more precise instrument because it can display two color readouts simultaneously. By default, it shows the document's actual color values in one column and a second color space in the other. You can click the small eyedropper icon in either column and choose a mode: Actual Color, Proof Color, RGB Color, HSB Color, CMYK Color, Lab Color, Grayscale, 8-bit, 16-bit, 32-bit, and so on.

This matters because Actual Color reflects the document's native numbers, while Proof Color reflects what the image would look like under a selected proofing profile—say, a CMYK press simulation. A designer checking whether a brand blue will survive printing often compares those two columns rather than trusting a single hex value.

The Info panel reads continuously as you move the cursor over the image, so you can scan a gradient and watch values change without clicking.

The Color Picker

Clicking the foreground or background color swatch opens the Color Picker, which has a hex field labeled with a # sign. Typing a hex code there sets the color; conversely, picking a color in the picker and reading the hex field is a way to obtain a code. The Color Picker, however, works in the current document's color mode, so an RGB document shows RGB and hex fields, while a CMYK document shows CMYK fields with the hex value converted.

The Color Picker also carries a warning triangle when a selected color is outside the printable CMYK gamut, along with a small swatch showing the nearest in-gamut substitute. That is a color-management signal, not a change to the stored code.

The Swatches Panel and Libraries

Saved swatches store color definitions, and hovering over or double-clicking a swatch reveals its values. Photoshop's default swatch sets include web-safe colors and various libraries (Pantone, for example). A Pantone swatch carries a named ink reference, and its on-screen RGB or hex approximation is just that—an approximation generated by Photoshop's library data, not the ink's true appearance. Treat named spot-color swatches as references, not as authoritative screen codes.

Adjustment Layers and the Properties Panel

Solid Color fill layers and some adjustment layers expose a color picker with a hex field. When you sample a color into a fill layer, the layer stores the code you chose. Reopening the layer shows that stored value rather than re-reading the pixel beneath, which is why a fill layer's color may not match the pixels below it if the underlying image has changed since.

Why Hex Codes Sometimes Look Wrong

A frequent complaint is that the hex code Photoshop reports does not match the hex code another program reports for the same image. Several mechanisms explain this.

Color profile mismatch. If Photoshop has a document assigned a wide-gamut profile such as Adobe RGB (1998) and another program assumes sRGB, the same stored numbers will be interpreted differently. The stored RGB triplets may be identical while the rendered colors differ. Photoshop's hex readout reflects the document's RGB working behavior, not a universal calibration.

16-bit and 32-bit documents. In a 16-bit-per-channel document, pixel values range beyond 0–255. The Info panel can show 16-bit values, but hex notation is fundamentally an 8-bit construction. Photoshop converts to 8-bit for hex display, which means two distinct 16-bit values can collapse to the same hex code. High-bit-depth work is better tracked in the native bit depth than in hex.

Averaged sampling. Point Sample returns the exact pixel; larger sample sizes average neighboring pixels, which is useful on noisy photographs but misleading when you need an exact code from a flat region's edge. For flat design elements, Point Sample is usually what you want.

Anti-aliasing and compression. Text edges, thin lines, and JPEG-compressed images contain blended and slightly altered pixels. The "same" visual color may produce a range of codes across a region. Sample the interior of a shape, not its boundary, when you need a stable value.

Proofing and soft-proof settings. If View > Proof Colors is on, the on-screen appearance is simulated, but the Info panel's Actual Color column still reports the document's real numbers. Confusing the two columns is a common source of reported discrepancies.

The Practical Procedure for Getting a Reliable Code

For most tasks—matching a brand color, building a palette, or handing a value to a developer—this sequence produces dependable results:

1: Open the Info panel and set the first readout to Actual Color and RGB Color (8-bit). Set the second to whatever you want to cross-check, such as HSB or CMYK. 2: Choose the Eyedropper with Point Sample and Sample: All Layers if you want to know what the viewer sees, or Current Layer if you want the raw data. 3: Click the target pixel; the Info panel records the values, and the foreground swatch updates. 4: Open the Color Picker from the foreground swatch to read the hex field, or switch the Color panel to Web Color Sliders. 5: If the document has an unusual profile, confirm it under Edit > Assign Profile or note the working space under Edit > Color Settings before sharing the code, because a recipient without that profile may see a different color.

For repeated sampling, you can leave the Info panel open and simply move the cursor; many production artists work this way and never open the Color Picker at all.

What the Code Actually Represents

It helps to be precise about what a hex code is. In web and interface design, #RRGGBB is defined by CSS and assumes the sRGB color space. Photoshop's hex field is a convenience that expresses the document's RGB values in that notation, but the hex field alone does not carry the document's profile. This is why a hex code copied from a Photoshop document in Adobe RGB and pasted into a browser can look different from the Photoshop view: the browser assumes sRGB. The code is a faithful transcription of numbers, but the numbers mean different colors in different spaces.

For print work, the relevant codes are usually CMYK percentages or spot-color names, not hex. Photoshop reports CMYK values through the Info panel and Color panel based on the document's CMYK profile, and those percentages are conversions from the RGB data. Two different RGB colors can convert to the same CMYK percentages (gamut compression), which is another reason a single "code" does not fully describe a color's behavior across media.

Common Misconceptions Worth Clearing Up

"Photoshop stores a hex code in each pixel." It does not. Pixels store channel values; hex is a display format. "The Eyedropper reads the code." It reads pixel values and hands them to the interface, which formats them. The distinction matters when profiles or bit depth change the conversion. "The hex code is the color's true identity." Hex is a notation within a color space. Without knowing the space, it is ambiguous. "CMYK and RGB codes can be converted back and forth losslessly." They cannot, in general. Gamut differences mean some conversions are one-way or approximate.

Where Photoshop Sits Relative to Other Tools

Other applications and browser developer tools report color codes with their own assumptions. A browser's eyedropper typically reports sRGB hex; a vector editor may report CMYK or Pantone references; screen-measurement utilities may apply the monitor's ICC profile. Photoshop is unusual in exposing both the raw document values and proof simulations side by side, which makes it powerful but also easy to misread if you do not know which column you are looking at. The general lesson—that a color code is a number plus an interpretation—applies across all of these tools.

A Short Summary

Photoshop finds a color code by sampling a pixel's stored channel values and formatting them according to the document's color mode, assigned profile, bit depth, and the display settings of the panel you are using. The Eyedropper, Info panel, Color Picker, and Color panel are the primary instruments, and each exposes slightly different information. The most reliable workflow is to read Actual Color values in the Info panel, sample with Point Sample on flat regions, and record the document's color profile alongside any code you share. Remember that a hex code is an sRGB-oriented notation, not a universal identifier, so the same-looking code can render differently depending on the environment that interprets it.