Home/Tools/Developer Tools/Color Converter
Color Converter (HEX, RGB, HSL)
Developer ToolsAlso available as:RGB to HEXHEX to RGB
HEX
#4f46e5
RGB
rgb(79, 70, 229)
Processed in your browser. A copy of each run is saved to your past runs so you can reopen it. Privacy
What the Color Converter does
The Color Converter takes a color in any common notation (#4F46E5, rgb(79, 70, 229), hsl(243 75% 59%), a CSS name) and shows it in HEX, 8-digit HEX, RGB, RGBA, HSL, HSLA, HSV and approximate CMYK, plus a Tailwind class and a CSS custom property, each with a Copy button. A live picker, swatch and WCAG contrast ratios against white and black are included. It is for designers and front-end developers; it does not manage palettes or ICC profiles.
How to use it
- 1Type a color in the box in any notation, or click the swatch to open the picker.
- 2Every notation updates as you type: HEX, RGB, HSL, HSV, CMYK, named color, Tailwind and CSS variable.
- 3Press Copy next to the value you need.
- 4Check the contrast ratios against white and black and the WCAG level they reach before using the color for text.
Options explained
- Input notation
- Accepts 3-, 4-, 6- and 8-digit hex with or without #, rgb()/rgba() with commas or spaces and a / alpha, hsl()/hsla() with degrees, turns or radians, hsv()/hsb(), the 148 CSS color names, and bare triplets such as 79, 70, 229.
- Color picker
- Click the swatch to use the browser's native picker. It sets the hex input; alpha stays at 1 because the native picker has no alpha channel.
- Alpha
- Add a fourth value (rgba, hsla, #RRGGBBAA or / 50%) and the 8-digit hex, RGBA, HSLA and Tailwind outputs carry it. The swatch shows the color over a checkerboard.
- Copy as CSS, Tailwind or variable
- rgb() and hsl() values are written in the comma syntax every browser accepts. The Tailwind line is an arbitrary value (bg-[#4f46e5]); the CSS line is a custom property you can rename.
- Contrast check
- WCAG 2 contrast ratio of the color as text on white and on black. 4.5:1 or more passes AA for body text, 3:1 for large text, 7:1 for AAA. Use it to decide whether a brand color can carry text.
Common problems and limits
CMYK is computed with the simple formula (no ICC profile or black generation), so it is an approximation for a rough idea, not a print specification. Your print shop's profile will give different numbers.
The named color shown is the nearest CSS name; the row says 'closest match' when it is not exact.
Hue is rounded to the nearest degree and saturation and lightness to whole percent in the outputs, so converting HSL to hex and back can shift a channel by one.
Wide-gamut spaces (Display P3, OKLCH, Lab) are not supported; values are sRGB, which is what hex and rgb() mean on the web.
Who uses it
- Front-end developers: Turn a designer's hex into hsl() to build hover and active shades by adjusting lightness, or into a Tailwind arbitrary value.
- Designers: Check that a brand color reaches 4.5:1 on white before approving it for buttons and links.
- Ecommerce and marketing teams: Convert the hex from a brand guide into RGB for a product photo editor or into approximate CMYK for a packaging brief.
- Data visualization: Get consistent HSL values for a chart palette so every series has the same saturation and lightness.
- Students: See how one color is written in each system and why #0000FF, rgb(0, 0, 255) and hsl(240, 100%, 50%) are the same blue.
Frequently asked
Can I convert RGB to hex?
Yes. Type rgb(79, 70, 229) or just 79, 70, 229 and the HEX row shows #4f46e5. Each channel (0–255) becomes two hex digits: 79 is 4F, 70 is 46, 229 is E5. The dedicated RGB to HEX page starts in that direction.
How do I convert hex to RGB?
Split the six digits into three pairs and convert each from base 16: #4F46E5 is 4F=79, 46=70, E5=229, so rgb(79, 70, 229). Paste any hex above or use the HEX to RGB page.
What is the hex code for an RGB color?
A hex code is the three RGB channels written in base 16 and joined with a leading #. rgb(255, 0, 0) is #FF0000; rgb(0, 128, 0) is #008000. A fourth pair, if present, is the alpha channel.
How do I convert RGB to hexadecimal by hand?
Divide each channel by 16: the quotient is the first digit, the remainder the second, using A–F for 10–15. For 229: 229 ÷ 16 = 14 remainder 5, so E5. Do it for all three channels and prefix #.
What is #0000FF in RGB?
#0000FF is rgb(0, 0, 255): no red, no green, full blue. It is the CSS named color 'blue', hsl(240, 100%, 50%).
What is 11111111 in hexadecimal?
Binary 11111111 is 255 in decimal and FF in hexadecimal: four bits make one hex digit, and 1111 is F. That is why a full channel in a hex color is written FF.
How do I convert RGB to a paint color?
Screen colors (RGB) and paint are different media, so there is no exact conversion. Get the approximate CMYK here, then match it against a physical swatch book (Pantone, RAL or the paint brand's own fan deck) under daylight.
What is the hexadecimal equivalent of an RGB value?
Each RGB channel from 0 to 255 maps to a two-digit hex number from 00 to FF. The hexadecimal equivalent of rgb(r, g, b) is #RRGGBB where each pair is that channel in base 16.
Automation: an MCP tool convert_color(value, to) → {hex, rgb, hsl} and an n8n node are planned for this tool.