To get an HTML color code from an image, open the image in a color-picker tool, use its eyedropper on the pixel you want, and copy the displayed HEX value—usually a six-digit code such as #2A7FDB. For an image already displayed on your screen, Chrome DevTools’ eyedropper or a desktop editor such as Photoshop can sample the visible pixel instead. The result represents the sampled pixel, not necessarily the single color you perceive across a textured, compressed, or anti-aliased area.
Choose the right way to sample
The best method depends on where the image is and how repeatable the result needs to be. For a saved image, a browser-based color picker is usually the quickest route: load the file, point at the color, and copy the code. For a pixel anywhere on your screen, Chrome DevTools’ Color Picker has an eyedropper mode. For a recurring design workflow, an editor such as Photoshop lets you sample the image and read the HEX value from its Color Picker.
| Method | What it samples | Useful when | Color-space notes |
|---|---|---|---|
| Online image color picker | An image file you load or drop into the tool | You want a quick, no-code result in HEX, RGB, or HSL | Check whether the tool processes locally or uploads the image if privacy matters; tools differ in their options. |
| Chrome DevTools eyedropper | A pixel from a page or elsewhere on the screen | The image is already visible and you need to sample what is displayed | Chrome documents the eyedropper as sampling in sRGB. |
| EyeDropper API | A screen pixel selected by the user from a web app | You are building a browser-based picker and the browser supports the API | The returned sRGBHex is an sRGB HEX value. |
| Photoshop Eyedropper | A point in an image open in the editor | You already use Photoshop and want a repeatable desktop workflow | Read the HEX value in the Color Picker; verify document and color settings for production work. |
Canvas getImageData() |
Pixel data in a canvas you control | You need to implement sampling in your own web page | Canvas can request sRGB or display-P3 data; the chosen space affects values. |
Get a HEX code without writing code
From an image file
- Open an image color-picker tool that supports the file format you have, such as PNG, JPEG, WebP, or GIF. Check the tool’s stated formats if your image is less common.
- Load or drop the image into the picker. If the image is private, prefer a tool that says it processes locally in your browser; an upload-based service may send the file to its server.
- Move the eyedropper over the area. Use the preview or magnification, if offered, to check the pixel you are about to choose.
- Click the point that best represents the color you need, then copy its HEX value. Choose RGB or HSL instead if the application you are using asks for that format.
A click samples a point; it does not automatically calculate the average color of a region. If the surface has texture, noise, a shadow, or a gradient, choose a representative point or use a tool that explicitly supports averaging an area.
From anywhere on the screen in Chrome
Chrome DevTools includes a Color Picker with an eyedropper that can sample a visible page or another part of the screen. Open DevTools, locate a CSS color swatch in the Styles pane, open its Color Picker, and activate the eyedropper. Move to the pixel you want and select it. Press Escape to leave eyedropper mode. The sampled value uses sRGB, so it may not match a value produced in a workflow that preserves a wider-gamut color.
#1 Best Overall
- Scan any object or surface to instantly match to 300,000+ brand name paints.
- Not just for paint - Instant RGB, HEX, CMYK and more digital color values.
- 95%+ hit rate on top paint brands including Benjamin Moore, Behr, PPG, Valspar, Sherwin-Williams and more. Paint libraries vary by country region.
- Get instant matches to Pantone, RAL and NCS premium databases.
- Scan instantly and for years to come with no calibration required + dust and water resistance (IPX4 rating).
In Photoshop
Open the image, select the Eyedropper tool, and click the desired color. Open the Color Picker and copy the HEX value shown there. Adobe documents this as a way to obtain a color for HTML/CSS and digital design. For work that must match across applications or output devices, also check the document’s color profile and the destination’s color settings: a HEX string alone does not describe the full color-management workflow.
What an HTML color code represents
A CSS HEX color is a compact way to describe red, green, and blue components, with optional transparency. In #RRGGBB, each pair is one channel: red, then green, then blue. Each channel ranges from 00 (the lowest value) to FF (the highest). For example, #FF8000 means red at FF, green at 80, and blue at 00.
#RGB: three-digit shorthand for an opaque color. Each digit is repeated, so#F80expands to#FF8800.#RGBA: three-digit shorthand with a final alpha digit for transparency.#RRGGBB: the common six-digit form for an opaque color.#RRGGBBAA: the six-digit form followed by an alpha byte.00is fully transparent andFFis fully opaque.
Use #RRGGBB when you need an opaque color and #RRGGBBAA when the transparency is part of the color you need to preserve. Many interfaces also display RGB or HSL; these are alternate ways to express color, not different samples.
Rank #2
- COLOR & SHEEN MATCHING TECHNOLOGY: Color Muse 3 measures both color and sheen in one scan using a 3-path color system across paints, textiles, plastics, print, and more. Powered by proprietary SurfaceSmart Technology with 45/0° geometry for real-world color, d/8° SCI geometry for scientific color accuracy, and 60° angle to measure gloss and sheen.
- WHAT’S INCLUDED & SMART FEATURES: Color Muse 3 color checker features a USB-C charger, On/Off button for power management control, 12X longer standby battery life, and subscription-based access to RAL and Pantone libraries within the mobile app. This color sensor connects wirelessly with the Color Muse app on iOS and Android.
- PORTABLE & EASY TO USE: Just press the power button, scan your surface, and view accurate matches on the app. The 12X improved standby battery life lasts over one year in standby mode, ensuring lab-grade results from a pocket-sized device. Upgraded version of Color Muse 2, built for professionals who demand speed, accuracy, and simplicity.
- SEAMLESS MOBILE APP INTEGRATION: Pair instantly with the Color Muse app for iOS or Android. Access over 100,000+ product colors, build custom libraries, and identify paint colors from leading brands. This color reader offers a full surface solution, matching colors in both hue and finish. Color meter to ccan, store, share, and match colors.
- AFFORDABLE PROFESSIONAL-GRADE PERFORMANCE: Match paint, leather, plastics, textiles, printed media, coatings, and more with lab-level precision. Up-to-date visual sensors and specialized geometry ensure accurate, consistent color results across complex surfaces. This paint matching tool is ideal for professionals needing consistent output.
Build a simple image color picker with JavaScript
For a custom picker, draw the image into a canvas, translate the pointer’s displayed position to the canvas’s pixel coordinates, and read one pixel with getImageData(). This minimal example loads a user-selected image, scales it to fit a preview canvas, and reports the pixel beneath the pointer as HEX and RGBA. It treats the canvas dimensions as the sampling resolution; if the image is scaled, the returned value is the pixel in that rendered canvas, not necessarily an untouched source pixel.
Recommended Free Tools
<!doctype html>
<meta charset="utf-8">
<title>Image color picker</title>
<label>Choose an image: <input id="file" type="file" accept="image/*"></label>
<canvas id="canvas" style="display:block;max-width:100%;height:auto;cursor:crosshair"></canvas>
<p id="result">Choose an image, then move over it to sample a pixel.</p>
<script>
const input = document.querySelector('#file');
const canvas = document.querySelector('#canvas');
const ctx = canvas.getContext('2d', { willReadFrequently: true });
const result = document.querySelector('#result');
let bitmap;
input.addEventListener('change', async () => {
const file = input.files[0];
if (!file) return;
try {
bitmap = await createImageBitmap(file);
canvas.width = bitmap.width;
canvas.height = bitmap.height;
ctx.drawImage(bitmap, 0, 0);
result.textContent = `Image loaded: ${canvas.width} × ${canvas.height}. Move over it to sample.`;
} catch (error) {
result.textContent = 'Could not open this image. Try another supported image file.';
}
});
canvas.addEventListener('pointermove', (event) => {
if (!bitmap) return;
const rect = canvas.getBoundingClientRect();
const x = Math.min(canvas.width - 1, Math.max(0,
Math.floor((event.clientX - rect.left) * canvas.width / rect.width)));
const y = Math.min(canvas.height - 1, Math.max(0,
Math.floor((event.clientY - rect.top) * canvas.height / rect.height)));
try {
const [r, g, b, a] = ctx.getImageData(x, y, 1, 1).data;
const hex = '#' + [r, g, b].map(v => v.toString(16).padStart(2, '0')).join('');
result.textContent = `${hex.toUpperCase()} · rgba(${r}, ${g}, ${b}, ${(a / 255).toFixed(3)}) · pixel ${x}, ${y}`;
} catch (error) {
result.textContent = 'Could not read this pixel. Check image origin and canvas CORS access.';
}
});
</script>
Save this as an HTML file and open it in a browser that supports createImageBitmap(). The file input loads a local image, so this example does not fetch an image from a remote server. Its canvas dimensions match the decoded image dimensions, and the coordinate calculation compensates for the canvas being displayed at a different CSS size. If you deliberately resize the canvas or draw a thumbnail into it, the sample corresponds to that resized rendering.
getImageData(x, y, 1, 1) returns an ImageData object. Its default pixel values are four 8-bit channels: red, green, blue, and alpha. The code above displays RGB as a six-digit HEX value and reports alpha separately as an RGBA value. If preserving transparency matters, include alpha in the HEX string instead of discarding it. Canvas also documents optional sRGB or display-P3 requests and floating-point RGBA data for HDR or wide-gamut workflows; use those only when the source and downstream system require them, because their numbers should not be treated as interchangeable with ordinary 8-bit sRGB HEX.
Rank #3
- SIMPLE AND PORTABLE - Scan any flat surface to find the closest matching paint colours and products in the Color Muse app. Color Muse pairs to the app via wireless so that you can scan colours anywhere.
- MATCH WITH CONFIDENCE - Trust that you’re getting accurate colour matches with an accuracy rate of over 90%. Spot touch-ups are not recommended. Colour matches may be used for wall-to-wall painting. For best results, scan a smooth, flat surface. Scanned colours may vary from what’s displayed on your phone screen.
- LARGE PRODUCT LIBRARY - The Color Muse app includes paints and products from Sikkens, Farrow & Ball, PPG, Dulux, Sherwin-Williams, Benjamin Moore, Color Is, Dulux, Munsell, and other leading brands.
- COORDINATE, SAVE, SHARE - Find coordinating colours, inspiration photos, and even your scan’s HEX, CMYK, RGB, LAB, LCH, LRV, HSB, and HSV colour values in the Color Muse app. Save and share your favourite colours.
- COMPARE - Compare two colours side-by-side or see how close your colour matches to the available products. You can compare RGB, CMYK, Lab values, and more.
Sampling a remote image
A remote image can be drawn into a canvas only if browser origin rules permit pixel access. If the image comes from a different origin and that server does not provide suitable CORS headers, the browser taints the canvas and reading pixels with getImageData() fails with a security error. Use an image served with appropriate CORS permission, a same-origin copy you are allowed to use, or a server-side workflow that has legitimate access to the file. Do not assume that adding a client-side option can override another server’s CORS policy.
Why the sampled value may not match what you expected
Compression and edges
JPEG compression can change pixel values, including pixels in areas that look like a single flat color. Anti-aliased edges also blend foreground and background colors to make boundaries look smooth. A sample next to the center of a shape may therefore differ from a sample on its edge. If you need a brand color, sample an original source asset or design file rather than a compressed screenshot when possible.
The Tool Desk
Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →Scaling and display
Resizing an image can interpolate neighboring pixels, creating values that were not present at the original resolution. A screenshot of a scaled image may capture those interpolated values, while sampling the original file can return its stored pixel values. Browser zoom, device-pixel ratio, and the rendered size can also affect which displayed pixel you select. For exact reproduction, sample the original at its intended resolution and record the coordinates or selection method.
Rank #4
- Color tool 3rd edition- just pick your favorite color then match it to one of the 24 cards from where you can choose a color scheme from 5 color plans
- C&T Publishing notions color tool 3rd edition- just pick your favorite color then match it to one of the 24 cards from where you can choose a color scheme from 5 color plans
- The cards are easy to view, as they are attached in the bottom corner with a plastic bolt which allows you to twist open into a color fan
- Made in China
Transparency and compositing
A transparent pixel has an alpha channel as well as color channels. If you copy only #RRGGBB, you discard transparency. The visible appearance of a partially transparent pixel also depends on the background behind it, so the HEX RGB channels alone may not look like the composited color on screen. Preserve alpha with #RRGGBBAA or an rgba() representation when the receiving format supports it.
Color-space conversion
A HEX value is typically an sRGB representation, but wide-gamut content can use a different color space. Chrome’s documented eyedropper returns sRGB, while Canvas can request sRGB or display-P3 data. Converting or sampling in different spaces can change numeric channel values even when the displayed colors look close. Keep the source, picker, and destination color spaces explicit for design or production work.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Or skip the browser setup
If what you need is a screenshot of a webpage before sampling its colors, ScreenshotNeo can return a page capture through one GET request. It is a screenshot API, not a pixel color picker: use the resulting image in one of the methods above to extract a particular color. See the ScreenshotNeo website and API documentation.
Crashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minuteWindows Errors? Fix Them Before They Spread
Repair common Windows errors and clear accumulated junk for a smoother, more stable PC - no reinstall needed.Free scan · no reinstallBest Value
- PRECISE COLOR & SHEEN MATCHING: The COLOR MUSE 2 Colorimeter revolutionizes paint color matching tool. As a premium paint matcher device, it easily identifies the closest paint color, guaranteeing an exceptionally accurate match.
- YOUR ON-THE-GO COLOR ANALYST: The compact and intuitive COLOR MUSE 2 is more than just a color reader for paint matching tool. With wireless connectivity and seamless integration with the Color Muse app, it transforms any flat surface into a canvas for accurate color readings, making color matching effortless.
- SHEEN IDENTIFICATION MADE SIMPLE: Say goodbye to the guesswork in paint finishes with the COLOR MUSE 2. This advanced color sensor and reader accurately identifies sheen levels—from Flat/Matte to High-Gloss—ensuring you achieve the perfect paint finish every time.
- UNMATCHED ACCURACY IN COLOR MATCHING: This ultimate paint color scanner for over 95% accuracy in paint color matching is designed for wall-to-wall painting, spot touch-ups are not recommended. For best results, scan smooth, flat surfaces and note that colors displayed on your phone screen may slightly vary from the scanned colors.
- EXTENSIVE PRODUCT LIBRARY AT YOUR FINGERTIPS: Explore an extensive range of paint colors from top brands with the Color Muse app. This comprehensive color matching tool provides access to favorites like Sherwin-Williams, Behr, PPG, Benjamin Moore, Munsell, and more, including premium options for RAL and Pantone.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
- Cookie and consent banners, newsletter popups, and chat widgets are removed before the shot; each cleanup step can be turned off.
- Bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits cost nothing. The response includes
X-Page-VerdictandX-Billedheaders. - An MCP server provides
take_screenshot,get_page_info, andcapture_pdftools for AI agents, including Claude, Cursor, and other MCP clients. - The free plan includes 1,000 shots per month with no card; paid plans start at $5 for 3,000 shots. Every feature is on every plan.
Sign up for 1,000 free screenshots a month, with no card required.
Troubleshooting
- The code changes when I click a nearby pixel. You may be on a JPEG artifact, an anti-aliased edge, or a gradient. Zoom in and sample a representative interior pixel; use an area-average feature only if the target is meant to represent a region.
- The eyedropper will not select outside the page. Confirm you are using Chrome DevTools’ eyedropper, not a page-local picker, and press Escape when you are done sampling. If the interface is embedded or managed by a browser policy, try loading the image in a desktop editor.
- The canvas pixel read throws a security error. The image may be cross-origin without CORS permission. Use a local file input, a same-origin asset, or an image server configured to allow the access.
- The HEX looks different from the image. Check whether the source has transparency, whether the image was resized or compressed, and whether one workflow uses sRGB while another uses display-P3. Compare like-for-like source pixels and color spaces.
- The sample appears transparent or black. Inspect alpha as well as RGB. Transparent pixels can have RGB channel values that do not describe their visible appearance over a page background.
- The JavaScript example cannot load my file. Check that the selected file is an image format supported by the browser’s image decoder. The example reports an error if decoding fails; try a standard PNG, JPEG, or WebP copy.
Frequently asked questions
Is an HTML color code the same thing as a HEX code?
In this context, yes: the common HTML/CSS color code people mean is CSS HEX notation, such as #336699. CSS also supports other color representations, including RGB and HSL.
Can I get a color code from a screenshot?
Yes. Load the screenshot into an image picker or sample the visible pixel with Chrome DevTools. If the screenshot was resized, compressed, or captured from a wide-gamut display, its pixel value may differ from the original design color.
Can one sampled pixel tell me the color of a whole object?
Only if the object is uniformly colored and the chosen pixel is representative. Lighting, gradients, texture, compression, and edge blending often mean one object contains many pixel values.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

