RGB to Hex Converter
Convert RGB values to a hex color code instantly, with a live preview swatch and HSL/CMYK equivalents included.
Enter RGB values to see the hex equivalent — HSL and CMYK are included too.
RGB
rgb(99, 102, 241)
HEX
#6366f1
HSL
hsl(239, 84%, 67%)
Also available in CMYK
Approximate print (CMYK) values, calculated from the RGB color above.
c
59%
m
58%
y
0%
k
5%
Everything you enter is processed in your browser and isn't sent to our servers.
How to use rgb to hex converter
- 1Enter red, green and blue values from 0 to 255.
- 2The equivalent hex color code appears instantly.
- 3Check the live swatch to confirm the color, and copy the hex code.
- 4HSL and CMYK equivalents are shown too, if you need them.
About this tool
RGB describes a color as three separate 0–255 values for red, green and blue. Converting to hex means writing each of those three decimal numbers as a two-digit base-16 (hexadecimal) pair, then joining them into a single six-digit code prefixed with #.
For example, rgb(99, 102, 241) converts to 63, 66 and f1 in hex, joined as #6366F1 — the compact format used throughout CSS, design tools and image editors.
An alpha/opacity slider is included for cases where you need an 8-digit hex code with a transparency channel appended, which some modern CSS and design tools also accept.
Frequently asked questions
rgb(99, 102, 241) converts to #6366F1.