How to use the RGB to Hex Converter
Enter red, green and blue values from 0 to 255, then copy the hex code in upper or lower case.
How RGB to hex conversion works
Each channel from 0 to 255 is written as a two-digit hexadecimal number, then the three pairs are joined after a # sign. Red 59 is 3B, green 130 is 82 and blue 246 is F6, so rgb(59, 130, 246) is #3B82F6.
Hex or RGB in CSS?
Browsers treat #3B82F6 and rgb(59, 130, 246) as the same colour, so the choice is about readability. Hex codes are shorter and common in style guides; rgb() is easier to adjust by hand and pairs naturally with an alpha value for transparency.
HTML color codes
HTML color codes are hex values like #FF5733 used in web pages, CSS and design tools. Each pair of hex digits sets the red, green and blue channel from 00 to FF. Short forms like #F53 work too, where each digit is doubled to give #FF5533. When a brand guide gives a color in RGB, convert it here to paste straight into your stylesheet.
How it works
Write each channel as two hex digits.
Examples
- rgb(59, 130, 246)
#3B82F6 Lower case: #3b82f6
- rgb(255, 87, 51)
#FF5733 Lower case: #ff5733
- rgb(0, 0, 0)
#000000 Lower case: #000000
Common colours: RGB to hex
| RGB | Hex |
|---|---|
| rgb(0, 0, 0) | #000000 |
| rgb(255, 255, 255) | #FFFFFF |
| rgb(255, 0, 0) | #FF0000 |
| rgb(0, 255, 0) | #00FF00 |
| rgb(0, 0, 255) | #0000FF |
| rgb(255, 255, 0) | #FFFF00 |
| rgb(0, 255, 255) | #00FFFF |
| rgb(255, 0, 255) | #FF00FF |
| rgb(128, 128, 128) | #808080 |
| rgb(255, 165, 0) | #FFA500 |
| rgb(128, 0, 128) | #800080 |
| rgb(0, 0, 128) | #000080 |
Limitations and assumptions
Runs entirely in your browser. Nothing you enter is uploaded.
Frequently asked questions
What is the hex code for white?
#FFFFFF, which is rgb(255, 255, 255): every channel at its maximum.
Does capitalisation matter in hex codes?
No. #3B82F6 and #3b82f6 are the same colour; the converter gives both so you can match your project’s style.
How do I convert hex back to RGB?
Use the hex to RGB converter. It splits the code into three pairs and converts each back to a number from 0 to 255.