Color Converter - HEX, RGB, HSL and WCAG Contrast

2on /
/ Dev Tools / Color Converter

Color converter and contrast checker

HEX, rgb(), hsl() or a CSS color name — all four are read.

HEX
RGB
HSL

Shades

The same hue at eleven levels of lightness. Click one to make it the current color.

Contrast

The ratio between two colors, measured the way WCAG defines it.

Pair Ratio AA (4.5:1) AAA (7:1)

What this tool does

Converting a color between notations is five lines of arithmetic. The harder question is whether text in that color can actually be read, and that answer needs a step most tools skip. Both are on this page, using the same color you typed.

How to use it

  1. 1 Type a color in any notation, or use the picker.
  2. 2 Copy the notation you need, or click a shade to move to it.
  3. 3 Read the contrast table. Anything marked Fail will be hard to read for someone.

Why the same hue looks different in HSL

HSL rounds to whole degrees and whole percents, so converting to HSL and back does not always return the exact byte values you started with. For that reason the HEX shown here is always derived from what you entered, never from a round trip through HSL — otherwise the field would drift by one step on every click.

What the contrast numbers mean

The ratio runs from 1:1 for two identical colors to 21:1 for pure black on pure white. The thresholds below are the ones the tool checks against.

4.5:1Normal body text, WCAG AA
3:1Large or bold text, WCAG AA
7:1Normal body text, WCAG AAA
21:1The highest possible ratio: black on white

The step most tools skip

Relative luminance is not the average of the channel values. Each channel has to be linearised first, because the numbers in a HEX code are gamma encoded rather than proportional to light. Skip that step and the ratio still comes out as a plausible number, just the wrong one, and the error is largest in the mid tones where most interface colors live.

Contrast is necessary, not sufficient

A pair can pass 4.5:1 and still be a poor choice: colour blindness makes some pairs indistinguishable even at high ratios, and colour alone should never be the only thing carrying meaning. Treat a pass here as clearing the floor, not as a verdict on the design.

Color converter - frequently asked questions

Three and six digit HEX, rgb(), hsl() and CSS color names. The names are resolved by asking your browser rather than from a list kept here, so the set stays current without anyone maintaining it.
New
Password Generator Generate passwords in your browser using your device's cryptographic random source, and see real strength in bits of entropy, not a coloured bar.
Popular Today
Password Generator Generate passwords in your browser using your device's cryptographic random source, and see real strength in bits of entropy, not a coloured bar.

Related Dev Tools

MD5 Hash Generator Free MD5 hash generator: turn any text or file into an MD5 checksum in your browser - useful for integrity checks and quick fingerprinting.
Base64 Encoder & Decoder Free Base64 encoder and decoder: convert text or files to Base64 and back, entirely in your browser - nothing is uploaded to a server.
Lorem Ipsum Generator Free Lorem Ipsum generator: create placeholder text by paragraph, sentence or word count, with optional HTML tags for your design mockups.
JWT Decoder Free JWT decoder: paste a token to read its header, payload and signature in a readable form - decoding happens in your browser, nothing is sent.
URL Encoder & Decoder Free URL encoder and decoder: convert links and query parameters to percent-encoding and back, with full-URL and component modes, in your browser.

Other Tools You May Like

Word to PDF Convert Word to PDF for free: upload a DOC, DOCX, ODT or RTF file and download a properly formatted PDF in seconds - no registration or watermark.
PDF to Word Convert PDF to Word for free: upload a PDF and download an editable DOCX in seconds - no registration, no watermark and nothing to install.
Word Counter Free word counter: paste any text to count words, characters, sentences and paragraphs, and see the estimated reading time - nothing leaves your browser.
Character Counter Free character counter: count characters with and without spaces, plus words and lines, and check SEO limits for titles and meta descriptions.
Keyword Density Checker Free keyword density checker: paste text or a URL to see how often each word and phrase appears, with percentages for one, two and three-word terms.