Color Converter
Convert HEX, RGB, HSL, and HSV colors.
About this tool
Enter a HEX color and get the equivalent rgb() and hsl() values, ready for CSS. Both 6-digit (#1a73e8) and 3-digit (#fff) codes work, with or without the # sign. HSL values are rounded to whole numbers.
How to use
How it works
The hex pairs are read as red, green and blue from 0 to 255. HSL is then calculated from those: hue in degrees, and saturation and lightness as percentages, all rounded. A 3-digit hex is expanded by doubling each digit, so #fff is #ffffff.
Worked example
Google blue
- Input
- #1a73e8
- Output
- { "hex": "#1a73e8", "rgb": "rgb(26, 115, 232)", "hsl": "hsl(214, 82%, 51%)" }
- Walkthrough
- 1a is 26, 73 is 115 and e8 is 232 in decimal. The hsl value is rounded, so converting back may be off by one.
Limitations
- Input must be hex. rgb(), hsl() and named colors like tomato are not accepted.
- No alpha channel (8-digit hex) and no HSV output.
- Because HSL is rounded, round-tripping through it can shift a colour slightly.
Questions
How do I convert HEX to RGB?
How do I convert HEX to HSL?
Does it work with #fff?
Can I convert RGB to HEX?
Features
- HEX to RGB and HSL
- 3- and 6-digit hex
- Runs in your browser
Related resources
Guides and videos from around the web—opens on YouTube or the publisher’s site.
Learn JSON - Full Crash Course
freeCodeCamp.org
JSON is the payload format behind many developer tools here.
Watch on YouTubeWhat Is A RESTful API?
Traversy Media
API context for JWT, JSON, and encoding utilities.
Watch on YouTube
- Regular expressions
MDN
JS regex guide aligned with browser-based testers.
- MDN Web Docs
MDN
Primary reference for web APIs these developer tools touch.