🎨 Color Picker — HEX RGB HSL Converter

Pick colors visually and instantly convert between HEX, RGB, and HSL formats. Copy CSS-ready values with one click. Free online color picker and converter for designers.

Pick Color
Click to open color picker

HEX

#

RGB

R
G
B

HSL

H
S%
L%
100%
Selected
Complementary
Tints (lighter)
Shades (darker)

CSS Output

How to Use

1

Pick a color

Click the color swatch to open the browser color picker, or type directly into HEX, RGB, or HSL fields.

2

All formats update

All input fields and the preview update in real-time as you change any value.

3

Copy CSS values

Click any copy button in the CSS Output section to copy your color in any CSS format.

Frequently Asked Questions

What is HEX color format? +
HEX (hexadecimal) color format represents colors as a 6-digit code prefixed with #, like #7c6af7. Each pair of digits (00–FF) represents Red, Green, and Blue channel intensity.
What is the difference between RGB and HSL? +
RGB defines colors by Red, Green, Blue channel values (0–255). HSL uses Hue (0–360°), Saturation (0–100%), and Lightness (0–100%) — more intuitive for human perception and easier to create color variations.
How do I convert HEX to RGB? +
Split the HEX code into three pairs, convert each from hexadecimal to decimal: #7c6af7 → R:124, G:106, B:247. This tool does it instantly as you type.
Which color format should I use in CSS? +
Use HEX for static colors in CSS (most common). Use HSL when you need to programmatically create lighter/darker variants. Use RGB when you need transparency (rgba()).
How do I pick accessible colors? +
Ensure sufficient contrast between text and background. WCAG AA requires a 4.5:1 contrast ratio for normal text. Tools like our color picker help you find complementary colors.


Complete Guide: Color Picker — HEX, RGB & HSL Converter

What Color Formats Mean and Why They Matter

Every color on a digital screen is ultimately stored as three numbers representing red, green, and blue channel intensities. The three common CSS representations — HEX, RGB, and HSL — express those same numbers differently, and each has practical advantages depending on context.

HEX (#7c6af7) is the most compact notation. Two hex digits per channel (00–FF = 0–255). It's the universal default in CSS, design tools, and anywhere humans exchange color codes. Shorthand is possible when both digits match: #aabbcc = #abc.

RGB (rgb(124, 106, 247)) uses decimal values 0–255 per channel. The rgba() variant adds an opacity channel (0–1), making it the go-to format when you need transparency: rgba(124, 106, 247, 0.5). Modern CSS4 consolidates both into rgb(124 106 247 / 50%).

HSL (hsl(248, 89%, 69%)) — Hue (0–360°), Saturation (0–100%), Lightness (0–100%) — is the most intuitive format for human reasoning. Hue is the color wheel position; saturation is how vivid vs gray; lightness is how bright vs dark. To create a darker shade: decrease lightness. To desaturate: lower saturation. This makes HSL essential for programmatically generating color palettes, hover states, and accessible contrast variations.

How to Use the Color Picker

  1. Click the color swatch to open your browser's native color picker, or type directly into any field (HEX, R/G/B, or H/S/L).
  2. All formats update in real-time — change one and all others follow instantly.
  3. Use the CSS Output section to copy any format as a ready-to-use CSS value.
  4. Check the contrast ratio (displayed below the preview) against white and black backgrounds for accessibility compliance.

Code Examples

/* CSS: using HSL to create a color scale */
:root {
  --brand-h: 248;
  --brand-s: 89%;
  --brand:         hsl(var(--brand-h), var(--brand-s), 69%);
  --brand-dark:    hsl(var(--brand-h), var(--brand-s), 45%);
  --brand-light:   hsl(var(--brand-h), var(--brand-s), 88%);
  --brand-muted:   hsl(var(--brand-h), 30%, 69%);
}

/* JavaScript: convert HEX to RGB */
function hexToRgb(hex) {
  const r = parseInt(hex.slice(1,3), 16);
  const g = parseInt(hex.slice(3,5), 16);
  const b = parseInt(hex.slice(5,7), 16);
  return { r, g, b };
}

/* JavaScript: calculate WCAG contrast ratio */
function relativeLuminance(r, g, b) {
  const [rs, gs, bs] = [r,g,b].map(c => {
    c /= 255;
    return c <= 0.03928 ? c/12.92 : ((c+0.055)/1.055)**2.4;
  });
  return 0.2126*rs + 0.7152*gs + 0.0722*bs;
}
function contrastRatio(hex1, hex2) {
  const l1 = relativeLuminance(...Object.values(hexToRgb(hex1)));
  const l2 = relativeLuminance(...Object.values(hexToRgb(hex2)));
  const [L, D] = l1 > l2 ? [l1, l2] : [l2, l1];
  return (L + 0.05) / (D + 0.05);
}
// contrastRatio('#7c6af7', '#ffffff') → ~3.1 (fails WCAG AA for body text)

Common Mistakes to Avoid

Comparison with Alternatives

Browser DevTools color picker is excellent for picking colors from an existing page but requires opening DevTools and doesn't show all formats simultaneously. Figma / Sketch have integrated color systems but are overkill for quick color conversion. ColorZilla browser extension provides an eyedropper for any pixel on screen but requires installation. OKLCH is the next-generation CSS color format (perceptually uniform, wider gamut) — worth learning but not yet universal in all CSS workflows.

Build complete color palettes from a single base color with the Color Palette Generator. Generate gradient backgrounds using multiple colors with the CSS Gradient Generator.

Pro Tips

🧰 50+ Tools