Color Converter
HEX โ RGB โ HSL with picker
Loadingโฆ
Was this tool helpful?
About this tool
Color Converter takes a single HEX code and turns it into RGB and HSL values along with a CSS-variable-friendly "R G B" notation (space-separated), all at once. For example, if you enter the indigo shown by default when the tool opens, #4f46e5, you get rgb(79, 70, 229), hsl(243, 75%, 59%), and "79 70 229" for CSS variables, all shown together.
How to use
- Click the color picker or type a HEX value directly (3-digit or 6-digit both work). The indigo shade (#4f46e5) is filled in by default when the tool opens, so you can see a result right away.
- RGB, HSL, and a CSS-variable-friendly notation (space-separated R G B) appear right below.
- The preview box background switches to that color, and the HEX code text inside the box automatically switches to whichever text color reads better against it.
- Click any of the six lightness variants of the same hue to switch to that color.
- Below the preview box, check whether white or black text has more contrast, and see the exact contrast ratio.
- Press "๐ฅ Play together" to invite someone by link and view the same color together, live.
Frequently asked questions
- What color formats does this tool support?
- It takes HEX (3-digit or 6-digit) as input and converts it to RGB, HSL, and a space-separated 'R G B' notation for CSS variables (as in rgb(var(--x) / 0.5)). Print formats like CMYK are not supported.
- How is the contrast ratio calculated?
- It computes each color's relative luminance using the WCAG formula, then pairs it against white and black backgrounds to get the contrast ratio. A higher number means more contrast and more readable text. The default #4f46e5 reads better against a white background, at roughly 6.3:1.
- How are the six lightness variants generated?
- They keep the input color's hue (H) and saturation (S) unchanged and only vary lightness (L) across 90/75/60/45/30/15% to build the six-step palette.
- Is the color value I enter sent to a server?
- No. All conversion and contrast calculation happens in your browser and is never sent to a server.
- Why does the preview box text color use a different rule than the contrast guidance below it?
- The HEX text inside the preview box switches to black or white based on a simple check of that color's own brightness, just enough to stay readable against it. The contrast ratio shown below serves a different purpose - it tells you whether that color reads better as text on a pure white or pure black background.
- What happens when I click a lightness variant?
- The input itself changes to that shade, so the RGB, HSL, and contrast results are all recalculated for the new color. To get back to the color you started with, you need to re-enter its HEX value.
- Where does the 4.5:1 figure come from?
- It's the minimum contrast ratio WCAG recommends for body text. If the ratio this tool calculates falls below 4.5:1, it's worth reconsidering that color for body copy.
- How is a 3-digit HEX (like #f00) handled differently from a 6-digit one?
- Each digit of a 3-digit HEX is doubled to expand it into 6 digits before conversion. For example, #f00 is treated the same as #ff0000.
- Can someone I invite also change the color?
- Yes. If someone who joined via the link changes the color, that change is reflected live so everyone sees the same color.