What is Color Converter?
Color Converter — A Hex to RGB Converter is a free tool that converts hexadecimal color codes to RGB values and RGB values back to hex codes with a visual color preview.
Loading your tools...
Convert hex color codes (#FF5733) to RGB (255, 87, 51) and HSL values with a live color preview. Supports 3-digit and 6-digit hex codes. Copy CSS-ready values instantly.
Color Converter: Enter a hex color code (#FF5733) to see its RGB equivalent (255, 87, 51), or input RGB values to get the hex code. Includes a live color preview and support for HSL conversion.
Loading Tool...
Color Converter — A Hex to RGB Converter is a free tool that converts hexadecimal color codes to RGB values and RGB values back to hex codes with a visual color preview.
Enter any supported color value format.
Review converted values across HEX, RGB, and HSL outputs.
Copy the target format for your CSS or design token usage.
Repeat with additional palette values as needed.
Frontend style implementation
Design-to-code handoff
Theme and token system setup
Color consistency validation
CSS and design tools use different color formats because each one optimizes for different use cases. HEX (#FF5733) is compact and historical — it's how every computer color was specified for decades. RGB (red, green, blue 0-255) directly represents how monitors render light. HSL (hue, saturation, lightness) matches human perception — adjusting lightness creates intuitive tints / shades. HSV (hue, saturation, value) is similar but more intuitive for picking colors. OKLCH is the modern perceptually-uniform space — equal numeric changes produce equal visual changes. LAB is the absolute color space used in print and high-end design. Most workflows use multiple formats: HEX for storage / serialization, HSL for programmatic color manipulation, OKLCH for accessibility-conscious design tokens.
| Format | Syntax | Range | Best for |
|---|---|---|---|
| HEX | #RRGGBB | 00-FF per channel | Storage, CSS, design files |
| HEX 8-digit | #RRGGBBAA | 00-FF per channel + alpha | Colors with transparency |
| RGB | rgb(R, G, B) | 0-255 per channel | JavaScript, programmatic color |
| RGBA | rgba(R, G, B, A) | 0-255 RGB + 0-1 alpha | Translucent colors in CSS |
| HSL | hsl(H, S%, L%) | 0-360°, 0-100%, 0-100% | Tints, shades, theme generation |
| HSV / HSB | hsv(H, S%, V%) | 0-360°, 0-100%, 0-100% | Color pickers (Photoshop, GIMP) |
| OKLCH | oklch(L% C H) | 0-100%, 0-0.4+, 0-360° | Modern design tokens, accessibility |
| CMYK | cmyk(C%, M%, Y%, K%) | 0-100% per channel | Print design (Adobe / InDesign) |
HEX → RGB: split into 3 pairs, convert each pair from base-16 to base-10:
#FF5733 → FF=255, 57=87, 33=51 → rgb(255, 87, 51)RGB → HSL: more complex — normalize to 0-1, find max/min, derive hue from dominant channel:
L = (max + min) / 2
S = (max - min) / (1 - |2L - 1|) if L > 0.5
S = (max - min) / (max + min) otherwise
H = depends on which channel is max (see CSS Color spec)color-mix(in oklch, var(--brand) 50%, white).Converting color formats is often part of accessibility work. WCAG 2.1 requires 4.5:1 contrast ratio between text and background for AA compliance (3:1 for large text 18pt+). The contrast ratio is calculated using relative luminance — a perceptually-weighted version of brightness. RGB matters here: not all colors with the same lightness in HSL have the same contrast against white! Yellow (#FFFF00) and blue (#0000FF) have the same HSL lightness (50%) but radically different contrast against white. Always test the actual contrast ratio, not just "light enough lightness."
Modern browsers (Chrome 111+, Firefox 113+, Safari 15.4+) support CSS Color Level 4 with new features:
oklch(from var(--brand) calc(l + 0.1) c h) — derive colors from other colorsCurrent color with 100% opacity
Hex
#2563eb
RGB
rgb(37, 99, 235)
RGBA
rgba(37, 99, 235, 1)
HSL
hsl(217, 83%, 53%)
HSLA
hsla(217, 83%, 53%, 1)
CSS Variable
--color-primary: #2563eb;