Colour Converter

Type a colour in whatever notation you have it — `#663399`, `rgb(102 51 153)`, `hsl(270 50% 40%)`, or just `rebeccapurple` — and every other notation appears at once, ready to copy. Nothing is sent anywhere; the arithmetic happens in the page you are reading.

CMYK here is the standard nominal conversion. It is not colour-managed, so a printer will get a different value from their own profile.

  • Where it runs Nothing is uploaded, because there is no file — it is worked out in this page.
  • No queue, no account It answers as fast as your machine can, and it never asks who you are.
  • As often as you like Nothing is counted and nothing is capped — answering again costs us nothing.

How it works

  1. Type or paste your colour into the box. Hex with or without the hash, `rgb()`, `hsl()`, `hsv()` or a CSS keyword all work.
  2. Read the other notations underneath. Each one has a copy button.
  3. Adjust the value if you want to nudge it — the results follow as you type.
  4. Nothing is uploaded and nothing is stored. Close the tab and it is gone.

Why one colour has five different sets of numbers

HEX and RGB are the same thing written differently. `#663399` is three pairs of hexadecimal digits — 102, 51 and 153 — and `rgb(102 51 153)` is those numbers in decimal. Converting between them cannot lose anything, because nothing changes but the base.

HSL and HSV are the same colour described by a person rather than by a screen. Instead of how much red, green and blue to mix, they give the hue as an angle on a colour wheel, then how saturated it is and how light or bright. That is why designers reach for them: making a colour 10% lighter is one number in HSL and three unobvious ones in RGB. The conversion is exact in both directions, and the only reason the numbers here are shown to one decimal place is that a whole degree of hue is a visible step.

CMYK is the one that cannot be exact

Everything else on this page is a rearrangement of the same three numbers. CMYK is not: it describes ink on paper, and how a given mixture of cyan, magenta, yellow and black actually looks depends on the press, the paper, and the colour profile the printer works to. No formula has access to any of those.

What you get here is the standard naive conversion, which every tool that offers CMYK without asking for a profile is also doing. It is a reasonable starting point and a fine way to see roughly where a colour sits, and it is not a print-ready value. If the colour matters — a brand colour on packaging, anything that has to match across a run — the printer will want the RGB or the hex and will do the separation against their own profile. Handing them a CMYK value from a web page means handing them a guess and asking them to treat it as a specification.

Transparency, and where it survives

Alpha is carried through: `#663399cc`, `rgba(102, 51, 153, 0.8)` and `rgb(102 51 153 / 80%)` all mean the same colour at 80% opacity, and all three are read correctly. The eight-digit hex form is the one people meet least often and the one that trips up the most tools — it is simply the six-digit form with a fourth pair of digits for opacity.

CMYK has no equivalent, because ink either goes on the paper or does not. When the colour you enter is partly transparent, the CMYK figures describe the colour as if it were fully opaque, which is the only sensible reading.

The contrast figures, and what they are for

Underneath the notations are two numbers: the contrast ratio of your colour against white and against black. They come from the WCAG definition, which is not a simple brightness average — the channels are weighted, because the eye is far more sensitive to green than to blue, and each is linearised first to undo the curve that display values are stored with.

The practical use is deciding which text colour to put on a background. 4.5 is the threshold for ordinary body text and 3 for large headings, so a background whose better ratio falls below 4.5 is one that needs bigger text or a different background. It is the fastest way to find out that a brand colour which looks fine in a mockup will fail an accessibility audit.

What happens when the input is wrong

A colour that cannot be read is reported as unreadable rather than silently replaced. This sounds obvious and is unusual: the common way to build this page is to hand the string to the browser and read back what it computed, which is four lines of code and answers `#12345` with whatever colour was there before.

So a missing digit looks like a working conversion, and you find out when the shade is wrong somewhere else. Here the parsing is done explicitly, which costs a table of the hundred and forty-eight CSS keywords and gives you a complaint instead of a plausible wrong answer.

Colour Converter: common questions

Is my colour sent anywhere?

No. The conversion is arithmetic on three numbers and it runs in the page. Nothing is uploaded, nothing is logged, and there is no account. Unremarkable for a colour, and it is the same guarantee the rest of the site is built on.

Why is the CMYK different from the one in my design program?

Because your design program is converting through a colour profile and this page is not. Photoshop or Illustrator will use whatever CMYK profile the document is set to, and a different profile gives different numbers for the same colour — that is what a profile is for. Treat the figures here as an approximation and let the printer do the real separation.

Can I enter a colour name?

Yes. All hundred and forty-eight CSS keywords are recognised, including the awkward ones like `rebeccapurple` and both spellings of grey. `transparent` works too.

What is the difference between HSV and HSB?

Nothing. They are two names for the same model — value and brightness are the same axis. Photoshop calls it HSB, most code calls it HSV, and both spellings are accepted in the box above.

Does it work offline?

Once the page has loaded, yes. There is no request behind the conversion, so it keeps working if the connection drops.