HEX to RGB
Enter a HEX colour code and instantly get the R, G, B channel values and the CSS rgb() function string. Useful for translating design tokens, reading colour values from design files, and writing CSS.
Last updated: May 28, 2026
Find this tool useful? Support the project to keep it free!
Buy me a coffeeWhat is HEX to RGB?
HEX and RGB are two ways to express the same colour. A HEX code like #3B82F6 encodes the red, green, and blue channels as two hexadecimal digits each. RGB expresses those same channels as decimal integers from 0 to 255.
CSS accepts both formats, but some contexts — canvas drawing, image processing, colour arithmetic — require raw integer values. This tool handles both 3-digit shorthand (#RGB) and 6-digit (#RRGGBB) HEX codes.
How to Use HEX to RGB
Type or paste a HEX code (with or without the # prefix)
The RGB values and css rgb() string appear instantly
Copy the output with the copy button
Common Use Cases
- Frontend developers converting design token hex values to RGB for CSS custom properties or canvas APIs.
- Designers checking the RGB breakdown of a brand colour.
- Developers reading hex values from Figma or Sketch and needing RGB for a JavaScript colour library.
- CSS authors who prefer rgb() over hex for readability or when alpha is needed.
Example Input and Output
Converting the Tailwind blue-500 brand colour from HEX to RGB.
#3B82F6rgb(59, 130, 246)For alpha transparency
If you need rgba() output with an opacity value, use the HEX to RGBA tool.
Browser-side only
Conversion runs locally in your browser.
Frequently Asked Questions
Does this support 3-digit HEX codes?
Yes. #RGB shorthand (e.g. #F80) is expanded to #FF8800 before conversion.
Do I need the # prefix?
No — you can enter the hex digits with or without a leading #.
How do I add an alpha channel?
Use the HEX to RGBA tool to specify an opacity value and get rgba() output.
Is my data sent to a server?
No. All conversion runs in your browser.
Related Tools
RGB to HEX
Convert RGB colour values to a HEX code instantly. Shows the 6-digit #RRGGBB output with a live colour preview.
HEX to RGBA
Convert a HEX colour code to RGBA with a customisable alpha (opacity) value. Outputs the CSS rgba() string.
Color Converter
Convert colors between HEX, RGB, HSL, HSV, CMYK, and HWB. Includes tints & shades, WCAG contrast ratio, CSS snippets, and color history.
CMYK to RGB
Convert CMYK colour values to RGB. Shows R, G, B channels and the CSS rgb() string with a live colour preview.
CMYK to HEX
Convert CMYK colour values to a HEX code for use in CSS and web design. Shows intermediate RGB values and a live preview.
Color Picker from Image
Extract exact Hex, RGB, and HSL color codes from any image using a precision eyedropper tool.

