About this tool
Type a hex color code to see its color and its RGB and HSL values, or type RGB values to get the hex code. Below the converter is a chart of common hex color codes with swatches, so you can find a color by name and copy its code. Everything runs in your browser.
How to use it
Enter a hex code such as #3B82F6 (the # is optional, and 3-digit codes like #0AF work too) to see the swatch and the RGB and HSL values. Or edit the RGB box with three numbers from 0 to 255 to get the hex code. For more conversions, see the color converter.
What a hex color code is
A hex color code is a six-digit number in base 16 that describes a color. The digits come in three pairs for red, green and blue. Each pair runs from 00 (none) to FF (full, 255). So #FF0000 is full red, #00FF00 is full green, #0000FF is full blue, #000000 is black and #FFFFFF is white.
How to convert hex to RGB by hand
Split the code into pairs and convert each from base 16 to decimal. For #3B82F6: 3B is 59, 82 is 130 and F6 is 246, which gives RGB 59, 130, 246. Going the other way, convert each number to two hex digits, padding a single digit with a leading zero.
Basic hex color codes
| Color | Name | Hex | RGB | HSL |
|---|---|---|---|---|
| Black | #000000 | 0, 0, 0 | 0, 0%, 0% | |
| White | #FFFFFF | 255, 255, 255 | 0, 0%, 100% | |
| Red | #FF0000 | 255, 0, 0 | 0, 100%, 50% | |
| Lime | #00FF00 | 0, 255, 0 | 120, 100%, 50% | |
| Blue | #0000FF | 0, 0, 255 | 240, 100%, 50% | |
| Yellow | #FFFF00 | 255, 255, 0 | 60, 100%, 50% | |
| Cyan / Aqua | #00FFFF | 0, 255, 255 | 180, 100%, 50% | |
| Magenta / Fuchsia | #FF00FF | 255, 0, 255 | 300, 100%, 50% | |
| Gray | #808080 | 128, 128, 128 | 0, 0%, 50% | |
| Silver | #C0C0C0 | 192, 192, 192 | 0, 0%, 75% | |
| Maroon | #800000 | 128, 0, 0 | 0, 100%, 25% | |
| Olive | #808000 | 128, 128, 0 | 60, 100%, 25% | |
| Green | #008000 | 0, 128, 0 | 120, 100%, 25% | |
| Purple | #800080 | 128, 0, 128 | 300, 100%, 25% | |
| Teal | #008080 | 0, 128, 128 | 180, 100%, 25% | |
| Navy | #000080 | 0, 0, 128 | 240, 100%, 25% |
More common hex color codes
| Color | Name | Hex | RGB | HSL |
|---|---|---|---|---|
| Orange | #FFA500 | 255, 165, 0 | 39, 100%, 50% | |
| Gold | #FFD700 | 255, 215, 0 | 51, 100%, 50% | |
| Coral | #FF7F50 | 255, 127, 80 | 16, 100%, 66% | |
| Salmon | #FA8072 | 250, 128, 114 | 6, 93%, 71% | |
| Tomato | #FF6347 | 255, 99, 71 | 9, 100%, 64% | |
| Crimson | #DC143C | 220, 20, 60 | 348, 83%, 47% | |
| Hot pink | #FF69B4 | 255, 105, 180 | 330, 100%, 71% | |
| Pink | #FFC0CB | 255, 192, 203 | 350, 100%, 88% | |
| Violet | #EE82EE | 238, 130, 238 | 300, 76%, 72% | |
| Orchid | #DA70D6 | 218, 112, 214 | 302, 59%, 65% | |
| Indigo | #4B0082 | 75, 0, 130 | 275, 100%, 25% | |
| Turquoise | #40E0D0 | 64, 224, 208 | 174, 72%, 56% | |
| Sky blue | #87CEEB | 135, 206, 235 | 197, 71%, 73% | |
| Royal blue | #4169E1 | 65, 105, 225 | 225, 73%, 57% | |
| Dodger blue | #1E90FF | 30, 144, 255 | 210, 100%, 56% | |
| Steel blue | #4682B4 | 70, 130, 180 | 207, 44%, 49% | |
| Forest green | #228B22 | 34, 139, 34 | 120, 61%, 34% | |
| Sea green | #2E8B57 | 46, 139, 87 | 146, 50%, 36% | |
| Lime green | #32CD32 | 50, 205, 50 | 120, 61%, 50% | |
| Khaki | #F0E68C | 240, 230, 140 | 54, 77%, 75% | |
| Beige | #F5F5DC | 245, 245, 220 | 60, 56%, 91% | |
| Lavender | #E6E6FA | 230, 230, 250 | 240, 67%, 94% | |
| Chocolate | #D2691E | 210, 105, 30 | 25, 75%, 47% | |
| Brown | #A52A2A | 165, 42, 42 | 0, 59%, 41% | |
| Tan | #D2B48C | 210, 180, 140 | 34, 44%, 69% | |
| Slate gray | #708090 | 112, 128, 144 | 210, 13%, 50% | |
| Light gray | #D3D3D3 | 211, 211, 211 | 0, 0%, 83% |
Short hex codes and transparency
A 3-digit code repeats each digit, so #0AF means #00AAFF. Eight-digit codes add two more digits at the end for transparency (alpha): #3B82F680 is the same blue at about 50% opacity. Support for 8-digit hex is good in modern browsers.
Things to watch out for
Hex codes are not case sensitive, so #ff0000 and #FF0000 are the same. Screens show colors differently, and colors for print use CMYK, which cannot match every screen color. Check contrast before using a color for text: low-contrast pairs, such as light gray on white, are hard to read and fail accessibility guidelines.
Frequently asked questions
Split the hex code into three pairs and convert each from base 16 to decimal. #3B82F6 becomes 3B = 59, 82 = 130, F6 = 246, so RGB 59, 130, 246.
White is #FFFFFF and black is #000000. Red is #FF0000, green is #00FF00 and blue is #0000FF.
No. #ff0000 and #FF0000 are the same color.