Color Next

HEX to RGB Converter

Convert one or many HEX codes to RGB values.

HEX to RGB Converter: the tool

HEX to RGB converter

HEX codes

One per line, or separated by commas or spaces. With or without #, 3, 4, 6 or 8 digits. Up to 500.

RGB values

5 converted, 0 not valid.
HEX codes and their RGB values. Press a value to copy it.
ColorHEXRGB
Color 1
Color 2
Color 3
Color 4
Color 5

Paste a HEX code and read its red, green and blue values at once. Paste a whole list, for example every color of a stylesheet, and get a table of all of them, with each RGB value ready to copy in the style your code needs. Codes with or without the #, in short or long form and with transparency are all understood.

How it works

A six-digit HEX code is three pairs of digits in base sixteen, one pair each for red, green and blue. Each pair is a number from 0 to 255. Take #FF6347: FF is 15 times 16 plus 15, which is 255. 63 is 6 times 16 plus 3, which is 99. 47 is 4 times 16 plus 7, which is 71. So #FF6347 is rgb(255, 99, 71), the color called tomato in CSS.

A three-digit code is shorthand in which every digit stands for a pair of the same digit, so #F63 means #FF6633. A four-digit or eight-digit code ends with transparency. The last pair is divided by 255 to give an alpha between 0 and 1, so #FF634780 is rgba(255, 99, 71, 0.502), a tomato that is about half see-through.

The conversion uses whole numbers and is exact in both directions: a HEX code always gives the same three numbers, and those numbers give back the same code. The list below accepts codes separated by new lines, commas, semicolons or spaces, so you can paste them straight from a file. Each code is checked on its own, and a mistake is reported by its position without stopping the others.

How to use it

  1. Paste or type HEX codes into the box, one per line or separated by commas or spaces.
  2. Choose how to write the RGB value: CSS with commas, modern CSS with spaces, percentages, three plain numbers or an array.
  3. Read the table. A code that is not valid is listed above it with its position and the reason.
  4. Press a value to copy it, or Copy all RGB values to take the whole list.

Example

Three HEX codes converted by the same code that runs in the tool above, in the default CSS style.

What was set

HEX codes
#FF6347, #1E90FF, #2E8B57, 3CB, #FF634780
Style
CSS, with commas

What came out

#FF6347
rgb(255, 99, 71)
#1E90FF
rgb(30, 144, 255)
#2E8B57
rgb(46, 139, 87)
#33CCBB
rgb(51, 204, 187)
#FF6347 with alpha
rgba(255, 99, 71, 0.502)

Good to know

  • Up to 500 codes are converted at a time. If you paste more, the first 500 are used and a note says so.
  • Only HEX codes are read here. To convert from names, hsl() or any other format, use the color converter.
  • A code with transparency is shown with its alpha rounded to three decimals, so converting it back can differ by one step in the last pair.
  • The result is the color as the numbers define it. How it looks depends on the screen it is shown on.

Questions people ask

How do I convert HEX to RGB by hand?

Split the code into three pairs. For each pair, multiply the first digit by 16 and add the second, counting A to F as 10 to 15. The three results, each between 0 and 255, are the red, green and blue values.

What does a three-digit HEX code mean?

It is a shortcut for a six-digit code in which each digit is doubled. #09C is the same color as #0099CC. Only colors whose pairs repeat can be written this way, which is why it is called the short form.

What are eight-digit HEX codes?

They add a fourth pair for alpha, the opacity of the color, from 00 for fully transparent to FF for fully opaque. They are part of the CSS color standard and work in all current browsers. Four-digit codes are the short form of the same thing.

Can I convert many HEX codes at once?

Yes, and that is what this page is for. Paste a list, choose a style, and copy all the results in one go, for example to move a palette from a design file into a script as arrays.

Do uppercase and lowercase letters give different colors?

No. #ff6347 and #FF6347 are the same color. The converter shows HEX codes in uppercase, and reads them in any case.