Graphics programs often show RGB values from 0 to 255, while HTML and CSS commonly use six-digit HEX codes. Each channel is written as a two-digit hexadecimal number, so 30, 144, 255 becomes #1E90FF.
How to use the RGB to HEX Converter
- Input format
- Colour
Everything runs in your browser, so results appear instantly and nothing you type is sent to a server.
How it works
Your colour is parsed in the format you choose and converted to RGB first; every other notation is computed from RGB. CMYK here is a simple device-independent conversion; professional printing uses colour profiles that can shift the values.
Formula
HEX: each pair of hex digits = one RGB channel (00–FF = 0–255)HSL/HSV from RGB via the standard hexcone formulasCMYK: K = 1 − max(R,G,B)/255Worked example
Inputs — Input format: RGB (0–255); Colour: 30, 144, 255.
Results — HEX = #1E90FF; RGB = rgb(30, 144, 255); HSL = hsl(210, 100%, 56%); HSV / HSB = hsv(210, 88%, 100%); CMYK = cmyk(88%, 44%, 0%, 0%); Decimal value = 2,003,199.
Key terms
- HEX code
- A colour written as #RRGGBB in hexadecimal.
- Contrast ratio
- WCAG measure of luminance difference between text and background, from 1:1 to 21:1.
Frequently asked questions
How do I convert HEX to RGB?
Split the code into three pairs and convert each from base 16 to base 10: FF = 255.
What contrast ratio do I need for text?
WCAG asks for at least 4.5:1 for normal text and 3:1 for large text.
Can I enter a 3-digit HEX code?
Yes: #F80 is read as #FF8800.
What formula does the RGB to HEX Converter use?
HEX: each pair of hex digits = one RGB channel (00–FF = 0–255).