Free HEX to RGB converter for CSS and HTML — how do I turn #RRGGBB into rgb() values for stylesheets?

Split the six hex digits into three pairs; each pair is one channel from 0–255. Example: #3498DB → R=0x34=52, G=0x98=152, B=0xDB=219 → rgb(52, 152, 219). Use our HEX to RGB page to type any #code and copy the result.

Detailed answer

Hexadecimal uses base 16, so two digits span 0–255 per channel. In CSS you can write #RGB shorthand when digits repeat (#abc = #aabbcc). Our dedicated converter parses your input, shows the same sRGB math the Color Picker uses, and includes a step-by-step breakdown under the calculator.

Relationship context

HEX and RGB describe the same sRGB color on screen; HEX is compact for palettes and APIs, while rgb() is explicit in CSS and design tokens.

Example sRGB codes (HEX · RGB · HSL)

HEXRGBHSL (rounded)
#3498DBrgb(52, 152, 219)hsl(204, 70%, 53%)
#E74C3Crgb(231, 76, 60)hsl(6, 78%, 57%)
#2ECC71rgb(46, 204, 113)hsl(145, 63%, 49%)
#FFFFFFrgb(255, 255, 255)hsl(0, 0%, 100%)

Illustrative sRGB examples; HSL matches integer rounding in the Color Picker UI.

More Color Picker tools

Open the main picker or a fixed input/output converter—same math as the hub, with copy-ready strings.