RGB to HEX Converter
Turn RGB colour values into hex codes for CSS, HTML and design tools — with live preview and HSL.
| HEX | |
|---|---|
| RGB | |
| HSL | |
| CSS |
How to convert RGB to HEX
- Type the red, green and blue values (0–255), for example 255, 165, 0 or rgb(255, 165, 0).
- The HEX code, HSL value and a CSS snippet appear instantly.
- Copy the hex code, or type in the HEX box to go back to RGB.
How RGB to HEX works
Each RGB channel is a number from 0 to 255. Written in hexadecimal (base 16) that's two digits from 00 to FF. Convert red, green and blue separately and put them after a #: rgb(255, 165, 0) → FF, A5, 00 → #FFA500. For example 165 = 10 × 16 + 5, and 10 is “A” in hex, so 165 = A5.
| Colour | RGB | HEX |
|---|---|---|
| White | 255, 255, 255 | #FFFFFF |
| Black | 0, 0, 0 | #000000 |
| Red | 255, 0, 0 | #FF0000 |
| Orange | 255, 165, 0 | #FFA500 |
| Grey | 128, 128, 128 | #808080 |
| Navy | 0, 0, 128 | #000080 |
Need the other direction? Use the HEX to RGB converter.
Frequently asked questions
What formats can I type?
Three numbers separated by commas or spaces (255, 165, 0), or CSS notation such as rgb(255 165 0) or rgba(255, 165, 0, 0.5).
What is an RGB value in hexadecimal?
It's the same colour written in base 16: each channel (0–255) becomes two hex digits (00–FF), so the whole colour is a six-digit code like #FFA500.
Why are there letters in hex codes?
Hexadecimal needs 16 digits, so after 0–9 it uses A–F for 10–15. FF is 15 × 16 + 15 = 255, the maximum value of a channel.
Is #FFA500 the same as #ffa500?
Yes. Hex colour codes are not case-sensitive.