HEX to RGB

Convert HEX colors to RGB as you type, with a live preview, the formula and a table of common colors converted.

loading HEX to RGB
About this tool

What are HEX and RGB?

HEX writes the red, green and blue channels of sRGB as two hexadecimal digits each, from 00 to FF. RGB gives the same three sRGB channels as decimal numbers from 0 to 255, plus an optional alpha.

Designers hand over HEX; code that animates, blends or sets transparency (rgb(… / 50%), canvas, Android) needs the three numbers.

The color converter below starts from HEX and highlights RGB, next to HWB, LAB, LCH and CSS names.

HEX vs RGB

HEXRGB
Notation#RRGGBB, #RGB, #RRGGBBAArgb(255 178 36), rgb(255, 178, 36)
In CSSall browsersall browsers
Typical useCSS, design handoff, brand guidescode that computes colors, canvas, image libraries

Formula

Split the six digits in pairs and read each pair as a base-16 number: FF = 15 × 16 + 15 = 255, B2 = 11 × 16 + 2 = 178, 24 = 2 × 16 + 4 = 36, so #FFB224 is rgb(255, 178, 36). A three-digit HEX doubles each digit (#F80 = #FF8800).

What changes in the conversion

  • HEX and RGB describe the same sRGB color; the only difference is rounding of the last digit.
  • Transparency (alpha) is kept: #RRGGBBAA, rgb(… / 0.5), hsl(… / 50%) and oklch(… / 0.5) all carry it.

How to convert HEX to RGB

  1. Type or paste the HEX value in its line, or pick a color with the color picker.
  2. Read the RGB line, which updates as you type, and check the preview swatch.

Common colors from HEX to RGB

Converted with the same code as the tool:

ColorHEXRGB
amber (stdlib.tools accent)#FFB224rgb(255, 178, 36)
teal#0B7285rgb(11, 114, 133)
blue#3B82F6rgb(59, 130, 246)
green#16A34Argb(22, 163, 74)
red#DC2626rgb(220, 38, 38)
mid gray#808080rgb(128, 128, 128)
black#000000rgb(0, 0, 0)
white#FFFFFFrgb(255, 255, 255)

Frequently asked questions

Is HEX to RGB exact?

Yes, up to rounding: both describe the same 8-bit sRGB color, so converting back gives the same value.

Which format should I use in CSS?

HEX and rgb() work everywhere; hsl() is handy for shades written by hand; oklch() gives even lightness steps and wide-gamut colors in current browsers.

How do I write RGB with transparency?

Use a slash: rgb(255 178 36 / 50%), or the older rgba(255, 178, 36, 0.5); both mean 50% opacity.

Report a problem