Complete guide to hexadecimal color codes — structure, RGB conversion, usage in web & design
A HEX color code is a 6-character alphanumeric code (using digits 0–9 and letters A–F) that represents a specific color in web design, digital graphics, and UI development. It is written with a # prefix followed by three pairs of hexadecimal digits — each pair representing the intensity of Red, Green, and Blue light (the RGB model).
HEX is the most widely used color notation in CSS, HTML and design tools because of its compact format. #FF5733, #1a3a6e, and #FFFFFF are all HEX codes — representing orange, dark navy, and white respectively.
Each HEX code is a pair of three 2-digit hexadecimal numbers:
Each pair ranges from 00 (no intensity) to FF (maximum = 255 in decimal). The system can represent 16,777,216 unique colors.
| Swatch | HEX Code | Color Name | RGB Equivalent |
|---|---|---|---|
| #000000 | Black | rgb(0, 0, 0) | |
| #FFFFFF | White | rgb(255, 255, 255) | |
| #FF0000 | Red | rgb(255, 0, 0) | |
| #00FF00 | Lime Green | rgb(0, 255, 0) | |
| #0000FF | Blue | rgb(0, 0, 255) | |
| #FFFF00 | Yellow | rgb(255, 255, 0) | |
| #FF5733 | Orange-Red | rgb(255, 87, 51) | |
| #1a3a6e | Dark Navy | rgb(26, 58, 110) |
color: #1a3a6e; or background-color: #FF5733;<div style="color:#FF5733">#RGB shorthand exists for colors where both digits are identical — e.g. #FFF = #FFFFFF, #03A = #0033AA