How to Convert HEX, RGB and HSL Colours
Learn how to convert colours between HEX, RGB and HSL: one colour in three notations, and which format suits each task.
One colour, three ways of writing it
The same colour on a screen can be written as HEX, RGB or HSL, and the three formats describe exactly the same thing in different notation. The Color Converter translates between them instantly, in your browser, so you can take a colour from a design tool, a brand guide or a piece of code and rewrite it in whichever format your task requires.
Understanding the three formats saves a surprising amount of confusion. A designer hands you #c2540a, a developer asks for rgb(194, 84, 10), and a stylesheet uses hsl(24, 90%, 40%). Those are not three similar colours: they are one colour written three ways. Once you see that, converting stops feeling like guesswork.
HEX: the short code
A HEX code writes the red, green and blue values in hexadecimal, which is base 16, using the digits 0 to 9 and the letters A to F. Each pair of characters is one channel, running from 00 to FF, which corresponds to 0 to 255 in decimal. So #FF0000 is pure red: red at full strength (FF, or 255), green at zero, blue at zero. #000000 is black, #FFFFFF is white, and #c2540a breaks down as red C2, green 54, blue 0A.
HEX codes are not case-sensitive: #c2540a and #C2540A are the same colour. A three-digit shorthand also exists, where each digit is doubled: #39f means #3399ff. HEX is the most common format in brand guidelines and design files because it is compact and easy to copy, but it is hard to adjust by eye: you cannot look at #c2540a and tell whether making it lighter means changing the first, second or third pair.
RGB: the three channels
RGB lists the same three channels as decimal numbers from 0 to 255: rgb(194, 84, 10) is the same colour as #c2540a. Screens mix red, green and blue light, so RGB matches how displays actually work: start from black, add light in each channel, and all three channels at full strength make white. Equal amounts of all three make grey.
RGB is the format you will meet when a value comes from code, an image picker or a canvas, and it has a fourth-value cousin, RGBA, which adds transparency: rgba(194, 84, 10, 0.5) is the same colour at half opacity. Converting between HEX and RGB is exact and mechanical: split the HEX code into three pairs, convert each pair from base 16 to decimal, and you have the RGB values. Going the other way, convert each decimal channel to two hexadecimal digits and join them.
HSL: the human-friendly format
HSL describes the same colour using hue, saturation and lightness. Hue is an angle from 0 to 360 degrees around the colour wheel: 0 is red, 120 is green, 240 is blue. Saturation is how vivid the colour is, from 0% (grey) to 100% (fully vivid). Lightness runs from 0% (black) to 100% (white), with 50% giving the pure colour.
HSL is the format to reach for when you need variations of one colour. Keep the hue the same, raise lightness for a lighter tint, lower it for a darker shade, or reduce saturation for a muted version, and every variant stays in the same colour family. Doing the same thing in HEX or RGB means recalculating three channels and hoping the result still looks related. That is why designers often convert to HSL to build a palette, then convert back to HEX for the final values.
Converting in practice
In practice, nobody converts by hand more than once. Paste the value you have into the converter, copy the format you need, and paste it where it belongs. Before you paste, check which format the destination expects: a CSS file accepts all three, but a design tool's colour field, a brand template or a social platform's settings page may expect one specific format.
One rounding note is worth knowing. When HSL values are shown as whole numbers and converted back, the result can drift by a digit in one channel. If exact brand colours matter, convert from the original HEX or RGB value rather than from a rounded HSL display. For print, a converter gives you the screen equivalent only; a printed proof is still the way to check how it looks on paper. If you need a scannable code for that material, the Barcode Generator is the companion tool.
Why the same colour can look different
Conversion between HEX, RGB and HSL is exact: it changes the notation, not the colour. But the colour you see on screen can still vary between displays, because screens differ in brightness, calibration and colour settings. A colour that looks warm and rich on one monitor can look washed out on another, and phone screens often render colours more vividly than laptops.
That is a property of the display, not of the conversion, so do not "fix" it by tweaking the HEX value for one screen: you will only make it wrong on every other screen. Check important colours on more than one device, and if readability matters, check the contrast between text and background rather than judging by eye alone. For cleaning up text or values before pasting them into a design file, the Text Cleaner removes stray formatting that can otherwise break a pasted colour code.