HEX to RGB Color Converter
Convert HEX, RGB, HSL, OKLCH and CMYK color formats instantly — bidirectional, live preview, copy-ready
Drop a hex code like #3B82F6 and instantly get the RGB, HSL, OKLCH, and CMYK equivalents — or go the other way and type RGB values to get the hex. Live preview updates on every keystroke, and each format has a one-click copy button.
And everything runs in your browser. Nothing gets uploaded.
How It Works
A hex color like #FF5733 is really three pairs of hexadecimal digits — one for red, green, and blue. The converter splits those pairs and translates each from base-16 to a regular decimal number (FF becomes 255, 57 becomes 87, 33 becomes 51). From there it calculates HSL, OKLCH, and CMYK using standard color math. The whole thing happens on every keystroke, so results appear as you type.
Examples
Brand Blue from a Figma File
Your designer shared a hex code for the primary button color and you need the CSS rgb() value.
#3B82F6
rgb(59, 130, 246)
hsl(217, 91%, 60%)
oklch(0.63 0.19 259)
Shorthand Hex for a Quick Prototype
You typed a 3-digit shorthand in your CSS and want to see the full expanded values.
#F53
Expands to #FF5533
rgb(255, 85, 51)
hsl(10, 100%, 60%)
Converting RGB Back to Hex for a Style Guide
The print team gave you an RGB value and your documentation needs hex codes. Works in both directions.
rgb(16, 185, 129)
#10B981
hsl(160, 84%, 39%)
cmyk(91%, 0%, 30%, 27%)
Who Uses This
Grabbing rgb() or hsl() values from hex codes in design handoffs to drop straight into CSS.
Checking how a hex color translates to HSL before tweaking lightness or saturation in a design system.
Documenting brand colors in every format for style guides that serve both web and print teams.
Learning how RGB channels map to hex digits while working through web development coursework.
Common Mistakes
Some tools require the hash, others don’t. This converter accepts both #FF5733 and FF5733. But if you’re pasting into CSS, you need the # — the browser won’t recognize it without one.
#F53 is not the same as #F53000. The shorthand doubles each digit: #F53 becomes #FF5533. People sometimes assume the missing digits are zeros — they aren’t.
Each RGB channel tops out at 255. Typing rgb(300, 50, 50) won’t give you “extra red” — it’ll just be invalid or clamped. If your value is higher than 255, double-check where you copied it from.
Technical Details
- Processing: 100% client-side — nothing leaves your browser
- Browser Support: Chrome, Firefox, Safari, Edge
- Formats: HEX, RGB, RGB%, HSL, OKLCH, CMYK, Integer
- Input: 3-digit or 6-digit hex, or individual R/G/B values (0–255)
Frequently Asked Questions
What is the difference between HEX and RGB?
They represent the exact same colors — just written differently. HEX uses base-16 notation (#FF5733) while RGB uses regular decimal numbers (rgb(255, 87, 51)). Browsers treat them identically. Pick whichever is easier to read in your codebase.
How do I convert HEX to RGB manually?
Take each pair of hex digits and convert it to decimal. For #FF5733: FF = 255, 57 = 87, 33 = 51. So the result is rgb(255, 87, 51). If you don’t have a hex-to-decimal chart memorized (most people don’t), just paste it into the converter above.
Can I convert RGB to HEX with this tool?
Yes. The converter is bidirectional. Type your R, G, and B values into the number fields (or paste a full rgb() string) and the hex code updates automatically. Works in both directions without switching modes.
What is OKLCH and why should I care?
OKLCH is a perceptually uniform color space — meaning if you bump the lightness by 10%, it actually looks 10% lighter regardless of the hue. HSL doesn’t do that well (yellow at 50% lightness looks way brighter than blue at 50%). All modern browsers support oklch() in CSS, and it is becoming the go-to for design tokens.
Is my color data stored or sent to a server?
No. The conversion happens entirely in your browser using JavaScript. Nothing is uploaded, saved, or logged. Close the tab and it’s gone.