HEX, RGB, HSL, HWB, OKLCH and CMYK in both directions, with a contrast check
Runs in your browser. Nothing you type is sent anywhere. Updated on 24 Oct 2026.A colour can be written several ways and mean the same thing. HEX, RGB, HSL, HWB, OKLCH and CMYK convert in both directions here, and a contrast check says whether text on that colour clears the 4.5 to 1 ratio. Nothing leaves the page.
Type a colour into Colour in any format: a hex code, rgb(), hsl(), oklch() or a name such as teal.
Or open the colour picker beside the box and choose a colour by eye.
Read the HEX, RGB, HSL, HWB, OKLCH and CMYK rows, which update together.
Press the copy icon on the row you need, or Ctrl+Enter to copy the HEX value.
This color converter takes a colour in any common format and gives it back in all of them: HEX, RGB, HSL, HWB, OKLCH and CMYK. Type #2B59F5, rgb(43 89 245), hsl(227 91% 56%), oklch(55% 0.22 265), a CMYK value or a CSS name like teal, and every other format updates, with a live swatch, a picker and one-click copy.
Front-end developers use it to move a brand colour from a design file into CSS, to switch a palette to OKLCH so tints look even across hues, and to check that text is readable before a pull request. Designers use it to hand a print shop approximate CMYK numbers, and anyone can use the contrast panel to test a text colour against white, black or a background of their choice.
Contrast follows WCAG 2 exactly: the ratio is shown to two decimals, rounded down so a pair at 4.49 never looks like it passes, with AA and AAA marks for normal and large text. Translucent colours are blended over the background first. The tints and shades row mixes your colour with white and black in 10% steps; click any swatch to copy its hex.
OKLCH values outside the sRGB range are brought in by reducing chroma while keeping lightness and hue, and the tool says when that happened. CMYK is the simple formula without an ink profile, so treat it as a starting point and ask your printer for the final numbers. Everything runs in your browser; only your choice of the second colour is remembered.
Related tools: Number Base Converter, QR Code Generator, Slug Generator.
Paste the hex code, with or without the # sign, and read the RGB line. Each pair of hex digits is one channel from 00 to FF, which is 0 to 255 in decimal, so #FF5733 is red 255, green 87 and blue 51. Three-digit codes such as #F53 double each digit first, giving #FF5533.
WCAG 2 level AA needs at least 4.5 to 1 for normal text and 3 to 1 for large text, meaning 24 px regular or about 19 px bold. Level AAA needs 7 to 1 and 4.5 to 1. The checker shows the exact ratio and marks each level as pass or fail for the pair you entered.
OKLCH describes a colour by perceived lightness, chroma (colourfulness) and hue. Unlike HSL, equal lightness values look equally light across different hues, so palettes and hover states built in OKLCH look balanced. All modern browsers support oklch() in CSS, and this tool converts it to and from hex.
CMYK values here are approximate. The tool uses the standard formula that assumes perfect inks, but real printing depends on the press, the paper and the colour profile, and some bright screen colours cannot be printed at all. Use these values as a starting point and ask your printer to match against a proof.
Yes. rgba(), hsla(), the slash syntax such as rgb(0 0 0 / 50%) and 8-digit hex like #FF000080 are all read, and alpha is carried into every format that supports it. CMYK has no transparency. For the contrast check, a translucent colour is blended over the background before the ratio is calculated.
No. Conversions run in your browser. The colour you are editing is not sent anywhere; only the second colour used for the contrast comparison is remembered on this device so the checker opens where you left it.
Still stuck? Ask about Color Converter and anybody who knows can answer. No account needed.
On the related tools: TSV to JSON – Convert tab-separated values, such as a paste from Excel, into JSON · CSV to Markdown Table – Convert CSV or TSV to a GitHub Markdown table with aligned columns and escaped pipes.
Also works as: RGB to HEX.
In the collection Developer Converters.