Color Converter HEX ⇄ RGB ⇄ HSL ⇄ OKLCH
Paste any CSS colour — hex, rgb(), hsl(), hwb() or a named colour — and get every format at once: HEX, RGB, HSL, HSV, HWB, CMYK and OKLCH, with WCAG contrast ratios, tints, shades and copy-ready CSS.
Colour Conversion Workspace
Type a colour in any CSS syntax or use the picker. Every format, the contrast check and the palette update live.
:root {
--color-hex: #d97706;
--color-rgb: rgb(217 119 6);
--color-hsl: hsl(32, 95%, 44%);
--color-hwb: hwb(32 2% 15%);
--color-oklch: oklch(66.6% 0.157 58.3);
}Why Designers Use the Agenvix Color Converter
One input, every output, including the modern formats most converters skip.
Every Format at Once
HEX (6 and 8 digit), legacy and modern rgb(), hsl(), hsv, hwb(), print CMYK and perceptual OKLCH from a single input.
Accessibility Built In
WCAG 2.x contrast ratios against white and black with AA and AAA pass marks for normal and large text.
Instant Palette
Five tints and five shades of the current colour, each copyable as hex, for hover states, borders and backgrounds.
Lenient Parser
Accepts hex without #, percentages, space-separated modern syntax, slash alpha, deg/turn hues and all 148 CSS named colours.
Simple as 1-2-3
How the Color Converter Works
Three steps from any colour string to the format you need.
Enter a Colour
Paste #d97706, rgb(217 119 6), hsl(32 95% 44%), hwb(…), tomato or use the native colour picker and alpha slider.
Read Every Format
The colour is normalised to sRGB and converted to HEX, RGB, HSL, HSV, HWB, CMYK and OKLCH with correct rounding.
Copy What You Need
Click any format to copy it, or copy the full CSS custom-property block for your design tokens.
Colour Models Explained
When each representation is the right one to use.
| Feature / Specification | Best Use Case | Engine / Output Standard | Privacy & Security | Performance Rating | Action |
|---|---|---|---|---|---|
| HEX | CSS, design tools, quick sharing | #RRGGBB / #RRGGBBAA | sRGB | Universal | |
| RGB / RGBA | Canvas, JavaScript, legacy CSS | rgb(r g b / a) | sRGB | Universal | |
| HSL | Adjusting lightness & saturation in CSS | hsl(h s% l%) | sRGB | Intuitive | |
| HSV / HSB | Photoshop, Figma colour pickers | hsv(h s% v%) | Not CSS | Design tools | |
| HWB | Human-friendly whiteness/blackness | hwb(h w% b%) — CSS Color 4 | sRGB | Modern | |
| OKLCH | Perceptually uniform palettes | oklch(L% C H) — CSS Color 4 | Wide gamut | Recommended | |
| CMYK | Print approximation | Naive conversion, no ICC profile | Approximate | Reference |
Colour Formats for the Modern Web
1. HEX, RGB and alpha
HEX and RGB describe the same sRGB values: each pair of hex digits is one channel from 0 to 255. Eight-digit hex adds an alpha channel, so #d9770680 equals rgb(217 119 6 / 0.5). Modern CSS prefers the space-separated syntax with a slash for alpha, but the comma form remains valid everywhere.
2. HSL, HSV and HWB: human-friendly models
These models rearrange RGB around a hue wheel so you can reason about a colour instead of its channel mixture.
- HSL lightness runs from black through the pure hue to white; ideal for hover and disabled variants in CSS.
- HSV (Figma and Photoshop call it HSB) treats value as brightness, so 100% value can still be a saturated colour.
- HWB describes how much white and black is mixed into a hue, which matches how people describe paint.
3. Why OKLCH is replacing HSL
HSL lightness is not perceptual: hsl(60 100% 50%) yellow looks far brighter than hsl(240 100% 50%) blue. OKLCH fixes this with a lightness axis that matches human perception, so palettes built by stepping L stay visually even and keeping C and H constant while changing L produces consistent tints. It is supported in every modern browser and can express wide-gamut Display P3 colours that sRGB hex cannot.
4. Contrast ratios and WCAG
WCAG 2.x contrast is computed from relative luminance, ranging from 1:1 to 21:1. Normal text needs 4.5:1 for AA and 7:1 for AAA; large text (18pt, or 14pt bold) and UI components need 3:1. The converter shows the ratio of the current colour against white and black so you can tell immediately whether it works as text on a light or dark background.
Everything you need to know about colour conversion
Formats, precision, accessibility and print.
Which colour formats can I paste?
Hex with or without #, in 3, 4, 6 or 8 digits; rgb()/rgba() and hsl()/hsla() in comma or space syntax with optional slash alpha; hwb(); the keyword transparent; and all 148 CSS named colours such as tomato or rebeccapurple.
Why does converting back and forth change the last digit?
HSL and OKLCH values are rounded for display. Converting the rounded text back can land one unit away in RGB. Copy the hex value when you need an exact round trip.
Is the CMYK value accurate for print?
It is the standard naive formula without an ICC profile, which is what most online converters show. Real print conversion depends on the paper and press profile; use it as a starting point, not a specification.
What do the AA and AAA labels mean?
They are WCAG 2.x conformance levels for text contrast. AA requires 4.5:1 for normal text and 3:1 for large text; AAA requires 7:1 and 4.5:1 respectively.
What is OKLCH and should I use it?
OKLCH is a perceptually uniform colour space available in CSS Color Level 4. Use it for generating palettes and themes because equal steps in lightness look equal to the eye, unlike HSL.
How are tints and shades generated?
Tints mix the colour with white and shades mix it with black in equal 15 percent steps. Click any swatch to copy its hex code.
Does alpha affect the contrast ratio?
The ratio is computed on the opaque colour. Semi-transparent text blends with its background, so measure the final rendered colour for strict compliance.
Is anything sent to a server?
No. All parsing and maths run in your browser.
Related Developer Utilities
Discover companion utilities engineered for zero-log speed and browser-side execution.
CSS Gradient Generator
Design linear and radial gradients with precise colour stops and copy production ready CSS.
CSS Box Shadow Generator
Layer multiple box shadows with live preview, elevation presets and copy-ready CSS or Tailwind output.
Number Base Converter
Convert between binary, octal, decimal, hex and base36 with exact BigInt math.
PX to REM Converter
Convert px to rem and em at any root font size, including bulk conversion of whole CSS snippets.
Image Converter
Convert PNG, JPG, WebP, BMP, GIF, TIFF images in your browser with zero server upload.
Aspect Ratio Calculator
Reduce any dimensions to a ratio, solve the missing width or height and copy CSS aspect-ratio code.
More in Media & Graphics
Specialized utilities within the same technical domain
