How hex to RGB conversion works
A six-digit hex code is three base-16 numbers glued together: red, green, then blue. Each pair covers 00 to ff, which is 0 to 255 in decimal. For #ff5733: ff = 15x16 + 15 = 255, 57 = 5x16 + 7 = 87, and 33 = 3x16 + 3 = 51, giving rgb(255, 87, 51). Shorthand codes repeat each digit, so #f53 means #ff5533.
The channel order never changes: the first pair is red, the second green, the third blue.
How to use this converter
Type a hex code with or without the leading #, in either 3 or 6 digit form, and the RGB triple appears below along with the normalised uppercase hex. Anything that is not valid hex is rejected with a hint rather than converted to a wrong colour. To go the other way, use the RGB to hex converter.
The conversion happens entirely in your browser, so nothing you paste is uploaded or stored. Shorthand only works when each pair repeats.
Reference colors
Useful anchor values when checking your work:
| Hex | RGB |
|---|---|
| #000000 | rgb(0, 0, 0) |
| #FFFFFF | rgb(255, 255, 255) |
| #FF0000 | rgb(255, 0, 0) |
| #808080 | rgb(128, 128, 128) |
| #FF5733 | rgb(255, 87, 51) |
Hex is just base 16, the same system behind the hex to decimal calculator.
RGB is the format most design tools, canvas APIs and email templates expect, while hex stays shorter for stylesheets. If you need to check a pair of colours for readable contrast, run them through the colour contrast checker.
Frequently asked questions
- What is #ff5733 in RGB?
- It is rgb(255, 87, 51): 255 red, 87 green and 51 blue.
- Can I enter a 3-digit hex code?
- Yes. Shorthand like #f53 is expanded to #ff5533 by doubling each digit before conversion.
- Does the # sign matter?
- No. The converter accepts the code with or without it, and uppercase or lowercase digits.
- What about 8-digit hex codes with alpha?
- This tool handles opaque 3 and 6 digit codes. For an 8-digit value, drop the last pair, which is the alpha channel.
- Can I paste the RGB values straight into CSS?
- Yes, the output is written in valid CSS form as rgb(255, 87, 51). For transparency, switch to rgba() and add a fourth value between 0 and 1, or use the modern space-separated syntax rgb(255 87 51 / 50%).