Color Code Converter

Convert color codes between HEX, RGB, HSL, HSV and CMYK instantly. Enter any format to get all the others, with a live color preview and one-click copy for web design.

How to Use

  1. Enter a color code

    Input a color in HEX, RGB, HSL, or CMYK format.

  2. Convert

    Click Convert to see the color translated into all supported formats at once.

  3. Copy and preview

    Click any converted value to copy it. A color swatch preview is shown alongside the results.

What is color code conversion?

Color code conversion means expressing the same color in different notation systems such as HEX, RGB, and HSL. A display screen creates color by mixing the primary colors of light — red, green, and blue — so every color ultimately reduces to the intensity of three RGB channels. HEX compresses these RGB values into a six-digit hexadecimal string (#RRGGBB), while HSL reorganizes them the way humans perceive color, using a hue angle, saturation, and lightness.

Why conversion matters

  • Writing CSS — Take a HEX code from a design mockup and convert it to RGB, which makes adjusting opacity easier.
  • Color tuning — When you only want to darken a color slightly, converting to HSL lets you adjust just the L value.
  • Collaboration — Keep a designer's Figma HEX, a developer's RGB variables, and a print team's color references all in sync.

No matter which format you enter, this converter calculates every other format at once and shows the actual color in a live preview.

Conversion formula

HEX to RGB splits the hexadecimal string into two-digit pairs and reads each as a decimal number.

R = parseInt(hex[0:2], 16), and G and B are computed the same way. Example: #FF5733 → FF=255, 57=87, 33=51 → RGB(255, 87, 51).

RGB to HSL first normalizes each channel to a 0-1 range, then derives lightness.

L = (max + min) / 2
S = delta / (2 − max − min) (when L > 0.5)
where delta = max − min. In the example above, max=1 and min=0.2 give L = 0.6 (60%), S = 0.8/0.8 = 100%, and a hue angle of H ≈ 11°, converting to HSL(11°, 100%, 60%).

Frequently Asked Questions

What is the difference between HEX and RGB?
HEX expresses a color in hexadecimal (#FF5733), while RGB expresses the red, green, and blue values as decimals from 0-255 (255, 87, 51). They are two ways of writing the same color.
How do I convert a HEX code to RGB?
Split #RRGGBB into two-digit pairs and convert each from hexadecimal to decimal. For example, #FF5733 gives FF=255, 57=87, 33=51, so it becomes RGB(255, 87, 51). Each pair represents a channel intensity from 00 (0) to FF (255).
When should I use CMYK?
CMYK is the print color model that mixes cyan, magenta, yellow, and black inks. Screens and the web use RGB/HEX, which add light, while print production converts to CMYK, which layers inks. Because the two color gamuts differ, on-screen colors can look slightly different once printed.
What are the benefits of the HSL color model?
HSL is made up of hue, saturation, and lightness, letting you adjust colors intuitively. For instance, lowering only the lightness (L) value keeps the hue while easily producing a darker variant, which is handy for hover effects and building color palettes.
What do hue (H), saturation (S), and lightness (L) mean in HSL?
Hue (H) is an angle on the color wheel from 0 to 360 degrees, where 0° is red, 120° is green, and 240° is blue. Saturation (S) is color intensity from 0 to 100%: 0% is gray and 100% is the most vivid color. Lightness (L) is brightness from 0 to 100%: 0% is black, 100% is white, and 50% is the purest color.
How are white and black represented?
White has every channel at maximum: #FFFFFF / RGB(255, 255, 255) / HSL(0, 0%, 100%). Black has every channel at zero: #000000 / RGB(0, 0, 0) / HSL(0, 0%, 0%). Grays have a saturation (S) of 0% and differ only in lightness (L).
What happens if RGB values fall outside the 0-255 range?
Each channel is automatically clamped — values below 0 become 0 and values above 255 become 255 — before being converted to HEX. For example, RGB(300, -10, 128) is treated as RGB(255, 0, 128), which becomes #FF0080.
Can I copy the conversion results right away?
Yes. Click any converted HEX, RGB, or HSL code to copy it to your clipboard, and the color preview lets you confirm the actual color visually so you can paste it straight into CSS or a design tool.
2026 device specs

Related Calculators