Skip to content
FreeToolsKit.app

Color Picker & HEX/RGB/HSL Converter

Pick a color visually, from an image or from your screen, and get its HEX, RGB and HSL codes with transparency — ready to paste into CSS. Check how readable black and white text are on it, all without uploading anything.

  • Free to use
  • No account required
  • Works in your browser

Color Picker & HEX/RGB/HSL Converter

Loading tool…

Was this tool helpful?

Good to know

Useful for
Web designers and developers converting HEX to RGB or HSL for CSS, marketers matching brand colors from a logo or screenshot, and anyone checking whether text will be readable on a background color.
Accepts
HEX (#RGB, #RGBA, #RRGGBB, #RRGGBBAA), rgb()/rgba(), hsl()/hsla(), RGB channels 0–255, HSL values, opacity 0–100%, or a local PNG, JPEG or WebP image up to 8 MB, with no side longer than 8192 pixels and no more than 50 million pixels in total
Produces
HEX, HEX8, CSS rgb() and hsl() (modern and comma syntax, with alpha when the color is transparent), and WCAG contrast ratios for black and white text

Privacy

Colors and images stay in this browser page. Images aren't uploaded, and nothing you enter or pick is logged, saved in cookies or browser storage, or put in the page address. The clipboard is only written when you press a copy button, never read, and the screen is sampled only when you click Pick from screen.

Limitations

  • HEX colors write the red, green and blue channels as two hexadecimal digits each, from 00 to FF (0 to 255): #3B82F6 is red 59, green 130, blue 246. Converting HEX to RGB simply reads each pair as a number; the 3-digit short form doubles each digit, so #F00 is #FF0000.
  • RGB colors describe how much red, green and blue light make up a color on screen, each from 0 to 255. HSL describes the same sRGB colors as hue (the position on the color wheel, 0° to 360°), saturation (how far from gray, 0% to 100%) and lightness (from black at 0% through the pure color at 50% to white at 100%). HSL is just a rearrangement of RGB — it isn't perceptually uniform, so two colors with the same lightness can look quite different in brightness.
  • Converting RGB to HSL: lightness is the average of the largest and smallest channel, saturation compares their difference with how much room lightness leaves, and hue depends on which channel is largest. The tool calculates this exactly and shows HSL to 2 decimals — enough that converting the shown HSL back gives the identical RGB for every one of the 16.7 million colors. Entering an HSL value rounds each channel to the nearest whole number from 0 to 255.
  • Alpha transparency is stored as a whole number from 0 (fully transparent) to 255 (opaque) and written as the last two digits of an 8-digit HEX code (HEX8) or as the alpha in rgb() and hsl(). HEX alpha 80 is 128/255, about 50.2% — not exactly 50%. A 6-digit HEX code can't hold transparency. Transparent red stays different from transparent black even though both are invisible.
  • In CSS you can paste any of the copied values directly: color: #3B82F6; or background: rgb(59 130 246 / 0.5);. The comma forms (rgba(), hsla()) work in older browsers too.
  • Contrast follows WCAG 2.2: each color's relative luminance comes from its linearised red, green and blue channels, and the ratio is (lighter + 0.05) ÷ (darker + 0.05), from 1:1 to 21:1. AA needs 4.5:1 for normal text and 3:1 for large text; AAA needs 7:1 and 4.5:1. A transparent color is first blended over the page background you choose (white or black). One color pair passing isn't a full accessibility audit of a page.
  • Picking from an image happens in your browser: the image is decoded locally and shown at up to 1024 pixels on its longest side, and the color comes from that displayed copy. Because of scaling and color management, it can differ slightly from a pixel in the original file. Transparent pixels keep their exact alpha.
  • Opaque pixels are picked exactly, but the red, green and blue of a semi-transparent pixel can be slightly off, because the browser stores canvas pixels multiplied by their opacity (premultiplied, 8 bits per channel) and divides it back out. In Chrome, a #1F66D1 pixel at 60% opacity (#1F66D199) is picked as #2066D099. In Chrome the difference is at most 1 per channel at one-third opacity (HEX alpha 55, 85 of 255) or more and at most 2 down to 20% opacity; below that it grows, and nearly invisible pixels can come out with very different colors.
  • Pick from screen uses the browser's EyeDropper feature, which currently works in Chromium-based desktop browsers such as Chrome and Edge, only after you click the button. It isn't available in every browser, and the rest of the tool works without it.
  • Only sRGB colors are supported. Wide-gamut and other notations — Display P3 color(), LAB, LCH, OKLab, OKLCH, HWB, CMYK, color names, var(), calc() and currentColor — are rejected with an explanation rather than approximated.

Tips

  • Typing in one field never loses what you're typing: if a value isn't valid yet, the other formats keep showing the last valid color and a message explains what to fix.
  • Making a QR code in brand colors? Use the QR Code Generator (/image/qr-code-generator). Editing an image? Try the Photo Editor (/image/photo-editor), or change its format with the Image Converter (/image/convert-format).

How to pick a colour and convert HEX, RGB and HSL

  1. Choose a color with the color button, type a HEX code, paste a CSS color such as rgb(59 130 246 / 50%), or adjust the RGB, HSL and opacity sliders and fields.
  2. Optionally pick a color from an image (PNG, JPEG or WebP) by clicking or tapping it, or use Pick from screen in browsers that support it.
  3. Copy the HEX, HEX8, rgb() or hsl() value you need, or copy all formats at once.
  4. Check the contrast of black and white text on the color against the WCAG thresholds. Reset returns to the default blue, #3B82F6.

Frequently asked questions

How do I convert HEX to RGB?

Split the six digits into three pairs and read each pair as a hexadecimal number from 0 to 255: #3B82F6 becomes 3B = 59, 82 = 130 and F6 = 246, so rgb(59 130 246). A 3-digit code like #F00 doubles each digit (#FF0000 = rgb(255 0 0)). An 8-digit code adds alpha: #FF000080 is red at 128/255 opacity.

How do I convert RGB to HSL?

Divide each channel by 255. Lightness is the average of the largest and smallest values; saturation is their difference divided by (1 − |2 × lightness − 1|); hue depends on which channel is largest. For rgb(59 130 246) the result is hsl(217.22 91.22% 59.8%). Pure gray has 0% saturation, and its hue is shown as 0° by convention.

What do saturation and lightness mean in HSL?

Saturation is how far a color is from gray: 0% is gray and 100% is the most vivid version of that hue. Lightness runs from black at 0% through the pure color at 50% to white at 100%. HSL is convenient for making lighter or darker versions of a color, but it isn't perceptually uniform.

What is HEX8, and why is HEX alpha 80 not exactly 50%?

HEX8 adds two digits for alpha (transparency) after the red, green and blue digits. Alpha has 256 steps from 00 (transparent) to FF (opaque), so 80 means 128/255 ≈ 50.2%. CSS values like 0.5 or 50% are rounded to the nearest step, 128, which is why the tool shows 0.502.

How is the contrast ratio calculated?

With the WCAG 2.2 formula: each color's relative luminance is computed from its linearised sRGB channels, and the ratio is (lighter + 0.05) ÷ (darker + 0.05), between 1:1 and 21:1. Black on white is 21:1. The tool compares your color with black and white text against the AA (4.5:1 normal, 3:1 large) and AAA (7:1 normal, 4.5:1 large) thresholds, using the exact ratio rather than the one shown, which is truncated (cut off, never rounded up) to 2 decimals.

How do I pick a color from an image?

Under Pick from image, choose a PNG, JPEG or WebP file up to 8 MB (no side longer than 8192 pixels, at most 50 million pixels in total), then click or tap anywhere on it. The image is decoded in your browser — it isn't uploaded — and large images are scaled to 1024 pixels on the longest side for sampling, so a picked color can differ slightly from the original file's pixel. Opaque pixels are exact; semi-transparent pixels can be off by 1 in a channel (more below one-third opacity), because the browser stores canvas pixels premultiplied by their opacity.

Why don't I see the Pick from screen button?

It needs the browser's EyeDropper feature, which is currently available in Chromium-based desktop browsers such as Chrome and Edge on a secure (https) page. Other browsers don't offer it yet, and the tool doesn't use screen capture as a workaround. You can still choose colors with the color button, the fields or an image.

Does the tool support OKLCH, Display P3 or CMYK?

No. It works with sRGB colors in HEX, rgb() and hsl() notation. Wide-gamut colors (Display P3), OKLCH, LAB and CMYK can't be converted to these formats without losing information or depending on printing conditions, so they're rejected with an explanation instead of being approximated.