HEX to RGB converter

Paste HEX colour codes, one per line or inside any CSS, and get the RGB value of each, ready to copy. It converts back from RGB to HEX too.

  • 100% free
  • Runs in your browser
  • No uploads

Also reads rgb(), hsl(), oklch() and CSS names, so it converts in any direction.

Convert to

5 colours

ColourFromToCopy
#1f7ae0rgb(31, 122, 224)
#f60rgb(255, 102, 0)
ff6347rgb(255, 99, 71)
#2e9e5brgb(46, 158, 91)
#1c1f23rgb(28, 31, 35)
Your text with the codes replaced

How to convert HEX to RGB

  1. Paste your codes. One per line, with or without the #, or a whole stylesheet or design token file. Every colour code in the text is found.
  2. Choose the output. rgb() for CSS, r, g, b for Office and other apps that want three numbers, HEX to go the other way, or HSL.
  3. Copy. Copy one value, the whole list, or your original text with every code rewritten in the new format.

Common colours in HEX and RGB

ColourHEXRGB
White#ffffff255, 255, 255
Black#0000000, 0, 0
Red#ff0000255, 0, 0
Green (CSS green)#0080000, 128, 0
Blue#0000ff0, 0, 255
Orange#ffa500255, 165, 0
Grey (CSS grey)#808080128, 128, 128
Navy#0000800, 0, 128
Teal#0080800, 128, 128
Gold#ffd700255, 215, 0

What the converter does

HEX and RGB are two ways of writing the same three numbers: how much red, green and blue light make the colour, each from 0 to 255. HEX writes each number as two base-16 digits (00 to ff), so the conversion is exact and nothing is lost either way.

Short codes such as #f60 double each digit (#ff6600). The converter accepts upper or lower case and codes without the #. A line it can't read, such as a five-digit code, is listed with the reason instead of being skipped silently, so a typo in a long list doesn't go unnoticed.

Want to pick a colour rather than convert one? The color picker shows every format for one colour, checks its contrast and can take a colour from an image.

Frequently asked questions

How do I convert HEX to RGB by hand?

Split the six characters into three pairs and turn each pair from base 16 into a normal number: multiply the first digit by 16 and add the second, with a = 10 up to f = 15. #ff6600 gives ff = 255, 66 = 102 and 00 = 0, so rgb(255, 102, 0).

Can it convert RGB back to HEX?

Yes. Paste rgb() values (or plain numbers such as 255, 102, 0, one colour per line) and choose HEX as the output. It also reads hsl(), oklch() and CSS colour names.

What about HEX codes with 8 characters?

The last two characters of an 8-digit code (#rrggbbaa) are transparency. The converter keeps the red, green and blue part and leaves the transparency out, so #1f7ae080 becomes rgb(31, 122, 224).

Which format should I paste into Figma, Canva or Word?

Figma and Canva take HEX. Word, PowerPoint and Excel ask for red, green and blue numbers in their custom colour box, so choose the r, g, b output and copy the three numbers.

Is my CSS uploaded anywhere?

No. The conversion runs in your browser as you type, and nothing you paste leaves your device.