Color Converter

Convert HEX, RGB, HSL, HSV, CMYK and OKLCH in real time, with alpha kept intact.

Convert as you type. HEX, RGB, HSL, HSV, CMYK, OKLCH and OKLab are supported.

Preview
HEX
#4F46E5
RGB
rgb(79, 70, 229)
HSL
hsl(243.4, 75.4%, 58.6%)
HSV
hsv(243.4, 69.4%, 89.8%)
CMYK
cmyk(65.5%, 69.4%, 0%, 10.2%)
OKLCH
oklch(51.06% 0.2301 277)
OKLab
oklab(51.06% 0.0279 -0.2284)
Auto text color
#FFFFFF

All conversions run locally in your browser, so color values are never uploaded. Results are rounded for display.

How to use

  1. Paste or type any color value in the input box. HEX, rgb(), hsl(), hsv(), cmyk() and oklch() all work.
  2. While the value is valid, every format below refreshes at once, and the large swatch shows the current color.
  3. Click Copy next to a row to take that single value, or click Copy all formats to take every row at once.
  4. The color field on the right writes back to the input box and keeps the current alpha value.
  5. When the input is invalid, a red hint names the character that failed, and the caret jumps there on blur.

FAQ

Why are there so many ways to write one color?
HEX and RGB describe the same red, green and blue numbers, and CSS uses them most. HSL and HSV split hue, saturation and lightness or value, which makes tuning easier. CMYK maps to printing inks, and OKLCH is a modern perceptual space. The tool converts in one shared pipeline, so the color itself never changes.
What is the difference between HSL and HSV?
Both share the hue angle, and they differ in the other two values. In HSL, lightness at 100% is always pure white, and full saturation at 50% lightness is the most vivid color. In HSV, the value tracks how bright the color is, and 100% means the brightest form. Color panels often use HSV, while palette math often uses HSL.
How do I write a color with transparency?
An eight digit HEX adds two alpha digits after the six color digits, such as #10B98180. RGB and HSL accept rgba() or hsla() with a fourth value. HSV, CMYK, OKLCH and OKLab take a slash before the alpha value, as in oklch(51% 0.23 277 / 0.5). Alpha runs from 0 to 1, and the two HEX digits equal alpha times 255.
Can I print with these CMYK values?
No. The CMYK numbers here come from on screen sRGB values, with no print profile and no black generation step. For print work, separate the color with your target ICC profile in a design tool, then fine tune from these ratios.

How to use

  1. Type a color value

    Paste or type any supported color value. HEX accepts 3, 4, 6 or 8 digits, and rgb(), hsl(), hsv(), cmyk(), oklch() and oklab() are also accepted.

  2. Read every format

    Once the value is valid, the rows below refresh together. The large swatch shows the current color and the automatic text color.

  3. Copy what you need

    Use the Copy button on a row for one value. The Copy all formats button takes every row together with its label.

  4. Pick or roll a color

    The color field on the right writes back into the input box and keeps alpha. Random color gives you a quick starting point.

  5. Fix an invalid value

    A red hint names the character that failed. The caret moves to that character when the input loses focus.

About this tool

The page runs seven common color notations through one conversion pipeline. Whatever you type, the tool resolves it into red, green and blue channels plus an alpha value, then derives every other format with published formulas. sRGB and linear light are linked by the standard transfer curve. OKLab and OKLCH use the matrix coefficients published by Björn Ottosson. HSL and HSV follow their textbook definitions. Because a single pipeline feeds all outputs, the rows stay consistent with each other, and nothing leaves your browser.

Alpha survives the whole chain. The last two digits of an eight digit HEX and the fourth argument of rgba() describe the same alpha. The number after the slash in oklch() is that same alpha again, and the tool carries it into every output row. A checkerboard sits behind the preview, so semi transparent colors read correctly. The label on the swatch switches between black and white by relative luminance, and the row shows the resulting contrast ratio. That helps you judge whether text stays legible on the color.

How it works

Red, green and blue values on screen are not proportional to light. The sRGB transfer curve is nearly linear in the shadows and close to a 2.4 power curve in the highlights. Mixing, gradients and perceptual math usually start by converting the channels to linear light. This tool does that step before OKLab and relative luminance, using the IEC 61966-2-1 threshold of 0.04045 and the 2.4 exponent. HSL and HSV work on the sRGB numbers themselves. The two models simply read those numbers differently.

OKLab turns linear sRGB into cone like responses with a matrix, then applies a cube root. That cube root is what makes its lightness far more even than HSL. OKLCH simply swaps a and b for polar chroma and hue, which reads closer to design intuition. The CMYK output uses a plain conversion. It takes the black component first and then scales cyan, magenta and yellow from what remains, with no print profile and no black generation. Screen and ink gamuts do not overlap, so treat those ratios as an on screen reference rather than a separation.

When to use it

  1. Front end color work

    A design file hands you HEX, but your CSS variables use OKLCH or HSL. Paste the source value and every notation appears at once. Copy the format you need, drop it into the stylesheet, and check the result without switching between tools and tabs.

  2. Check a print handoff

    A printer sends CMYK ink ratios and you need to know how they read on screen. Paste the values, compare the HEX and RGB rows against the original artwork, and see where the screen preview and the print expectation drift apart.

  3. Build a theme ramp

    For even light and dark steps, place a few levels by OKLCH lightness first. Then convert each level to HEX for your style tokens, so the scale stays predictable as the theme grows. Later tweaks stay in one place. Copy the finished ramp into a variables file so the next theme starts from the same steps.

Tips & tricks

  • Type a partial value, and the rows update the moment the syntax becomes valid.
  • For dark mode work, set OKLCH lightness first, then tune chroma and hue.
  • Eight digit HEX is the shortest way to keep alpha in a handoff or a CSS variable.

Things to watch

  • CMYK is not press color

    Screen gamut is wider than ink gamut, and no ICC profile is loaded here. Magenta and cyan usually print darker than this preview suggests, so separate the color with your print profile before you commit to a press run. Ink on paper also behaves differently from emitted light.

  • HSL lightness is not luminance

    HSL lightness averages only the largest and smallest channel, so yellow at 50 percent looks brighter than blue. For ramps and contrast checks, use OKLCH lightness or relative luminance instead. The two measures answer different questions, so pick the one that matches the job.

  • Eight digit HEX support

    Older browsers may ignore eight digit HEX values. Use rgba() or hsla() when you need wide support, and check the browsers your project targets. The tool omits the alpha digits when alpha equals 1, so the output stays short. Keep a plain six digit fallback when in doubt.

Related Tools