HEX to RGB Converter
Convert hex color codes to RGB, one per line. Supports 3, 4, 6 and 8 digit hex, with or without the # sign.
HEX to RGB Converter: the tool
Input
RGB
The result appears here.How to use HEX to RGB
- Paste one hex color per line, with or without the leading #.
- Each line is converted as you type. Blank lines are kept so the output lines up with your input.
- Choose CSS rgb() for ready-to-paste values, or Plain numbers for a bare list such as 30, 144, 255.
- If a line is not a valid hex color, the message gives its line number. Use Go to error to jump to it.
Example
Four hex colors, including a short form and one with transparency, converted to CSS rgb() values.
#1e90ff #663399 #fff #ff000080
rgb(30, 144, 255) rgb(102, 51, 153) rgb(255, 255, 255) rgba(255, 0, 0, 0.5)
About this tool
A hex color is three pairs of hexadecimal digits for the red, green and blue channels: #1e90ff means red 1e (30), green 90 (144) and blue ff (255). The short form #rgb repeats each digit, so #f60 is #ff6600. A fourth pair, or a fourth digit in the short form, is the alpha (opacity) channel.
RGB writes the same three numbers in decimal, from 0 to 255. The conversion is exact, so converting back with the RGB to HEX tool always returns the original color. When the hex code has an alpha channel, the result uses rgba() with the opacity as a number between 0 and 1.
Many colors can be converted at once, which helps when you move a palette from a design file to a stylesheet or the other way round.
Frequently asked questions
How do I convert a hex color to RGB by hand?
Split the code into three pairs and convert each from base 16 to base 10. For #1e90ff, 1e is 1 × 16 + 14 = 30, 90 is 9 × 16 + 0 = 144 and ff is 15 × 16 + 15 = 255.
What do 4 and 8 digit hex codes mean?
They include alpha (opacity). #ff000080 is red at 50% opacity, because 80 in hexadecimal is 128 out of 255. The converter outputs rgba(255, 0, 0, 0.5).
Does the # sign matter?
No. ff0000 and #ff0000 are converted the same way.
Is hex case sensitive?
No. #FF8800 and #ff8800 are the same color.
Can I convert color names or hsl() values?
This tool is for hex codes. The Color converter accepts hex, rgb(), hsl() and CSS color names and shows every format at once.
More developer tools
- →#RGB to HEX ConverterConvert rgb() and rgba() colors, or plain r, g, b triples, to hex codes. Batch conversion with alpha support.
- ◐Color ConverterConvert any CSS color between HEX, RGB, HSL and CMYK, with a color picker and WCAG contrast ratios against white and black.
- cssCSS MinifierRemove comments, whitespace and the last semicolon of every block from CSS. The result behaves exactly like the original.
- cssCSS FormatterBeautify CSS with one declaration per line and consistent indentation. Media queries, nesting, custom properties and data URLs are handled.