RGB to HEX Converter
Enter red, green, and blue values (0–255) to get the matching six-digit HEX code. Copy it for CSS or your design tool.
#6366F1
Click to change color
Red99
Green102
Blue241
Hue239
Saturation84
Lightness67
HSV / HSB
H239°
S59%
V95%
CMYK
C59%
M58%
Y0%
K5%
CIE LAB
L50
A39
B-70
XYZ (D65)
X25.77
Y18.5
Z85.42
CSS Formats
HEX#6366F1
RGBrgb(99, 102, 241)
HSLhsl(239, 84%, 67%)
HWBhwb(239 11% 33%)
Pantone Matches
Closest
Pantone 2685 C
#9D4EDC
Pantone Cool Gray 11
#53565A
Pantone 2592 C
#B83DBA
Quick Copy
How to use this converter
- Adjust the Red, Green, and Blue sliders, or type values directly into the number fields.
- Read the HEX field at the top, which updates to the matching six-digit code.
- Use the copy button next to the HEX field to copy the value.
Worked example
Each channel becomes a two-digit hexadecimal pair. Red 51 is33, green 102 is66, and blue 153 is99, joined into the HEX code.
rgb(51, 102, 153)→#336699Limitations to know
- Each channel is clamped to the 0 to 255 range.
- The output is a six-digit sRGB HEX code, not a wide-gamut color.
- Values are rounded to whole numbers before conversion.
Frequently asked questions
How do I convert RGB to HEX?
Adjust the red, green, and blue sliders (or type values 0 to 255). The HEX field updates to the matching six-digit code, which you can copy with the copy button next to it.
How is each channel turned into a HEX pair?
Each channel value (0 to 255) is converted to a two-digit hexadecimal number. Red, green, and blue are joined in order into a single six-digit code, for example 51, 102, 153 becomes 336699.
What happens to values outside 0 to 255?
The inputs clamp each channel to the 0 to 255 range, so anything below 0 is treated as 0 and anything above 255 is treated as 255 before the HEX code is produced.
Does the output include the # prefix?
Yes. The HEX field shows the full code with a # prefix, ready to paste into CSS or a design tool.