Developer Tools

Color Converter

Convert colors between HEX, RGB, HSL, HWB, OKLCH, HSV and CMYK, and check WCAG contrast.

Accepts #hex, rgb(), hsl(), hwb(), oklch() and CSS names like tomato.

HEX#2563eb
RGBrgb(37 99 235)
HSLhsl(221.2 83.2% 53.3%)
HWBhwb(221.2 14.5% 7.8%)
OKLCHoklch(54.61% 0.2152 262.9)
HSV / HSBhsv(221.2, 84.3%, 92.2%)
CMYKcmyk(84%, 58%, 0%, 8%)

Tints and shades (click to use)

Contrast checker (WCAG 2.2)

Background

Large text sample

Normal body text should stay easy to read.

5.17:1✓ AA normal text (4.5:1)✓ AA large text (3:1)✗ AAA normal text (7:1)✓ AAA large text (4.5:1)

About this tool

The same color can be written in many ways. Designers copy HEX codes from Figma, CSS accepts rgb(), hsl() and the newer oklch(), print workflows talk in CMYK, and color pickers often show HSV. This converter takes any of these, including CSS color names such as tomato or rebeccapurple, and shows every other format at once, ready to copy.

It also includes a WCAG contrast checker. Pick a text color and a background and you get the contrast ratio with pass or fail for the AA and AAA levels, plus a live preview. A strip of lighter and darker variants helps you build hover states and palettes from one brand color.

How to use Color Converter

  1. Type or paste a color, for example #2563eb, rgb(37 99 235), hsl(221 83% 53%) or a name like tomato, or pick one with the color swatch.
  2. Copy the format you need from the list: HEX, RGB, HSL, HWB, OKLCH, HSV/HSB or CMYK.
  3. Click a tile in the tints-and-shades strip to load a lighter or darker variant.
  4. In the contrast checker, set the background color. The ratio and the AA/AAA badges update instantly; use Swap colors to test light text on a dark background.

Examples

HEX to RGB and HSL

Input
#ff6347 (tomato)
Result
rgb(255 99 71) · hsl(9.1 100% 63.9%)

Grey text on white

Input
#767676 on #ffffff
Result
4.54:1 – passes AA for normal text

#777777 gives 4.48:1 and fails by a hair, a common surprise.

Short and alpha HEX

Input
#f00 · #00000080
Result
rgb(255 0 0) · rgb(0 0 0 / 0.502)

The last two hex digits are the alpha channel: 80 hex = 128/255 ≈ 50% opacity.

Which color format to use

  • HEX (#rrggbb): the most common way to share a color; compact and supported everywhere.
  • RGB: the same numbers in decimal; handy in code that computes colors.
  • HSL: hue, saturation and lightness. Easy to tweak by hand, but equal "lightness" values do not look equally light across hues.
  • OKLCH: a perceptual model supported by all modern browsers. Changing L changes perceived lightness evenly, which makes it the best choice for generating consistent palettes and dark themes.
  • CMYK: ink percentages for print. The values here are a simple mathematical conversion; real print output depends on the printer's color profile, so ask your printer for exact values.

WCAG contrast requirements

WCAG 2.x measures contrast as the ratio between the relative luminance of two colors, from 1:1 (identical) to 21:1 (black on white). Level AA, the usual legal and corporate target, requires 4.5:1 for normal text and 3:1 for large text (at least 24 px, or 18.66 px bold). Level AAA requires 7:1 and 4.5:1.

User-interface parts such as input borders and icons need at least 3:1 against their surroundings. If your text color has transparency, the checker blends it over the background first, exactly as a browser would display it.

Frequently asked questions

Everything you need to know about this tool and data security.

How do I convert HEX to RGB by hand?

Split the six digits into three pairs and convert each from hexadecimal to decimal: #ff6347 → ff = 255, 63 = 99, 47 = 71, so rgb(255, 99, 71).

Why does converting back and forth sometimes change a value by 1?

HSL, OKLCH and CMYK are rounded for display, and screen colors are whole numbers from 0 to 255. Converting a rounded value back can land one step away. The HEX value shown is always the exact color in use.

Is the CMYK value accurate for printing?

It is the standard naive formula, useful as a starting point. Professional printing uses ICC color profiles that account for paper and inks, so the final numbers will differ.

What does the alpha value mean?

Alpha is opacity, from 0 (fully transparent) to 1 (opaque). It appears as the 4th or 8th hex digit pair, or after a slash in rgb() and hsl().

Is my data safe when using this tool?

Yes, 100% safe. This tool operates entirely inside your web browser using client-side JavaScript and WebAssembly. Your data never touches any external server.