Hex to RGB Converter
WM-06Paste hex color codes, one per line, and get the red, green and blue values back as rgb(). A code with alpha, such as #ff880080, comes out as rgba().
Runs in your browser. Nothing is uploaded.
Hex colors, one per line
RGB
How to use it
- Paste one hex color per line, with or without the #.
- The result updates as you type. Blank lines stay blank so the output lines up with your input.
- Pick the RGB style: rgb(255, 136, 0), the space form rgb(255 136 0), or the plain numbers 255, 136, 0.
- Copy the result or download it as a text file.
Which hex codes it reads
Three, four, six and eight digit hex all work, in any letter case: #f80, #f808, #ff8800 and #ff880080. The short forms double each digit, so #f80 is #ff8800. The leading # is optional. The fourth pair of digits is alpha. It is turned into a fraction of 255 and shown to three decimals, so 80 becomes 0.502 rather than a rounded 0.5. Other formats such as hsl() or a color name like tomato are also accepted and written out as RGB.
Reading the result
Each channel is a whole number from 0 to 255, which is exactly what the two hex digits stand for: ff is 255, 88 is 136. Nothing is rounded when the input is hex, because a hex digit pair is already a whole number. The three styles differ only in punctuation. Use the comma form in older CSS, the space form in current CSS where rgb(255 136 0 / 50%) is valid, and the plain form for design tools that ask for three numbers.
Everything stays in the page
The conversion is a few lines of arithmetic that run in your browser, so there is nothing to wait for. Colors are not sent to a server and there is no account. You can paste a whole list of codes at once and every line is converted on its own.
Error messages and what to do
| Message | What it means | Fix |
|---|---|---|
Line 2: "#12" has 2 hex digits; a hex color needs 3, 4, 6 or 8 | The code on that line has the wrong number of digits. Five and seven digit codes are rejected the same way. | Add or remove digits until it has 3, 4, 6 or 8. |
Line 1: "nope" is not a color. Use hex (#rgb, #rrggbb, #rrggbbaa), rgb(), hsl(), hsv(), cmyk() or a CSS color name. | The line is not hex or any other format the page reads. | Check for a stray character, or write the color as #rrggbb. |
Questions people ask
How do I convert hex to RGB?
Split the six digits into three pairs and read each pair as a base 16 number. In #ff8800, ff is 255, 88 is 136 and 00 is 0, so the color is rgb(255, 136, 0). This page does it for every line you paste.
How do I convert a 3-digit hex code to RGB?
Each digit is doubled first. #f80 becomes #ff8800, which is rgb(255, 136, 0). So #fff is rgb(255, 255, 255) and #000 is rgb(0, 0, 0). The page expands the short form for you.
What does the 8-digit hex code mean?
The last two digits are the alpha channel, the opacity. 00 is fully transparent and ff is fully opaque. #ff880080 is the orange from above at 128 out of 255, which is about 0.502, written as rgba(255, 136, 0, 0.502).
Can I convert many hex colors at once?
Yes. Put one color on each line. The output has one line for each input line, in the same order, and a blank line stays blank. If one line is invalid the error names the line number so you can find it.
Does it work without the # sign?
Yes. ff8800 and #ff8800 give the same result. The page also accepts uppercase letters, so #FF8800 works too, and a trailing semicolon, as in a copied CSS line, is ignored.
About this tool
Reads #rgb, #rrggbb, #rgba and #rrggbbaa, with or without the #, in any letter case. Any other color format works as input too: hex, rgb(), hsl(), hsv(), cmyk() or a CSS color name. Each line is one color and blank lines stay blank. A color with alpha comes out as rgba() (or a fourth number in the plain style); the alpha is the hex byte divided by 255, shown to three decimals, so 80 becomes 0.502. Values outside the allowed range are clamped. Nothing is looked up or uploaded.