🎨 Hex to RGB Converter
Convert hex to RGB and HSL, view each channel, and copy the matching CSS colour declarations.
Supports #FFFFFF, FFFFFF, #FFF, and FFF
Enter a HEX code above to convert it instantly
Or click the color swatch to pick from a visual color picker
Preview
Conversion Results
RGB
HEX (Normalized)
HSL
Channel Breakdown
CSS Usage
color: ;
background-color: ;
border-color: ;
--my-color: ; /* for rgba() usage */
Quick Color Presets
Click any swatch to load that color instantly
Related Tools
Color Palette Generator
Build a coordinated colour palette from a base shade and copy every hex code for CSS or design work.
Color Picker
Choose a colour and copy it in HEX, RGB, RGBA, HSL or HSV, with sliders for each channel.
Gradient Generator
Design linear, radial or conic CSS gradients with live preview and copy the generated background property.
QR Code Generator
Encode a URL or block of text as a QR code, choose its size and colours, and download the result as a PNG.
How hex digits become channel values
Shorthand works by duplication rather than by padding. In a three-digit code each digit is repeated, so #F30 expands to #FF3300, not #0F0300. The converter performs that expansion and displays the normalised six-digit form, which is worth checking when a design file hands you a mixture of both notations.
HSL is derived from the RGB values after scaling them to the range 0 to 1. Lightness is the average of the largest and smallest channel. Saturation is the difference between those two, divided by either their sum or by 2 minus that sum, depending on whether lightness is below or above 0.5. Hue is an angle determined by which channel is largest, measured in 60-degree segments around the colour wheel, and reported here in degrees.
Converting #FF5733 step by step
For HSL, scale the channels to 255ths: red is 1, green is about 0.341 and blue is 0.2. The maximum is 1 and the minimum is 0.2, so lightness is their average, 0.6, or 60 per cent. The difference between them is 0.8. Because lightness is above 0.5, saturation is 0.8 divided by 2 minus 1 minus 0.2, which is 0.8 divided by 0.8, giving 1, or 100 per cent.
Red is the largest channel, so hue is 60 multiplied by green minus blue divided by the difference: 0.341 minus 0.2 is 0.141, divided by 0.8 is 0.176, times 60 is about 11 degrees. The HSL value is hsl(11, 100%, 60%).
For comparison, the shorthand FFF expands to FFFFFF and converts to rgb(255, 255, 255).
Choosing the right notation for the job
HSL earns its place when you need to modify a colour rather than just state it. Because hue, saturation and lightness are separate, you can produce a hover state by lowering lightness by ten points while leaving the hue untouched, or build a whole tonal scale from one hue. Doing the same in hex means recalculating all three channels.
The comma-separated channel list in the CSS panel exists for a specific reason: writing rgba(255, 87, 51, 0.5) or storing the channels in a custom property lets you reuse one colour at several opacities without repeating the values.
Two cautions. Rounding means a hex to HSL to hex round trip can land a digit or two from where it started, so keep hex as your source of truth. These conversions also describe sRGB only, and say nothing about print, where a CMYK conversion noticeably dulls saturated oranges and blues.