HEX to RGB Converter
Convert between HEX colour codes and RGB values.
How to use the HEX to RGB Converter
- Type or paste a code into the HEX field. The hash is optional and three-digit shorthand works.
- The swatch and the rgb value beneath it refresh as you type, with no button to press.
- Press Copy RGB to put the rgb string on your clipboard, ready to paste into CSS.
Reading six digits as three pairs
The first two digits are red, the middle two green, the last two blue. Each pair runs 00 to FF, which is 0 to 255 in decimal, so #5EEAD4 works out as rgb(94, 234, 212). Shorthand doubles each digit, which is why #fff and #ffffff are one colour.
Alpha digits and codes it cannot read
An eight-digit code carrying an alpha channel is accepted, but only the first six digits are read, so transparency is dropped without a warning. A code with characters outside 0 to 9 and A to F is skipped and the previous colour stays on screen.
Frequently asked questions
What is a HEX colour code?
A six-digit hexadecimal representation of a colour, two digits each for red, green and blue.
Do three-digit codes work?
Yes. Shorthand like #fff is expanded automatically, so #fff and #ffffff produce the same colour.
Does it convert RGB back to HEX?
No. This page runs one way, from a HEX code to rgb values. Going back means turning each of the three numbers into two hexadecimal digits yourself.
Can I paste a code with alpha, such as #5EEAD480?
Yes, but the last two digits are ignored. That code returns rgb(94, 234, 212), the same as #5EEAD4, with no mention of transparency.
Do I have to type the hash?
No. A leading hash is stripped before the code is read, so 5EEAD4 and #5EEAD4 both work, as does the three-digit form of either.