Colour converter
HEX, RGB, HSL and CMYK — plus the contrast ratio that decides readability.
Output
Paste or type above to see the result here.
Your files stay on your device
This tool runs entirely in your browser. What you paste is processed on your device and is never sent to a server, so it is safe to use with tokens, keys and unpublished text.
How it works
- Paste a colour: #3b5bdb, #fff, rgb(59 91 219), rgba(59, 91, 219, 0.5) or hsl(228, 69%, 55%).
- Put one colour per line to convert a whole palette at once.
- Read the notations back, and the two contrast ratios under them.
- Copy what you need.
Frequently asked questions
- Which notations does it read?
- Hex in three, four, six and eight digits, rgb() and rgba(), and hsl() and hsla(), with values separated by commas or spaces and an alpha after a slash. Named colours like rebeccapurple are not read: there are 148 of them and they are a lookup table, not a conversion.
- What are the two contrast numbers for?
- They are the WCAG contrast ratios of your colour against white and against black, which is what decides whether text is readable on it. The thresholds worth remembering: 4.5:1 for body text, 3:1 for large or bold text, and 21:1 is the most there is (black on white). If neither number reaches 4.5, no text colour will be comfortable on that background.
- Is the CMYK exact?
- No, and no conversion in a browser can be. Real CMYK depends on the press, the ink and the paper, which is what a colour profile describes. The figures here are the straightforward arithmetic conversion, which is right for a rough idea and wrong for anything going to a printer — ask them for the profile.
- Why did my colour change slightly after a round trip?
- HSL is written in whole degrees and whole per cent, so converting to it and back can move a channel by a point or two. Where exactness matters, keep the hex.
- Is anything sent to a server?
- No. It is arithmetic, and it runs in this page.
Related tools
⛓ URL encoder / decoder Percent-encoding both ways, worked out as you type. ∿ Base64 Convert text to Base64 and back, with correct UTF-8 handling and an optional URL-safe alphabet. • UUID Generator Create UUID v4 or v7 identifiers in bulk, generated on your device with a secure random source. {} JSON Formatter Paste JSON, get it indented, minified or validated instantly. Your data stays on this page.