Hex to RGB Converter
Hexadecimal colour codes are the standard for specifying colours in web design and CSS. A hex code like #FF5733 is compact and convenient, but understanding the RGB (red, green, blue) values behind it helps you manipulate colours programmatically. Both formats describe the same colour; they are simply different ways of representing the intensity of red, green, and blue light. The hex format uses six hexadecimal digits (0-9 and A-F) in pairs: the first pair controls red intensity, the second green, and the third blue. In RGB, these same values are expressed in decimal from 0 to 255. This converter transforms hex codes to RGB values instantly, and also provides HSL (hue, saturation, lightness) as an alternative representation useful for colour manipulation. A live colour preview swatch is shown so you can see the colour as you convert. Enter a hex code (with or without the # symbol), and get RGB, HSL, and CSS syntax for all three formats.
How hex to RGB conversion works
Each pair of hex digits represents one colour channel (red, green, blue). Convert each pair from hexadecimal to decimal:
- #FF5733: FF = 255 (red), 57 = 87 (green), 33 = 51 (blue) = RGB(255, 87, 51)
- #00FF00: 00 = 0 (red), FF = 255 (green), 00 = 0 (blue) = RGB(0, 255, 0) (pure green)
- #FFFFFF: FF = 255, FF = 255, FF = 255 = RGB(255, 255, 255) (white)
Common web colours
| Colour | Hex | RGB | HSL |
|---|---|---|---|
| Red | #FF0000 | RGB(255, 0, 0) | HSL(0, 100%, 50%) |
| Green | #00FF00 | RGB(0, 255, 0) | HSL(120, 100%, 50%) |
| Blue | #0000FF | RGB(0, 0, 255) | HSL(240, 100%, 50%) |
| Yellow | #FFFF00 | RGB(255, 255, 0) | HSL(60, 100%, 50%) |
| Black | #000000 | RGB(0, 0, 0) | HSL(0, 0%, 0%) |
| White | #FFFFFF | RGB(255, 255, 255) | HSL(0, 0%, 100%) |
Hex to RGB converter: frequently asked questions
What is a hex colour code?
A hex (hexadecimal) colour code represents a colour using six hexadecimal digits (0-9 and A-F) preceded by a hash symbol (#). The format is #RRGGBB, where RR, GG, and BB represent the intensity of red, green, and blue respectively, from 00 (0) to FF (255). For example, #FF0000 is pure red, #00FF00 is pure green, and #0000FF is pure blue.
What is RGB colour?
RGB (Red, Green, Blue) is an additive colour model used in digital displays. Each colour component (red, green, blue) has a value from 0 to 255. Mixing different intensities of these three colours creates all visible colours on a screen. For example, RGB(255, 0, 0) is pure red, RGB(255, 255, 0) is yellow, and RGB(255, 255, 255) is white.
What is RGBA?
RGBA is RGB with an alpha channel, which controls transparency. The alpha value ranges from 0 (fully transparent) to 1 (fully opaque). For example, RGBA(255, 0, 0, 0.5) is semi-transparent red. This is useful for overlays, shadows, and effects in web design.
What is HSL?
HSL (Hue, Saturation, Lightness) is an alternative colour model. Hue is the colour (0-360 degrees), saturation is the colour intensity (0-100%), and lightness is brightness (0-100%). HSL is often more intuitive than RGB for designers because it separates colour, intensity, and brightness.
When should I use hex vs RGB vs HSL?
Hex is standard in CSS and web design for simplicity. RGB is used in programming and colour calculations. HSL is useful for creating colour schemes, gradients, and adjusting brightness. Modern CSS supports all three formats.
Official sources
- W3C: CSS Colour Module Level 3.
- MDN: CSS colour values.
Reviewed by the CalculatorHub team, edited by James Graham, 14 June 2026. See our methodology.