How Do I Get the Hex Code from an Image?

✓ 100% FREE — No Signup Needed

Wondering how to get the HEX code from an image? Upload any photo below, click a pixel, and copy its exact code — or pick and convert colors by hand, build palettes and check contrast. Everything happens in your browser.

Color converter

Tap the circle or enter a HEX value.

TAP TO PICK

CMYK is an on-screen approximation. Printed output varies by printer, ink and color profile.

Contrast checker

Test text against a background using WCAG ratios.

Readable design starts here.Preview normal and large text together.
Contrast ratio—
AA normalAA largeAAA normalAAA large

Pick a color from an image

Upload a photo and click any pixel to get its exact HEX code.

No image loaded yet. Choose a photo, then tap any spot on it to read that pixel's color.

Private by design: your photo is read inside your own browser and never uploaded anywhere.

Palette generator

Each harmony follows your selected base color. Tap a swatch to copy it.

Tints & shades

Tap any tone to copy its HEX code.

WHITEBASE
BASEBLACK

How do I get the HEX code from an image

It takes three taps — no design software needed:

  1. Upload the photo in the "Pick a color from an image" panel above.
  2. Click the exact pixel whose color you want — a logo, a wall, a shirt, anything.
  3. Copy the HEX code (RGB, HSL and CMYK appear too) and paste it into your design.

The sampling happens on a canvas inside your own browser, so your image is never uploaded anywhere — safe even for private photos. Designers use this to match brand colors from screenshots, pick wall-paint shades from room photos, and grab exact tones from inspiration images.

Which color format should you use?

Different formats describe the same color for different workflows.

  • HEXCompact and widely used in web design and CSS.
  • RGBRed, green and blue channels for screens and digital graphics.
  • HSLHue, saturation and lightness—often easier for adjusting color families.
  • CMYKCyan, magenta, yellow and black—a practical preview for print workflows.

Quick answers

How do I get the HEX code from an image for free?

Upload the image in the "Pick a color from an image" panel above, click the exact pixel you want, and copy the HEX code. Free forever, no signup, and your photo never leaves your device.

How do I get the HEX code from an image without uploading it anywhere?

This tool samples pixels with a canvas inside your own browser — nothing is sent to any server. It is the private way to read a color from a photo, screenshot or logo.

How do I convert HEX to RGB?

Enter or select a HEX color above. Its red, green and blue values appear instantly in the RGB field.

What is a good contrast ratio?

Use at least 4.5:1 for normal text and 3:1 for large text. A ratio of 7:1 meets enhanced AAA for normal text.

What are tints and shades?

A tint mixes a color with white. A shade mixes it with black.

Can I use these values in CSS?

Yes. HEX, RGB and HSL values can be pasted directly into CSS color properties.

What's the difference between HEX, RGB and HSL?

They're three notations for the same color: HEX is compact (#E4572E), RGB lists the decimal channel values (228, 87, 46), and HSL describes hue, saturation, and lightness — which feels more intuitive when you're darkening or muting a color. Convert freely; the rendered color is identical.

Why do my brand colors look different on phones?

Screens differ in calibration, brightness, color gamut, and dark-mode handling. Test brand colors on several real devices, and favor slightly darker, more saturated versions — they survive display differences far better than pale pastels.

How many colors should a palette have?

Five is a practical maximum: one primary, one secondary, one accent, plus a dark and a light neutral. The neutrals do most of the heavy lifting in real interfaces; more than five colors and designs start looking noisy and unfocused.

How HEX, RGB and contrast math work

Screens create color by mixing red, green, and blue light. HEX is simply RGB written in base-16: #RRGGBB, where each pair is one channel from 00 (off) to FF (255, full brightness). RGB lists the same three channels in decimal, and HSL describes the same color as hue/saturation/lightness — three notations, one color.

Conversion is base-16 arithmetic: split #E4572E into pairs E4, 57, 2E → R = 14×16 + 4 = 228, G = 5×16 + 7 = 87, B = 2×16 + 14 = 46 → rgb(228, 87, 46). Readability is measured by the contrast ratio: (L1 + 0.05) ÷ (L2 + 0.05), where L is relative luminance (0 for black, 1 for white). WCAG AA requires ≥ 4.5:1 for body text and ≥ 3:1 for large text.

Worked example: white text on #E4572E. L(white) = 1.0, L(#E4572E) ≈ 0.20 → ratio ≈ 1.05 ÷ 0.25 = 4.2:1. That passes AA for large text (needs 3:1) but fails for body text (needs 4.5:1) — so darken the background a notch or bold the text before shipping it.

Practical tips: a tint mixes a color with white, a shade mixes it with black — generate both for hover states and depth. Preview palettes in grayscale: if the design still reads, your value contrast is solid. Limitation: HEX can't express transparency — reach for rgba() or 8-digit HEX (#RRGGBBAA) when you need opacity.

The luminance math behind contrast ratios: relative luminance isn't a simple average — human eyes are most sensitive to green, so the formula weights channels: L = 0.2126×R + 0.7152×G + 0.0722×B, where each channel is first linearized from sRGB (values ≤ 0.04045 ÷ 12.92, else ((v+0.055)/1.055)^2.4). That's why pure blue (#0000FF, L≈0.07) looks far darker than pure green (#00FF00, L≈0.72) despite equal "brightness" in RGB numbers. For palette building, HSL is the practical tool: fix the hue, then step lightness in 10% increments to generate tints and shades that stay harmonious — far more intuitive than nudging RGB channels blindly. And when sampling colors from images, average a 5×5 pixel area rather than a single pixel; JPEG compression noise makes single-pixel samples lie, especially in gradients and shadows.

Copied