- Home
- Tools
- Color & Design
- Color Converter
- RGB to HEX Converter
RGB to HEX Converter
Enter red, green and blue values from 0 to 255 and get the six-digit HEX code of the same color.
The numbers alone will do: 255, 99, 71.
In HEX
#ff6347
Hue
9°Alpha
100%
In the other notations
Name
tomatoexact match
RGB to HEX by hand
The converter opens with rgb(255, 99, 71). This is how that color gets from RGB to HEX, step by step.
- Divide each value by 16. The whole part becomes the first digit and the remainder the second: 255 = 15 × 16 + 15, 99 = 6 × 16 + 3 and 71 = 4 × 16 + 7.
- Write the digits in base 16, with a to f for 10 to 15: 15 and 15 make
ff, 6 and 3 make63and 4 and 7 make47. - Put the three pairs after a hash sign:
#ff6347.
Well-known colors in RGB and HEX
| Color | RGB | HEX |
|---|---|---|
| black | rgb(0, 0, 0) | #000000 |
| white | rgb(255, 255, 255) | #ffffff |
| gray | rgb(128, 128, 128) | #808080 |
| red | rgb(255, 0, 0) | #ff0000 |
| orange | rgb(255, 165, 0) | #ffa500 |
| yellow | rgb(255, 255, 0) | #ffff00 |
| lime | rgb(0, 255, 0) | #00ff00 |
| green | rgb(0, 128, 0) | #008000 |
| cyan | rgb(0, 255, 255) | #00ffff |
| blue | rgb(0, 0, 255) | #0000ff |
| purple | rgb(128, 0, 128) | #800080 |
| magenta | rgb(255, 0, 255) | #ff00ff |
Two digits for every value
- A value below 16 still takes two digits: 9 is written
09. Without the zero the code is a digit short, and a browser ignores a code of five digits. - Percentages are scaled to 255 first.
rgb(100%, 50%, 0%)is 255, 127.5 and 0, and 127.5 is rounded up to 128, which is80. - When both digits are the same in all three pairs, the code has a short form:
#ffcc00can be written#fc0. - An opacity becomes a fourth pair in the same way: 0.5 × 255 = 127.5, rounded to 128, so
rgba(255, 99, 71, 0.5)is#ff634780.
The color converter shows a color in all seven notations at once, with a picker to choose it by eye.