RGB to HEX Converter
Enter R, G and B values and get the matching HEX and HSL colour.
Convert a HEX colour code to RGB and HSL.
Accepts 3, 4, 6 or 8 digits. The leading hash is optional.
A HEX colour code packs three numbers into one string. Each pair of hexadecimal digits represents one channel, from 00 to FF, which is 0 to 255 in decimal. HEX to RGB Converter unpacks that string and shows the same colour as separate red, green and blue values, and as hue, saturation and lightness.
All four common HEX lengths are accepted. The three-digit shorthand expands each digit, so #f90 means #ff9900. Six digits is the standard form. Four and eight digit values carry an alpha channel for transparency, which is reported as a value between 0 and 1 in the rgba output. The leading hash is optional.
Converting to RGB is useful when a value needs an alpha channel or when you are working with code that takes separate channels. Converting to HSL is useful when you want to adjust the colour rather than simply restate it, because lightness and saturation are far easier to tune by hand than three independent channels.
The hex to rgb converter is used by writers, developers, students, marketers and anyone else who needs the job done once without installing software. Common cases include:
It must contain only the digits 0 to 9 and the letters A to F, and be three, four, six or eight characters long after the optional hash. Anything else, such as a typo that uses the letter G, is rejected with a message.
They are the alpha channel, controlling opacity from 00 for fully transparent to FF for fully opaque. The converter reports that as a decimal between 0 and 1 in the rgba output.
Yes. Each digit in the shorthand form is doubled, so #FFF expands to #FFFFFF and #F90 expands to #FF9900. The shorthand only works when both digits of each pair match.
No. Upper and lower case hexadecimal digits mean the same thing. Many teams standardise on one for tidiness, but browsers accept both.
Because it maps to how people describe colour. Raising lightness gives a tint, lowering it gives a shade, and dropping saturation mutes the colour, all without touching the hue.
This tool converts one code at a time so it can validate each properly. For a palette, convert each colour and copy the values as you go.
If the hex to rgb converter is not quite what you need, these other free tools solve closely related problems.
Enter R, G and B values and get the matching HEX and HSL colour.
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.
Pretty-print and validate JSON, with the exact line and column of any error.
Encode any text, including emoji and accents, to a Base64 string.