🎨 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.

Free No Signup Required Browser-Based
#2563EB
HEX Code#2563EB
RGB Formatrgb(37, 99, 235)
RGBA Formatrgba(37, 99, 235, 1.0)
HSL Formathsl(221, 83%, 53%)
CMYK Printcmyk(84%, 58%, 0%, 8%)
CSS Variable--color: #2563EB;

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

  1. Enter any 3-character or 6-character HEX code, or use the color picker
  2. View real-time conversions into RGB, RGBA, HSL, CMYK, and CSS variables
  3. 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

  1. Red: 2×16 + 5 = 37
  2. Green: 6×16 + 3 = 99
  3. Blue: E×16 + B = 14×16 + 11 = 235

Result: rgb(37, 99, 235) — the identical color, written differently.

Which notation to use

FormatLooks likeGood for
Hex#2563ebDesign tools, brand guidelines, pasting between apps
Hex with alpha#2563eb80CSS where you want transparency without switching to rgba()
RGBrgb(37, 99, 235)Code — the channels are separate numbers you can compute with
HSLhsl(221, 83%, 53%)Making a color lighter, darker or shifting its hue deliberately
Shorthand hex#27eOnly 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?
A 6-digit HEX code represents red, green, and blue light channels in base-16 hex values (00 to FF). Each 2-digit hex pair is converted to a decimal integer from 0 to 255.
What is the difference between RGB and HSL?
RGB defines colors by red, green, and blue light intensity, whereas HSL defines colors by Hue (0–360°), Saturation (0–100%), and Lightness (0–100%), which is more intuitive for human design.
What does the third hex pair represent?
A hex color is three pairs of hexadecimal digits for red, green and blue, each from 00 to FF — that is 0 to 255 in decimal. So #FF0000 is full red with no green or blue.
What is an 8-digit hex color?
The fourth pair is alpha, the opacity, on the same 00 to FF scale. #FF000080 is red at roughly 50% opacity. Every current browser supports it in CSS.
What does the three-digit shorthand mean?
Each digit is doubled, so #F00 expands to #FF0000 and #ABC to #AABBCC. It only works when both digits of every pair are the same, which is why most colors cannot be written in shorthand.
When should I use HSL instead?
HSL separates hue from saturation and lightness, which makes it far easier to generate a consistent palette — taking one color and producing a lighter or more muted version is a single number change rather than recalculating three. For picking colors by hand it is usually the friendlier space.
Do hex and RGB describe exactly the same color?
Yes. They are two notations for the same 24-bit value and convert between each other without any loss.
Is my color data sent anywhere?
No. The conversion is arithmetic and runs in your browser.

References & Further Reading

By OnlineToolHubs Team • September 2026