Skip to main content

Color converter and contrast checker

Paste a color in any notation, or pick one from the swatch, and every other notation appears with a copy button next to it — plus the contrast ratio against a background, a scale of 11 shades and the usual harmonies.

runs in your browser · no request is made after the page loads

Every format the button puts it on the clipboard
HEX
—
HEX + alpha
—
RGB
—
RGB (CSS Color 4)
—
RGB %
—
HSL
—
HWB
—
CMYK
—
OKLCH ≈
—
CSS name
—
decimal (0xRRGGBB)
—
luminance (WCAG L)
—
WCAG contrast the color above is the text, the one below is the background; AA: ≥ 4.5 body / ≥ 3 large, AAA: ≥ 7 / ≥ 4.5
Large heading, 24px
Body text, 15px: offer, payout $42.50, geo DE/AT, 14-day hold.
small mono 12px · payout 42.50 · CR 3.8%
Verdict
—
contrast ratio
—
AA · body text (≥ 4.5)
—
AAA · body text (≥ 7)
—
AA · large text (≥ 3)
—
AAA · large text (≥ 4.5)
Shades 11 tones of the same hue from light to dark through HSL lightness; a click copies the HEX
Harmonies the hue rotated on the color wheel at the same saturation and lightness; a click copies the HEX

How to use it

  1. Type the color: #5be49b, rgb(91 228 155), hsl(148 72% 63%), hwb(), oklch() or a name such as rebeccapurple. The square next to the field opens the system color picker.
  2. Every notation appears on the right — HEX with and without alpha, RGB in three spellings, HSL, HWB, CMYK, OKLCH and the nearest CSS name. Each row has its own Copy button.
  3. In WCAG contrast set the background color to get the ratio and the AA and AAA verdicts for body and large text. The ⇅ button swaps text and background.
  4. Below that are 11 shades of the same hue and five harmonies — complementary, analogous, triadic, split complementary, tetradic. Clicking any swatch copies its HEX.

What the converter reads and what it returns

The tool accepts every color notation you meet in CSS, in a Figma file or in an ad account: short and long HEX (#abc, #aabbcc, #aabbccdd with alpha), rgb() and rgba() with commas or with spaces, hsl() and hsla(), hwb(), oklch(), and the 148 named CSS colors plus transparent. Everything comes back at once, so there is no mode to switch: HEX for CSS, RGB for Photoshop and Canva, HSL for building shades, CMYK for print, OKLCH for a modern design system.

CMYK is computed with the plain formula from sRGB, with no color profile involved. Accurate print work still needs the profile your printer uses, but for deciding whether a color will go muddy this is enough. OKLCH goes sRGB to linear RGB to OKLab by the formulas Björn Ottosson published in 2020; inside the sRGB gamut the result matches what the browser shows for the same value.

Why the contrast ratio matters

The contrast ratio is the relation between the luminance of text and background, from 1 to 21. WCAG 2.x asks for at least 4.5:1 for body text and 3:1 for large text (24px, or 19px bold) at level AA; level AAA is 7:1 and 4.5:1. This is not only an accessibility question. Google Ads and Meta reject creatives whose text cannot be read, and a grey disclaimer on a pale landing page that nobody can make out is grounds for an advertiser complaint. Check the button color against the banner background here before you upload twenty variants.

What the shades and harmonies are for

  • The shade scale — 11 tones of one hue from near-white to near-black, stepped through HSL lightness. Convenient for taking a background, a border and a hover state out of a single color instead of guessing by eye.
  • Complementary — the color opposite on the wheel (+180°): a contrasting accent for a CTA button on a brand background.
  • Triadic and tetradic — three or four evenly spaced colors, which is what charts and infographics need.
  • Analogous (±30°) is a quiet palette for backgrounds and secondary elements; split complementary is a softer version of the straight opposite.

Questions

How do I convert HEX to RGB?

Each pair of HEX digits is one channel byte: #5be49b gives 5b=91, e4=228, 9b=155, so rgb(91, 228, 155). The converter does it as you type and shows HSL, CMYK and the rest alongside.

Why does this CMYK differ from Photoshop?

Photoshop converts through an ICC profile, usually U.S. Web Coated or FOGRA; here it is the direct formula from sRGB with no profile. A few percent apart is normal — ask your printer which profile to use for the real thing.

What contrast does WCAG require for text?

AA: 4.5:1 for body text, 3:1 for large text (24px and up, or 19px bold and up). AAA: 7:1 and 4.5:1. Icons and the borders of controls should not go below 3:1.

What is OKLCH doing here?

OKLCH is a perceptually uniform notation — lightness, chroma, hue — supported by every current browser. Palettes are easier to build in it: a step of lightness looks the same size for blue as for yellow, which is not true in HSL. The converter computes it through sRGB, so treat the value as close rather than exact.

Does it know names like tomato and rebeccapurple?

Yes, all 148 named CSS colors and transparent. For anything else it shows the nearest name by distance in OKLab, marked with ≈.

Are the colors sent to a server?

No. Every conversion runs in JavaScript in your browser, and the page makes no network request once it has loaded.

Project sponsors

Companies that keep this analytics open