Skip to content

Color Converter

Enter a color as hex, rgb(), or hsl() and get all four formats at once, plus the WCAG contrast ratio against a background color you choose — so you know whether text on it actually passes AA or AAA before you ship it.

  • hex, RGB, HSL and HSB at once
  • Accepts hex, rgb() or hsl() as input
  • Live WCAG contrast ratio
  • AA / AAA pass-fail, not just a number
  • Runs fully client-side

Converter

Converted locally, nothing uploaded

Aa

hex

rgb

hsl

hsb

WCAG contrast

How to convert a color and check its contrast

  1. 01

    Enter a color

    Paste it as hex (#3366ff), rgb(51, 102, 255) or hsl(225, 100%, 60%) — any of the three is recognized automatically.

  2. 02

    Read the other formats

    The remaining three formats update immediately from whichever one you typed.

  3. 03

    Pick a background to check against

    Set the background color your text will actually sit on, and the contrast ratio updates live.

  4. 04

    Check the WCAG result

    AA requires at least 4.5:1 for normal text (3:1 for large text); AAA requires 7:1. The tool tells you which level, if any, the pair passes.

Why the same color has four different-looking representations#

Hex and RGB describe exactly the same information — red, green and blue intensity — just written differently: #3366ff and rgb(51, 102, 255) are the identical color, one in base-16, one in base-10. HSL and HSB (also called HSV) re-parameterize that same color around hue, and are usually easier for a human to reason about: "make it a bit darker" is a one-number change in HSL's lightness, but a three-number change in RGB.

HSL and HSB are close cousins that get confused for each other constantly. Both start with hue and saturation; the third value means something different in each — HSL's lightness runs from black through the pure hue to white, while HSB's brightness runs from black up to the pure hue and stops there. The same hue and saturation can produce a visibly different color under the two models once the third number moves.

What the contrast ratio actually measures#

WCAG's contrast ratio compares the relative luminance of two colors — how much light they reflect, not how they look — on a scale from 1:1 (identical) to 21:1 (pure black against pure white). It is a formula applied to the sRGB values, not a subjective judgment, which is exactly why it can be computed rather than eyeballed.

AA (the level most accessibility audits and legal requirements target) needs 4.5:1 for normal text and 3:1 for large text (18pt+, or 14pt+ bold). AAA is stricter: 7:1 and 4.5:1 respectively. A color pair that looks fine to someone with typical vision can still fail AA outright — contrast deficiency is common enough that "looks fine to me" is not a reliable substitute for the number.

A pitfall worth knowing: contrast is not commutative in effect, but the ratio is#

The WCAG ratio itself is symmetric — swapping foreground and background gives the identical number, since it is just a ratio of two luminances. What is *not* symmetric is how a design reads: light text on a dark background and dark text on a light background at the same ratio can feel different to read for long stretches, even though they pass the same numeric threshold. The ratio tells you pass or fail; it does not replace actually looking at the result.

Frequently asked questions

What is the difference between HSL and HSB/HSV?

They share hue and saturation but define the third value differently. HSL's lightness runs from black through the color to white; HSB's brightness runs from black up to the full color and stops. The same hue and saturation values can look like different colors between the two once the third number changes, which is why converting between them is not a simple relabeling.

What contrast ratio do I need to pass WCAG AA?

4.5:1 for normal-sized text, or 3:1 for large text (18pt and above, or 14pt and above if bold). AAA, the stricter level, requires 7:1 and 4.5:1 respectively.

Does swapping the foreground and background change the contrast ratio?

No — the ratio itself is symmetric, since it is a comparison of two luminance values regardless of which one is labeled foreground. It can still be worth checking both directions visually, since equal-ratio pairs do not always feel equally easy to read.

Can I paste an rgb() or hsl() value directly, or does it need to be hex?

Any of the three works as input — hex, rgb(), or hsl() are all recognized automatically, and all four formats (including HSB) are shown from whichever one you paste.

Is my color data sent anywhere?

No. All conversion and contrast calculation happens in your browser using JavaScript. Nothing is transmitted, logged or stored.

Developers

UUID Generator

Generate cryptographically random UUID v4 or time-ordered UUID v7, in bulk.

Developers

Base64 Encoder & Decoder

Encode and decode Base64 with correct UTF-8 handling, including the URL-safe alphabet.

Developers

ULID Generator

Generate ULIDs — sortable by creation time like UUID v7, but Crockford Base32 instead of hex.