How to Find the HEX Color Code of an Image
Published by Image Color Changer
Finding the HEX color code of an image is a common first step in web design, branding, and image editing. Whether you want to match a competitor's accent color, sample a brand swatch, or enter a source color into a color replacement tool, you need a reliable way to read the exact value instead of guessing by eye.
This guide covers the practical ways to find HEX codes from any image, why a photo rarely has one single code, and how to use the value you found in a recoloring workflow.
What a HEX Code Looks Like
A HEX color code is a six-character value written after a hash sign, such as #158EB4 for blue or #C1104C for pink. The six characters are three pairs: the first pair sets the amount of red, the second green, and the third blue. That is why it is called an RGB color written in hexadecimal form.
Most browsers, design tools, and image editors accept HEX values directly, which makes them easy to copy between applications. When you use the Image Color Changer, both the source color and the target color are entered as HEX references.
Use a Built-In Color Picker
The simplest way to find a HEX code is to use a color picker that is already installed on your computer.
On Windows, search for the built-in Color Picker utility or use the eyedropper in an app like Paint. On macOS, open Digital Color Meter, set it to display hex values, and move the pointer over the color you want. On Linux, most screenshot and image viewer tools include a picker.
Browser-based options work too. Many online tools let you upload an image, click a pixel, and copy the HEX value. Whichever tool you use, the process is the same: open the image, click the target color, and read the code.
Sample Several Points, Not One
A flat logo or icon usually has a single, consistent fill color. A photograph almost never does. Lighting, shadows, gradients, and JPEG compression create hundreds of nearby shades that all look similar to the eye but have slightly different HEX values.
If you click three different points on a photographed red shirt, you might get values like #C0392B, #B23022, and #A52719. None of them is wrong. Each one describes a specific pixel.
For color replacement, that variation is why tolerance exists. Pick a representative value from a well-lit area of the surface, then let tolerance include the nearby shades. For more detail, read how tolerance affects color replacement.
Match Brand Colors Accurately
When you need an exact brand color, do not rely on a single eyedropper sample. Brand guides usually list official HEX values, and using those is more reliable than sampling a compressed screenshot.
If you only have an image of the brand asset, sample the largest flat area of the logo or background, then compare your reading against common palette values. Small text, anti-aliased edges, and gradients are the least reliable places to sample because those pixels blend with surrounding colors.
For recoloring a logo, see how to change a logo color online.
Use the Found Code as a Source Color
Once you have a HEX code, you can use it to replace that color in an image. The workflow in the image color editor is:
- Choose the image you want to edit.
- Enter the HEX code you sampled as the source color.
- Enter the target HEX code for the new color.
- Start with low tolerance and apply the change.
- Increase tolerance gradually if part of the original color remains.
- Download the checked result as PNG.
This works best when the sampled color appears mainly in the area you want to change. If the same hue also appears in the background or in unrelated objects, those areas can change too, so inspect the full preview before downloading.
Pick Target Colors That Fit the Image
Finding the source code is only half of the job. The target color should make sense inside the actual image, not just in a color picker. A neon green sampled from a web palette may look unnatural on a product photographed in soft light.
Use the same sampling method in reverse: find a HEX code from a reference image whose lighting and mood match your goal, then apply that value. If the result looks flat or pasted on, try a slightly less saturated version of the same hue. For practical guidance, read color theory for image editing.
Common Mistakes When Sampling Colors
- Sampling a shadow or highlight and treating it as the main color.
- Reading a value from a heavily compressed JPEG and expecting it to match a clean logo export.
- Entering a source code with a typo or missing hash sign.
- Forgetting that transparent PNG edges contain blended pixels with different values.
When the color replacement does not behave as expected, check the sampled value first. A precise source code combined with a gradual tolerance increase solves most partial-replacement problems.
For transparent graphics, read how to recolor a PNG. For photographs, use the JPG color changer.
Frequently Asked Questions
How do I find the HEX code of a color in an image?
Open the image in any tool with an eyedropper or color picker, click the color you want, and copy the six-character HEX value shown for that pixel.
Why do I get different HEX codes for the same area?
Photos contain many nearby shades from lighting and compression. The picker reads one pixel at a time, so sampling several points helps you choose a representative value.
What is a HEX color code?
A HEX code is a six-character value such as #158EB4 that defines a color with pairs for red, green, and blue. It is a common format for web design and image editing tools.
Related Workflows
use the image color editor, recolor a transparent PNG, change a JPG or JPEG color, recolor a logo, or preview a product color.