AIForeverThing
All Tools › Web & Developer

Color Converter

Convert between HEX, RGB, and HSL with a live preview. Edit any field — the others update instantly.

Preview
#22c55e
Color Values

How it works

This tool converts between three common web color models. HEX is a six-digit hexadecimal notation (#RRGGBB) representing red, green, and blue channels. RGB stores each channel as an integer 0–255. HSL describes colors by Hue (0–360°), Saturation (0–100%), and Lightness (0–100%), which more closely matches human perception. Conversions use normalized channel values: HEX↔RGB via base-16 arithmetic; RGB→HSL finds the max and min channel to derive lightness and saturation, then computes hue from the dominant channel; HSL→RGB reverses the process using chroma and a hue-to-RGB helper. All outputs update in real time as you edit any field.

Frequently Asked Questions

How do I convert a HEX color to RGB?

Split the HEX code after the # into three two-character pairs (RR, GG, BB). Convert each pair from base-16 to decimal. For example, #22c55e becomes R=0x22=34, G=0xC5=197, B=0x5E=94 — so rgb(34, 197, 94). Enter the HEX in the field above and the RGB updates instantly.

What's the difference between RGB and HSL?

RGB is device-oriented — it stores how much red, green, and blue light a screen emits (each 0–255). HSL is perceptual — it describes a color by its Hue (the color family, 0–360°), Saturation (intensity, 0–100%), and Lightness (darkness, 0–100%). HSL is often easier for creating color palettes because you can adjust one property — like lightness — without changing the underlying hue.

Can I convert HSL back to HEX?

Yes. Enter the Hue, Saturation, and Lightness values in the HSL fields and the tool will compute the matching RGB values, then convert them to HEX automatically. The full pipeline is HSL → RGB → HEX, using standard formulas with a chroma-based helper function that maps hue to channel weights.

Related Tools

Copied!
Free tools by TUNA — energy supply from vetted manufacturers