A color converter helps you compare different numeric descriptions of the same color. Enter a CSS-oriented color value to see HEX, RGB, HSL, HWB, OKLCH, HSV, and CMYK representations together. The page also previews the result and calculates contrast ratios against white and black.
The conversion is useful for translating a design token, checking a value copied from developer tools, or choosing a notation for a stylesheet. The outputs are rounded for readability, so treat them as practical representations rather than color-managed measurements.
How to Use the Color Converter
Enter a supported color and copy the representation you need.
- Type a value in the Color input using HEX,
rgb(),hsl(),hwb(), or an alphabetic CSS color name such asrebeccapurple. - Alternatively, select a color with the Color picker; its HEX value is placed in the Color input.
- Check the Preview swatch to confirm the parsed color visually.
- Review the HEX, RGB, HSL, HWB, OKLCH, HSV, and CMYK rows.
- Read Contrast for the ratios on white and on black; for a translucent input, note that alpha is ignored in this calculation.
- Select Copy beside the output format you want.
Understanding the Supported Color Inputs and Outputs
The input parser accepts three-, four-, six-, or eight-digit hexadecimal values, with or without the leading #. Four- and eight-digit forms include alpha. It also reads legacy comma-separated and modern space-separated rgb() and hsl() forms, optional alpha separated by a comma or slash, and hwb(). Hue values may use degrees implicitly, turn, or rad; other angle units are not handled by this parser.
Alphabetic color names are resolved by the browser through a canvas before conversion. Names containing punctuation are not passed through that fallback, so the input is intentionally narrower than the complete CSS color grammar. The tool does not accept HSV, CMYK, or OKLCH as source formats even though it displays those formats as output.
For example, an alpha value can be supplied with modern RGB syntax:
rgb(29 78 216 / 0.5)
The generated HEX, RGB, HSL, HWB, and OKLCH strings preserve alpha when it is below 1. HSV and CMYK output do not include alpha. Numeric channels outside their expected ranges are clamped by the parser rather than rejected, and displayed values are rounded; converting the displayed result again can therefore introduce small differences.
Choosing Between HEX, RGB, HSL, HWB, OKLCH, HSV, and CMYK
HEX and RGB describe colors in the sRGB model and are convenient when matching existing web assets. HSL expresses hue, saturation, and lightness, while HWB expresses hue with whiteness and blackness. These cylindrical forms can be easier to edit by hand, but equal numeric changes do not necessarily look equally large to a person.
OKLCH is derived here by converting sRGB to linear RGB and then to OKLab. Its lightness, chroma, and hue coordinates are designed to be more perceptually useful than HSL for many adjustments. The tool reports an OKLCH description of the parsed sRGB color; it does not accept an out-of-gamut OKLCH color and map it back into sRGB.
HSV is widely used in color pickers, but hsv() is not a standard CSS color function. The CMYK row is also a mathematical conversion from the parsed RGB channels, not a printer-profile conversion. Ink, paper, rendering intent, and ICC profiles affect print output, so do not use this result as a substitute for a color-managed prepress workflow.
If you need a color inside an SVG background, the SVG to CSS converter can create a CSS data URI. Use the CSS beautifier when you need to format the stylesheet around the chosen value.
Contrast Ratios, Transparency, and Common Mistakes
The Contrast row applies the WCAG relative-luminance formula to the parsed red, green, and blue channels. It displays separate ratios against white and black, rounded to two decimal places. The number is a useful first check, but it is not a complete accessibility decision: text size, font weight, component state, and the applicable WCAG criterion still matter.
For translucent colors, the tool explicitly ignores alpha when calculating contrast. A half-transparent foreground is composited with its actual background before a user sees it, so its real contrast can differ materially from the displayed ratio. Composite the color against the intended background in a suitable design or testing workflow before relying on the result.
Another common mistake is assuming that two notations guarantee identical rendered color in every production context. This tool starts from an sRGB-like value, rounds output, and performs no ICC color management. Browser rendering, wide-gamut displays, print workflows, gradients, and blending can introduce context that a single converted value does not capture.
Local Processing and Safe Color Handling
Parsing and conversion run locally in your browser, and the entered value is not uploaded for processing. The tool uses this site's own color conversion code and the browser canvas only to resolve supported alphabetic CSS color names. It does not fetch a stylesheet, inspect a remote design system, or execute pasted CSS.
A color value is rarely confidential, but surrounding design tokens can reveal unreleased branding or internal product states. Copy only the output you intend to share, and avoid pasting an entire private stylesheet when one color value is enough. For large token migrations, automated parsing and visual regression tests are safer than converting values one at a time.
Frequently Asked Questions
Can I enter an OKLCH, HSV, or CMYK color?
No. This tool accepts HEX, rgb(), hsl(), hwb(), and alphabetic CSS color names. It calculates OKLCH, HSV, and CMYK as outputs only, so it is not a bidirectional converter for those three formats.
Does the converter preserve transparency?
HEX, RGB, HSL, HWB, and OKLCH output include alpha when the parsed alpha is below 1. HSV and CMYK output omit it. The color picker itself supplies an opaque HEX color, and the contrast calculation ignores alpha even when the text input contains transparency.
Is the CMYK result ready for professional printing?
No. The displayed CMYK value comes from a direct mathematical conversion of the RGB channels and does not use a printer, ink, paper, or ICC profile. Use a color-managed design application and the print provider's profile for production work.
Why did my color value change slightly after conversion?
The tool rounds channels for readable output, and several notations represent the same underlying color with different coordinates. Copying a rounded value back into the input can introduce a small numerical difference. Clamping can cause a larger change when an input channel was outside its normal range.
Is the displayed contrast ratio enough to prove WCAG conformance?
No. It compares the parsed RGB color with white and black using relative luminance, but it does not evaluate font size, weight, UI state, or your actual background. It also ignores alpha, so translucent colors require compositing before a meaningful conformance check.
References: W3C CSS Color Module Level 4 · W3C WCAG 2.2: Contrast (Minimum).