HEX to RGB Converter
Turn any HEX code into RGB and HSL values, with alpha support.
Turn red, green and blue values into a HEX code.
RGB to HEX Converter takes three channel values between 0 and 255 and writes them as the six-digit HEX code that stylesheets expect. Each channel becomes two hexadecimal digits, so red 255, green 153, blue 0 becomes #FF9900. The same colour is also shown in HSL, which is the format to use when you want to adjust it afterwards.
You can type the numbers or drag the sliders. Dragging is the faster way to find a colour you cannot name precisely, because the preview updates continuously and you can see the result at a usable size instead of guessing from numbers.
An optional alpha value adds transparency, producing an eight-digit HEX code and an rgba string. Values outside the valid range are clamped rather than silently producing a wrong colour, and a message tells you when that has happened.
The rgb to hex converter is used by writers, developers, students, marketers and anyone else who needs the job done once without installing software. Common cases include:
Each channel is stored in eight bits, which gives 256 possible levels from 0 to 255. Three channels of eight bits each make the 24-bit colour that standard HEX codes describe.
It is clamped to 255 and a message explains the adjustment, so the preview and the HEX code always reflect a real colour rather than an impossible one.
As two extra digits at the end, giving an eight-digit code. An alpha of 0.5 becomes roughly 80 in hexadecimal, so a half-transparent red is about #FF000080.
Every current browser does. If you need to support very old versions, use the rgba form instead, which has been supported far longer.
No. Screens mix light using red, green and blue, while printers mix ink using cyan, magenta, yellow and black. A colour that looks vivid on screen may print duller, so print work needs a conversion step.
It picks a random value for each channel. It is a quick way to explore unexpected combinations when you are stuck on a palette.
If the rgb to hex converter is not quite what you need, these other free tools solve closely related problems.
Turn any HEX code into RGB and HSL values, with alpha support.
Choose any colour and copy it in HEX, RGB or HSL, with tints and shades.
Compress and resize JPEG, PNG and WebP images privately in your browser.
Three calculators: percent of a number, what percent one number is, and change.
Pretty-print and validate JSON, with the exact line and column of any error.