What is a HEX to RGB converter?
A colour converter translates one colour between the notations used across design and development: HEX codes from a style guide, RGB values from an image editor, HSL from a CSS file, CMYK for print. They all describe the same colour, but tools and teams rarely agree on which to use.
Paste a colour in any CSS syntax, including transparency, and this converter shows every equivalent format. You can also edit the red, green and blue values or the hue, saturation and lightness numbers directly and watch all the formats and the swatch update together.
How to use the HEX ↔ RGB ↔ HSL Converter
1.Paste a colour
#hex (3, 4, 6 or 8 digits), rgb(), rgba(), hsl(), hsla() or a common name.
2.Read every format
HEX, RGB, HSL, HSV and CMYK, each with a copy button.
3.Fine-tune
Edit RGB or HSL numbers directly and every format updates.
Example: HSL with transparency
Pasting hsl(210 50% 40% / .5):
- HEX
- #33669980
- RGB
- rgb(51 102 153 / 0.5)
- Opacity
- 50%
The final 80 in the HEX code is 128 out of 255, which is 50% opacity.
How the formats relate
HEX and RGB both describe red, green and blue from 0 to 255; HEX simply writes each number as two hexadecimal digits. HSL describes the same colour as a hue angle, a saturation and a lightness, and HSV uses value instead of lightness, as many design tools do.
Transparency (alpha) is supported in eight-digit HEX like #33669980, and in the modern rgb(r g b / a) and hsl(h s% l% / a) syntax all current browsers accept. Rounding HSL to whole numbers can shift a colour by one step in RGB.
Frequently asked questions
How do I convert HEX to RGB?
Split the six digits into pairs and convert each from base 16: #2547d0 is 25 = 37, 47 = 71, d0 = 208.
What is an 8-digit HEX code?
The last two digits are the alpha channel. #33669980 is 50% opaque.
Which format should I use in CSS?
Any of them works. HSL makes it easy to create lighter and darker variants by changing one number.
What's a 3-digit HEX code?
A shorthand where each digit is doubled: #f60 is #ff6600.
Related tools
Colour Picker
Pick a colour and get its codes, tints, shades and harmonies.
Colour Contrast Checker (WCAG)
Check text and background colours against WCAG AA and AAA.
JSON Formatter & Validator
Pretty-print, minify, sort and validate JSON with line-numbered errors.
JSON ↔ CSV Converter
Convert JSON arrays to CSV and CSV back to JSON.
JSON to TypeScript Interface Generator
Generate TypeScript interfaces or types from a JSON sample.
JSON ↔ YAML Converter
Convert JSON to YAML and YAML to JSON.