🎨 HEX to RGB Color Converter
A HEX to RGB converter that also gives RGBA, HSL and CMYK, with a live picker, contrast check, and the 8-digit hex alpha notation explained.
What HEX to RGB Color Converter Does
A hex color is just three bytes written in base 16, one each for red, green and blue. #2563EB is red 0x25, green 0x63, blue 0xEB — 37, 99 and 235 in decimal. There is no cleverness in the conversion; it is a change of notation for exactly the same number, which is why nothing is ever lost going between them.
What the notations differ in is what they let you do. Hex is compact and is what you paste into a design tool. RGB is what you manipulate in code, because the channels are separate numbers you can do arithmetic on. HSL is what you reason about when you want a color that is the same but lighter, or the same lightness but a different hue — operations that are almost impossible to do in hex by eye.
The three-digit shorthand trips people up: #27E is not a different color space, it is #2277EE, each digit doubled. It only reaches colors whose channel pairs happen to match, which is why so few real colors can be written that way.
Modern CSS also accepts alpha in the hex itself — eight digits, where the last two are transparency. That is included here because it is now widely supported and much tidier than switching to rgba().
How to Use HEX to RGB Color Converter
- Enter any 3-character or 6-character HEX code, or use the color picker
- View real-time conversions into RGB, RGBA, HSL, CMYK, and CSS variables
- Click Copy next to any format to use directly in your stylesheet
Formula Used by HEX to RGB Color Converter
Hex to decimal, per channel
value = (first digit × 16) + second digit, with A–F meaning 10–15
- each pair
- one byte, so 00 to FF is 0 to 255
Worked example
#2563EB
- Red: 2×16 + 5 = 37
- Green: 6×16 + 3 = 99
- Blue: E×16 + B = 14×16 + 11 = 235
Result: rgb(37, 99, 235) — the identical color, written differently.
Which notation to use
| Format | Looks like | Good for |
|---|---|---|
| Hex | #2563eb | Design tools, brand guidelines, pasting between apps |
| Hex with alpha | #2563eb80 | CSS where you want transparency without switching to rgba() |
| RGB | rgb(37, 99, 235) | Code — the channels are separate numbers you can compute with |
| HSL | hsl(221, 83%, 53%) | Making a color lighter, darker or shifting its hue deliberately |
| Shorthand hex | #27e | Only colors whose digit pairs repeat — #27e is #2277ee |
How to Read Your Result
Hex and RGB are the same thing
There is no rounding, no gamut change and no loss converting between them in either direction. If a converter gives you a value that does not round-trip exactly, it is doing something else — usually a color-space conversion you did not ask for.
Reach for HSL when you want a variation
Making #2563eb 10% lighter is guesswork in hex and one number in HSL. Interface color scales are almost always built by holding hue and saturation and stepping lightness, which is why design systems store colors that way.
Case and the hash do not matter
#2563EB, #2563eb and 2563eb are the same color to every browser. Pick one convention and be consistent; lowercase with the hash is the most common in CSS.
Limitations & Accuracy Notes
- sRGB only. Wide-gamut notations — display-p3, oklch, lab — describe colors outside what six hex digits can express.
- Eight-digit hex alpha is well supported in modern browsers but not in very old ones; rgba() is the conservative choice there.
- Named CSS colors are not converted here.
- Color management is not applied: the same hex renders differently on an uncalibrated display, which is a hardware question rather than a notation one.
Frequently Asked Questions
How does HEX to RGB conversion work?
What is the difference between RGB and HSL?
What does the third hex pair represent?
What is an 8-digit hex color?
What does the three-digit shorthand mean?
When should I use HSL instead?
Do hex and RGB describe exactly the same color?
Is my color data sent anywhere?
References & Further Reading
- MDN — <color> data type — Every syntax CSS accepts, including eight-digit hex with alpha
- MDN — hsl() — Why HSL is the practical space for making variations of a color