Hex to RGB Converter
Convert hexadecimal color codes to RGB color values effortlessly with our Hex to RGB Converter. Perfect for web and graphic designers.
How the Hex to RGB Converter works
Converts a hex color code such as #ff5733 into its CSS rgb() value and shows a swatch of the color. It accepts 3-digit and 6-digit codes and converts as you type.
- Type or paste a hex color into the Hex code field, including the leading "#" (for example #ff5733).
- Read the rgb() value in the Result panel. It updates as you type; there is no button to press.
- Check the Preview swatch at the bottom of the Result panel to confirm it is the color you expected.
- If you see "Enter a valid hex color to convert," check that the code starts with "#" and has exactly 3 or 6 hex digits (0–9, A–F).
How the conversion works
A 6-digit hex code is three pairs of base-16 digits: one pair each for red, green and blue. Each pair becomes a number from 0 to 255 by multiplying the first digit by 16 and adding the second, where the letters A–F stand for 10–15.
Example: for #ff5733, ff = 15 × 16 + 15 = 255, 57 = 5 × 16 + 7 = 87, and 33 = 3 × 16 + 3 = 51, so the result is rgb(255, 87, 51).
A 3-digit code is shorthand: each digit is doubled before converting, so #0af is read as #00aaff and becomes rgb(0, 170, 255). Uppercase and lowercase letters give the same result.
What it accepts
Only "#" followed by exactly 3 or 6 hex digits. Codes without the "#", codes with spaces around them, and 4- or 8-digit codes that include transparency (such as #ff573380) are not converted. The tool converts in one direction only, from hex to RGB.
The conversion runs in your browser; nothing you type is sent anywhere.
Frequently asked questions
What is #FFFFFF in RGB?
#FFFFFF is rgb(255, 255, 255), which is white. At the other end, #000000 is rgb(0, 0, 0), black. Every pair of F's is 255, the maximum for a channel, and every pair of 0's is 0.
Is #FFF the same as #FFFFFF?
Yes. A 3-digit hex code doubles each digit, so #FFF expands to #FFFFFF and #1a3 expands to #11aa33. This tool expands shorthand codes before converting.
Why does the tool need the "#" sign?
The input check requires it: the code must start with "#" followed by 3 or 6 hex digits. If you paste a code without it, add "#" at the front and the result will appear.
Can it convert RGB back to hex?
No, this tool only converts hex to RGB. To go the other way, convert each of the three numbers (0–255) to a two-digit hex value and join them: rgb(255, 87, 51) is ff, 57 and 33, so #ff5733.
Does it support 8-digit hex codes with transparency?
No. 4-digit and 8-digit hex codes, where the last digit or pair sets the alpha channel, are rejected as invalid. Convert the first six digits and add the alpha separately, for example as rgba(255, 87, 51, 0.5).
Do hex and RGB show exactly the same color?
Yes. They are two ways of writing the same red, green and blue values, so converting between them loses nothing. Browsers render #ff5733 and rgb(255, 87, 51) identically.
Similar Developer tools
Markdown Previewer
Preview your Markdown content in real-time with our Markdown Previewer. Perfect for documentation, notes, and blog posts.
Base64 Encoder/Decoder
Encode and decode UTF-8 text as standard Base64. Supports Unicode; this is encoding, not encryption.
JSON Prettifier
Format and beautify JSON data to make it more readable with our JSON Prettifier tool. Perfect for developers and anyone working with JSON.