Convert
Convert a colour
One colour in, three notations and two contrast ratios out.
Accepts #rgb, #rrggbb, #rrggbbaa, rgb(), rgba() and hsl(), because those are the forms a colour arrives in when it is copied out of CSS, a design tool or a screenshot.
The contrast ratios use the WCAG 2.1 relative-luminance formula. 4.5:1 is the AA threshold for normal text, 3:1 for large text, and 7:1 is AAA. The numbers are the calculation itself rather than an approximation, so they match a contrast checker.
What it cannot tell you is whether the colour works: a ratio says nothing about legibility at 12 pixels on a phone in daylight, and nothing about colour blindness. It answers the one question it can answer exactly.
Questions
Is 4.5:1 a pass?
It is AA for normal-size text. Large text — 18.66px bold or 24px regular — passes at 3:1, and AAA needs 7:1.
Does transparency affect the ratio?
In reality yes: a transparent colour composites with its background. The ratio here is for the colour at full opacity.
Why is my HSL different from the design tool?
Rounding. Hue is reported as a whole degree and saturation and lightness as whole percent, which is how CSS usually shows them.
Is the colour sent anywhere?
No. Parsing and the formula both run in the page.
More text and code
- Word counterWords, characters, sentences and reading time, counted as you type.
- Case converterTitle Case, sentence case, camelCase, snake_case and the rest, at once.
- JSON formatterValidates JSON and prints it indented, with the parser’s own error.
- Base64Encode text to base64 and decode it back, UTF-8 safe.
- URL encoderPercent-encode text, or read what a %-encoded string says.
- Hash generatorSHA-256, SHA-1 and SHA-512 of any text, from the browser’s own crypto.
- UUID generatorFive version-4 UUIDs from the browser’s random source, ready to copy.
- Timestamp converterEpoch seconds, milliseconds, ISO 8601, UTC and your own time zone.
- Slug generatorA clean URL slug from any title, accents and punctuation handled.
- CSV to JSONRows to objects, with quoted commas, semicolons and tabs handled.
- Text diffTwo texts, line by line: what was added and what was removed.