Convert HEX color codes to RGB and back instantly. Live preview, HSL values, and copy-ready CSS snippets included.
Click to open the system color picker
Type a HEX code above to see the conversion.
Click any color to populate the converter.
A HEX color code is a six-digit hexadecimal number prefixed with # that encodes a color in the RGB color model. The format is #RRGGBB, where RR, GG, and BB are two-digit hex values for red, green, and blue respectively. Each pair ranges from 00 (decimal 0, no intensity) to FF (decimal 255, full intensity).
For example, #FF5733 breaks down as R=255, G=87, B=51 — a vivid orange-red. Pure red is #FF0000, pure white is #FFFFFF, and pure black is #000000. HEX codes are case-insensitive, so #ff5733 and #FF5733 are identical. A shorthand 3-digit form is also valid: #F53 expands to #FF5533.
The conversion is straightforward base-16 to base-10 arithmetic. Given a 6-character hex string:
Use the built-in int() function with base 16, or let Pillow do the heavy lifting:
A HEX color code is a six-digit hexadecimal number (prefixed with #) that represents a color as three two-digit values for red, green, and blue. Each pair ranges from 00 (0) to FF (255). For example, #FF0000 is pure red.
Split the HEX string into three pairs and convert each from base-16 to base-10. In Python: int("FF", 16) = 255. In JavaScript: parseInt("FF", 16) = 255. This tool does it instantly as you type.
RGB stands for Red, Green, Blue — the three primary colors of light. In digital color, each channel ranges from 0 to 255. Mixing all three at 255 gives white; all at 0 gives black. Screens use RGB to display every color you see.
HSL stands for Hue, Saturation, Lightness. Hue is the color angle on a 0–360° wheel, saturation is the color intensity (0–100%), and lightness controls how light or dark it is (0–100%). HSL is often easier for designers to reason about than RGB or HEX.