Color Picker & Converter (HEX, RGB, HSL)

Agarapu Ramesh — Editor and content reviewer

What This Tool Does

This color tool lets you pick a color visually or enter a HEX, RGB, or HSL value, then displays equivalent values in all common formats including CMYK. It also shows a large color preview, making it easy to copy the right format for your CSS, design file, or print job.

Inputs Explained

How It Works

When you change any input, the others update automatically. HEX is parsed into RGB. RGB is converted to HSL using standard color space math, and to CMYK by inverting RGB to obtain CMY then extracting the K (black) component.

Formula / Logic Used

HEX → RGB: split into 2-digit hex pairs, parse as 0–255 RGB → HSL: standard formula based on max/min channel RGB → CMYK: K = 1 − max(R,G,B)/255

Pick a color and convert between HEX, RGB, HSL, and CMYK formats instantly.

Quick Copy

CSS HEX--
CSS RGB--
CSS HSL--
CMYK--

Step-by-Step Example

Picked color: A medium royal blue

HEX: #2563eb

RGB: rgb(37, 99, 235)

HSL: hsl(221, 83%, 53%)

CMYK: cmyk(84%, 58%, 0%, 8%) — useful for print design

Use Cases

Assumptions and Limitations

Disclaimer: For print work, always confirm CMYK values with your printer's color profile before final production.

Hex Color Picker and Hex to RGB Converter

The hex color picker helps you choose a color, copy the hex code, and convert it into RGB or HSL for CSS. Use it as a hex to rgb converter, hex to color converter, or color picker calculator when a design file gives one format and your stylesheet needs another.

ColorHexRGBHSL
White#FFFFFF255, 255, 2550, 0%, 100%
Black#0000000, 0, 00, 0%, 0%
Red#FF0000255, 0, 00, 100%, 50%
Blue#0000FF0, 0, 255240, 100%, 50%

For hex to hsl, first convert each hex pair to RGB values, then derive hue, saturation, and lightness from the red, green, and blue channels.

Frequently Asked Questions

How do I convert a color to CSS color-mix() or OKLCH?

Modern CSS gave us two powerful new tools. color-mix() blends two colours: color-mix(in oklch, blue 60%, red 40%) returns a perceptually-smooth midpoint. oklch() is a colour space that matches how humans see lightness — oklch(70% 0.15 240) means 70% lightness, 0.15 chroma, hue 240. To convert from hex or RGB to OKLCH, our Color Picker shows the OKLCH value live as you adjust. Browser support is solid across Chrome, Safari, and Firefox in 2026, but for older clients always include a hex fallback before the OKLCH declaration.

How do I convert HSL back to HEX?

Algorithmically, you convert HSL to RGB first (using the standard formula that maps hue to a 0-1 chroma curve), then RGB to hex by taking each channel as a two-digit hex value. By hand it's painful; in practice everyone uses a tool. Our Color Picker accepts any input format — paste hsl(210, 100%, 50%) and the hex shows up instantly as #0080FF. In JavaScript, chroma-js or the native CSS.supports plus canvas trick both work well. CSS itself doesn't directly convert at runtime, so for static stylesheets you do this once and paste the hex.

How do I convert RGB to RGBA with transparency?

RGBA is just RGB plus an alpha channel — so rgb(255, 100, 50) becomes rgba(255, 100, 50, 0.5) with 50% transparency. The fourth value ranges from 0 (fully transparent) to 1 (fully opaque). You can also write it as a percentage in modern CSS: rgba(255, 100, 50, 50%). For hex codes, append two more digits: #FF6432 becomes #FF643280 (80 in hex is roughly 50% alpha). Our Color Picker has an alpha slider that updates the rgba and hex8 output live. Useful for overlay backgrounds, hover states, and translucent UI cards.

What is a hex code with 8 characters (HEX-A) and how does alpha work?

An 8-digit hex code is RGB plus alpha. The format is #RRGGBBAA. The first six digits are the colour as usual; the last two encode transparency from 00 (fully transparent) to FF (fully opaque). So #FF000080 is red at roughly 50% opacity. The math: alpha hex divided by 255 equals alpha decimal. 80 hex is 128, divided by 255 is approximately 0.502. All modern browsers support this — Chrome, Firefox, Safari, Edge — for several years now. It's a compact alternative to rgba(), especially handy in design tokens and CSS custom properties.

How do I copy a color value as Tailwind, CSS variable, or SCSS?

Our Color Picker has a format dropdown right next to the copy button. Pick from hex, rgb, rgba, hsl, hsla, oklch, Tailwind arbitrary value (bg-[#3B82F6]), CSS custom property (var(--brand-blue)), or SCSS variable ($brand-blue: #3B82F6;). Each format is one click to copy. The Tailwind format is great when you're using a value once; for repeated use, define it in tailwind.config.js under theme.extend.colors. SCSS variables work best in larger codebases where you want centralised theming. CSS custom properties give you runtime theme switching — pick whichever matches your stack.

Sources and References

Related Calculators

JSON FormatterAspect Ratio CalculatorUnit ConverterCase ConverterUUID GeneratorSlug Generator