Home/Calculators/Tech & Data/Hex to RGB Converter

Hex to RGB Converter

Convert a hex color code into its red, green and blue channel values.

hex-to-rgb
Result
—
In summary: The hex color #ff5733 converts to rgb(255, 87, 51). Each pair of hex digits is one channel read as a base-16 number: ff is 255, 57 is 87 and 33 is 51. Three-digit shorthand such as #f53 is expanded by doubling each digit first.

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:

HexRGB
#000000rgb(0, 0, 0)
#FFFFFFrgb(255, 255, 255)
#FF0000rgb(255, 0, 0)
#808080rgb(128, 128, 128)
#FF5733rgb(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%).
How this tool works

The formula behind this tool is written out in full in the sections above, so you can check the maths yourself. Every calculator on Calculorium is verified against worked examples with automated tests before it is published, and pages are reviewed as formulas or standards change. Nothing you type is sent anywhere — the calculation runs entirely in your browser. Read how we build and check these tools.

Last updated: October 2, 2026 · Calculations run in your browser. Estimates for information only.