Hex Color Converter
Convert colors between hex, RGB, and HSL with a live preview.
Enter any hex code or RGB values to instantly get all three formats for web and design work.
A hex color code is a 6-digit hexadecimal number representing a color in the RGB (Red, Green, Blue) color model. Every color on a digital screen is a combination of red, green, and blue light at intensities from 0 to 255 — hex codes encode these three values compactly into a format widely used in HTML, CSS, and design software.
Format: #RRGGBB — where RR = red channel, GG = green channel, BB = blue channel Each channel is a 2-digit hex number representing a value from 00 (0 decimal) to FF (255 decimal).
Hex to RGB conversion: R = hex(RR) in decimal | G = hex(GG) in decimal | B = hex(BB) in decimal
Hexadecimal to decimal: Hex digits: 0–9 (same as decimal) and A=10, B=11, C=12, D=13, E=14, F=15 Two-digit hex: first digit × 16 + second digit
RGB to Hex conversion: R → hex: divide by 16 for first digit, remainder for second digit Or: convert each R/G/B value to base-16.
Worked examples:
#FF5733 → RGB:
- R = FF = 15×16 + 15 = 255
- G = 57 = 5×16 + 7 = 87
- B = 33 = 3×16 + 3 = 51 Result: rgb(255, 87, 51) — a vivid orange-red
rgb(34, 139, 34) → Hex (Forest Green):
- R = 34 → 34 ÷ 16 = 2 remainder 2 → 22
- G = 139 → 139 ÷ 16 = 8 remainder 11 (B) → 8B
- B = 34 → 22 Result: #228B22
Common web colors:
| Color | Hex | RGB |
|---|---|---|
| White | #FFFFFF | 255, 255, 255 |
| Black | #000000 | 0, 0, 0 |
| Red | #FF0000 | 255, 0, 0 |
| Lime | #00FF00 | 0, 255, 0 |
| Blue | #0000FF | 0, 0, 255 |
| Yellow | #FFFF00 | 255, 255, 0 |
| Cyan | #00FFFF | 0, 255, 255 |
| Magenta | #FF00FF | 255, 0, 255 |
3-digit shorthand: #RGB where each digit is doubled: #F5A = #FF55AA. Used in CSS for colors where both hex digits of each channel are identical.
Alpha channel (transparency): #RRGGBBAA adds an 8th digit pair for opacity. #FF573380 = 50% transparent orange-red.