Color Converter

Convert CSS colors between hex, RGB, HSL, OKLCH, and Lab formats while previewing the selected color and its component values.

Preview
Hex
Hex alpha
RGB
HSL
OKLCH
Lab

How to use this color converter

Use this converter when the same color needs to move between CSS, design documentation, QA notes, or design-system tokens.

  1. Choose a format or leave the selector on auto-detect.
  2. Enter a CSS color name, hex value, RGB, HSL, OKLCH, or Lab value.
  3. Use the color picker when you want to start from a visual swatch.
  4. Copy the format you need for CSS, design tokens, documentation, or QA notes.

Color Converter features

  • Convert colors between CSS names, hex, RGB, HSL, OKLCH, and Lab.
  • Auto-detect the input format or choose the source color format manually.
  • Start from a typed CSS color value or the built-in color picker.
  • Preview the selected color in a large swatch.
  • Output standard hex and alpha-preserving hex values.
  • Output RGB, HSL, OKLCH, and Lab values for design and CSS workflows.
  • Copy individual converted color values with one click.
  • Select output values automatically when focusing or clicking them.

Color formats supported

Hex, RGB, and HSL are widely supported CSS color formats. OKLCH and Lab are perceptual color spaces, which makes them useful for modern design systems because lightness and chroma changes tend to behave more like people expect.

This is useful when a color comes from one tool but needs to be used somewhere else. A designer may hand off OKLCH values, a brand guide may list hex codes, a browser inspector may show RGB, and a CSS file may need HSL for easier manual adjustments. Seeing the formats together reduces the chance of copying the wrong value.

The preview swatch is included as a quick sanity check. It will not replace accessibility testing or device review, but it helps confirm that the parsed color is the one you intended before you paste it into production code or documentation.

  • Hex to RGB, HSL, OKLCH, and Lab
  • RGB to hex, HSL, OKLCH, and Lab
  • HSL to hex, RGB, OKLCH, and Lab
  • OKLCH to hex, RGB, HSL, and Lab
  • Lab to hex, RGB, HSL, and OKLCH
  • CSS color names to hex, RGB, HSL, OKLCH, and Lab

How this color converter works

The converter parses the input as a CSS color, converts the parsed value into each target color space, and rounds channel values for readable CSS output. Alpha values are preserved when the input includes transparency.

Color conversions are not just string formatting. Different spaces describe color in different ways: RGB describes channels of light, HSL describes hue with saturation and lightness, while Lab and OKLCH model color more closely to human perception. Moving between them can introduce tiny decimal differences, especially after rounding.

When browser compatibility matters, hex, RGB, and HSL remain the safest choices. OKLCH is helpful for modern CSS and design-system work, particularly when you want more predictable adjustments to lightness and chroma.

Color converter FAQ

Why do some converted values look rounded?
The tool rounds decimal channels so the output is easier to read and paste. Tiny rounding differences are normal when converting between color spaces.
Can I use OKLCH values in CSS?
Modern browsers support OKLCH, but older browser support may vary. Hex, RGB, and HSL remain safer when you need broad compatibility.
Does this upload my colors?
No. Color parsing and conversion happen in your browser.
Why does the same color have several different-looking values?
Each color format describes the same visual color with a different coordinate system. The numbers can look unrelated even when the resulting swatch is the same.

Convert color values without assuming they will look identical

A color notation describes coordinates in a color space. Hex and common rgb() values usually describe sRGB components, while HSL rearranges an sRGB color into hue, saturation, and lightness controls. Lab and OKLCH are designed around perceptual relationships. Converting the same color between them should preserve appearance only within the assumptions and gamut of the source and destination.

Display gamut creates an important limit. A color expressible in OKLCH or Lab may sit outside sRGB, so converting it to a hex value requires clipping or mapping. The resulting sRGB color can be less vivid or shift slightly. Keep the wider-gamut source value when the design system supports it, and inspect the fallback rather than trusting matching decimals.

Rounding also changes round trips. An eight-bit RGB channel has a finite set of values, while a percentage or floating-point notation can show more digits. Repeatedly converting and rounding can drift from the original. Save one canonical source value and generate other formats from it instead of using each output as the next input.

Hue is unstable near neutral colors. When chroma or saturation is close to zero, large changes in the displayed hue may make almost no visible difference. Do not interpret that hue number as meaningful for gray. In a design token system, name neutral roles by purpose—such as border or muted text—rather than by a nominal hue.

Alpha is separate from the opaque color. A translucent foreground blends with whatever is behind it, so its final appearance and contrast depend on the background. Preserve the alpha channel when the selected format supports it. For accessibility review, composite the color over the actual background before calculating contrast.

The CSS Color Module Level 4 specification defines modern CSS color functions and conversion details. Browser support and serialization can still vary, especially for newer spaces. Test the exact syntax in the browsers required by the project and provide an sRGB fallback when the support policy calls for one.

A numeric conversion cannot account for color management outside the browser. Image editors, printers, operating-system pickers, embedded profiles, and export settings may use different working spaces. For a brand or print job, agree on the source profile and proof the output on the intended device. A screenshot is not a dependable color reference.

After converting a palette, use the color contrast checker for foreground and background pairs. Contrast is only one accessibility property, but it catches failures that a visually pleasing conversion can introduce. Also review focus states, links, disabled controls, charts, and meaning conveyed by color.

Production checklist

  • Keep one canonical source value and generate rounded formats from it rather than chaining conversions that accumulate drift.
  • Identify the source color space, alpha, white-point assumptions, gamut, and destination support before comparing numbers.
  • Inspect out-of-gamut mapping in the actual browser and display; a valid hex fallback can be visibly less vivid than an OKLCH source.
  • Composite translucent colors over every real background before evaluating their appearance or contrast.
  • Test light and dark themes, focus and hover states, gradients, images, and disabled controls instead of reviewing a swatch in isolation.
  • Preserve profiles and proof on target devices when brand, photographic, or print color accuracy matters.
  • Document token role and fallback alongside the values so future editors know which representation is authoritative.

Built and maintained by utilkit. Updated . Found an issue? Send corrections to contact@utilkit.com

Related Blog Posts

View all