Color Converter
Convert between HEX, RGB, HSL, and HSV. Live preview swatch updates as you type.
About the Color Converter
Colours on screens can be expressed in several mathematical models. HEX is the most common in web development, using six hexadecimal digits to represent red, green, and blue channels. RGB expresses the same channels as decimal values 0-255. HSL (Hue, Saturation, Lightness) is more intuitive for designers: hue is the position on the colour wheel (0-360 degrees), saturation is the intensity, and lightness controls how light or dark the colour appears.
Which colour format should you use?
- HEX — most common in CSS and design tools. Compact and universally understood.
- RGB — useful when manipulating individual channels programmatically or applying transparency with rgba().
- HSL — best for generating colour variations. Adjusting only lightness creates tints and shades without changing the hue.
How to convert HEX to RGB manually
A HEX code like #4A6FA5 is three pairs of hex digits: 4A = red, 6F = green, A5 = blue. Convert each pair from base-16 to base-10: 4A = (4 x 16) + 10 = 74, 6F = (6 x 16) + 15 = 111, A5 = (10 x 16) + 5 = 165. Result: rgb(74, 111, 165).
Colour in web design systems
Design systems define a colour palette in one format (often HSL for its intuitive adjustability) and derive all other formats from it. CSS Custom Properties let you define colours once and reference them throughout your stylesheet. The CSS Color Level 4 specification adds new formats including oklch() which provides perceptually uniform colour adjustments, meaning that equal numerical changes produce equal perceptual differences.
- CSS Custom Properties —
:root { --brand: #4A6FA5; }then usecolor: var(--brand)throughout - oklch() — CSS Color Level 4 format with perceptually uniform lightness; better for generating accessible colour scales
- Design token tools — Style Dictionary, Theo, and similar tools maintain colour tokens and generate all output formats
- Accessibility — WCAG AA requires 4.5:1 contrast ratio for normal text; this calculator helps check colour combinations