Skip to content
MixTool

Color code converter

Type a color in any format and get every other format instantly — plus a contrast check for readable text.

  • Runs entirely in your browser
  • Free · no sign-up
  • Works on phone and desktop
Loading tool…

One color, every format

Designers hand over HEX codes, CSS wants rgb() or hsl(), print shops ask for CMYK and modern stylesheets use OKLCH. Enter a color in any of those formats — or a CSS name like tomato — and the converter shows it as HEX, RGB, HSL, OKLCH, HSV/HSB, CMYK and a decimal integer, each ready to copy.

Transparency is supported: an 8-digit HEX such as #3b82f680 or an rgba() value carries its alpha through to every format. Below the results, a WCAG contrast check shows how white and black text read on your color, so you can pick an accessible text color in seconds.

How to convert a color code

  1. 1

    Enter a color

    HEX, rgb(), hsl(), oklch(), cmyk() or a name — or use the picker.

  2. 2

    Read every format

    All conversions update as you type.

  3. 3

    Check contrast

    See whether white or black text passes WCAG.

  4. 4

    Copy what you need

    One click per format.

Key features

  • Seven formats

    HEX, RGB, HSL, OKLCH, HSV, CMYK and decimal.

  • Alpha support

    8-digit HEX, rgba() and hsla().

  • WCAG contrast

    Ratios and AA/AAA results for white and black text.

  • Color picker and random colors

    Explore visually when you don't have a code yet.

Common uses

  • Web design: Turn a brand HEX into HSL or OKLCH for CSS variables.
  • Print: Get approximate CMYK values for a designer or printer.
  • Accessibility: Choose text colors that meet WCAG AA.

Tips and good to know

  • OKLCH keeps perceived lightness even as you change hue, which makes it great for building color palettes.
  • CMYK values are approximate; printers convert using their own color profiles.
  • Turn two colors into a gradient with the CSS Gradient Generator.

Frequently asked questions

How do I convert HEX to RGB?

Split the six hex digits into three pairs and convert each from base 16 to base 10. #3B82F6 becomes 3B=59, 82=130, F6=246, so rgb(59, 130, 246). The converter does this instantly.

What is OKLCH?

A modern CSS color format based on how people perceive color: lightness, chroma (colorfulness) and hue. All current browsers support oklch().

What contrast ratio do I need?

WCAG AA requires at least 4.5:1 for normal text and 3:1 for large text. AAA raises that to 7:1 and 4.5:1.

Why don't CMYK values match my printer's?

Screen-to-print conversion depends on the paper and ink profile. The formula here is the standard approximation.