Skip to content
CalculatorsRuns in your browser

Colour Converter

Convert between HEX, RGB, HSL, HSV and CMYK with a live preview.

Input
No upload needed — instant
Privacy
Nothing is uploaded
Cost
Free · no sign-up · no watermark

Loading tool…

The tool is loading its code on your device. This happens once and is cached for later visits.

Processed entirely on your device

Everything you type or paste is handled by JavaScript running in this tab. No request is sent, nothing is logged and nothing is stored. Close the page and it is gone.

Overview

About the Colour Converter

Free colour converter between HEX, RGB, HSL, HSV and CMYK. Includes a palette generator, contrast checker against black and white, and CSS-ready output.

Colour models are different coordinate systems over the same perceptual space, and converting between them is lossless only when both can express the colour. Understanding what each model is for explains why they disagree.

RGB — how screens work

A display produces colour by adding red, green and blue light. RGB is therefore an additive model, and its values describe a device instruction rather than a perception. CSS uses 0–255 per channel, which is 8-bit precision per channel and 16.7 million possible colours.

RGB's weakness is that it does not match human perception. The difference between (0,0,0) and (16,16,16) is far more visible than between (240,240,240) and (255,255,255), even though both are a distance of 16.

HEX — RGB written in base 16

#rrggbb is exactly the same information as rgb(r, g, b), expressed compactly for use in markup. There is no separate colour space and no conversion in the perceptual sense — it is a formatting difference.

HSL — designed for humans

Hue is the position on the colour wheel (0–360°). Saturation is the intensity, from grey to vivid. Lightness runs from black through the pure colour to white.

HSL is the model to reach for when you want to make a colour "a bit darker" or "less intense", because those operations map to a single component change. It is also how design systems generate a scale: hold hue and saturation, step lightness.

Its flaw is that lightness is not perceptual. Yellow at L=50% looks far brighter than blue at L=50%, so a scale generated by stepping lightness produces visually uneven results.

HSV/HSB — the colour picker model

Same hue and saturation as HSL, but Value is the maximum channel rather than the average. This is the model most native colour pickers use internally, because it maps cleanly onto the familiar cone or cylinder widget.

CMYK — how printers work

Printing subtracts light: cyan, magenta and yellow inks absorb red, green and blue respectively. Black (K) is added because mixing the three inks produces a muddy brown rather than a true black, and because black text is common enough that a dedicated ink is cheaper.

CMYK is device-dependent and gamut-limited. A saturated RGB blue simply cannot be reproduced in CMYK, and any conversion has to decide what to substitute. Without an ICC profile that decision is arbitrary, which is why on-screen CMYK previews routinely mislead.

Contrast and accessibility

The WCAG contrast ratio compares the relative luminance of two colours:

ratio = (L_lighter + 0.05) ÷ (L_darker + 0.05)

The 0.05 offset accounts for ambient light reflecting off a screen in a typical room. The result ranges from 1:1 (identical) to 21:1 (black on white).

Luminance itself is not a simple average of the channels. Each is linearised to undo the sRGB gamma curve, then weighted 0.2126, 0.7152, 0.0722 — because the human eye is most sensitive to green and least to blue. Averaging raw RGB values gives noticeably wrong results for yellows and cyans.

Practical workflow

  1. Pick a base colour in HSL, where adjustments are intuitive.
  2. Generate a scale by stepping lightness in consistent increments.
  3. Test each pairing you intend to use for text with the contrast checker.
  4. Where a pair fails, adjust lightness — not hue or saturation, which change the brand colour.
  5. Export as HEX for CSS, and as RGB or CMYK only when a specific downstream system requires it.

For serious colour work, consider OKLCH. It is a perceptually uniform space available in modern CSS, meaning equal numeric steps produce equal perceived steps — which HSL does not.

Step by step

How to use the Colour Converter

  1. Enter a colour in any format, or pick one from the colour field.

  2. Read the equivalent HEX, RGB, HSL, HSV and CMYK values simultaneously.

  3. Check the contrast ratio against white and black text.

  4. Explore the generated shades, tints and complementary palette.

  5. Copy any single value in CSS-ready syntax.

Why use it

Benefits and common use cases

What this tool is good for, and what it deliberately does not try to do.

Every format at once

Convert once and read all representations together — no cycling between input and output modes to compare HEX with HSL.

Accessible contrast checking

Computes the WCAG 2.1 contrast ratio against white and black and reports the AA and AAA pass levels, which is the check that actually decides whether a colour is usable.

Palette generation

Shades, tints, complementary, analogous and triadic schemes derived from the input, each ready to copy into a design token file.

Shorthand and alpha support

Accepts 3, 4, 6 and 8 digit HEX, named CSS colours, and rgba() or hsla() syntax with transparency.

Questions

Frequently asked questions

Short, honest answers about quality, limits and privacy.

What is the difference between HSL and HSV?

Both describe a colour by hue, saturation and a third dimension, but the third differs. HSV's Value is the brightness of the brightest channel — a fully saturated red has V of 100%. HSL's Lightness averages the brightest and darkest channels, so pure red sits at 50% and white at 100%. HSL is more intuitive for picking lighter and darker variants; HSV matches how the colour wheel is usually drawn.

Why does my CMYK conversion not match the printed result?

Because CMYK is device-dependent. There is no single RGB-to-CMYK formula — the correct conversion goes through an ICC profile describing a specific press, paper and ink set. A naive formula gives an approximation that can be visibly wrong, especially for saturated blues and greens that fall outside the CMYK gamut.

What contrast ratio do I need?

WCAG 2.1 AA requires 4.5:1 for normal text and 3:1 for text 18pt or larger (or 14pt bold). AAA requires 7:1 and 4.5:1 respectively. Non-text elements such as icons, borders and focus indicators need 3:1 against adjacent colours.

How is relative luminance calculated?

Each sRGB channel is divided by 255, then linearised: values at or below 0.03928 are divided by 12.92, and higher values are raised to the power 2.4 after adding 0.055 and dividing by 1.055. The channels are then weighted 0.2126 R, 0.7152 G and 0.0722 B — reflecting the eye's greater sensitivity to green.

Can I use 3-digit HEX everywhere?

Almost. #f0a expands to #ff00aa by doubling each digit, and is supported in all CSS contexts including SVG. It cannot represent colours whose channels are not repeated digits, so roughly 1 in 256 colours are expressible in shorthand. The 4- and 8-digit forms add an alpha channel.