Color Converter & Contrast Checker
Pick a color, copy it in any format, and check if text is readable on it.
Typing or picking a color in HEX, RGB or HSL
- Choose a color with the color swatch, or type directly into any of the three boxes: HEX, RGB or HSL.
- As soon as what you typed is complete and valid, the other two boxes and the swatch update to match. While you are mid-edit and the value is not yet valid, the other fields simply stay as they were.
- Copy the format you need into your stylesheet, design tool or document.
Accepted input: HEX with or without the # sign, in six-digit form (2563eb) or three-digit shorthand (26e, which expands to 2266ee); RGB as three numbers from 0 to 255 (surrounding text such as "rgb(" is ignored, so rgb(37, 99, 235) works); and HSL as hue 0 to 360 followed by saturation and lightness from 0 to 100. Eight-digit HEX codes with an alpha channel are not supported.
In short
HEX and RGB are the same three numbers written in different bases; HSL describes the same colour as hue, saturation and lightness. Typing rounded HSL values back can move a colour by a step or two, so copy HEX when the exact colour matters, and trust the Pass or Fail tile over a ratio that reads exactly 4.50:1.
Frequently asked questions
Which formats can I type in?
HEX (#2563eb or #26e), RGB (37, 99, 235) and HSL (221, 83%, 53%). Edit any field and the others follow.
Why does my HEX field not update when I type a few characters?
Fields update only when the input is a valid complete value. Three or six hex digits are valid; two, four or five are not. Finish typing and the other fields will follow.
Why does the color picker look slightly different from my design tool?
The picker is the one built into your browser and operating system, so its layout varies. The values themselves, the numbers in the three boxes, are standard and are what you should compare.
Do the pass results mean my page meets the accessibility standard?
They cover text contrast only. Accessibility also involves structure, keyboard use, text alternatives and more, so treat these results as one check among several.
Our test: if I copy the HSL numbers and type them back, how far does the colour move?
There are 16,777,216 possible HEX colours, and we pushed every one of them through the page's own conversion code in Chromium 153.0.8010.12: HEX to the whole-number HSL shown in the box, then that HSL back to HEX. For each colour we recorded the largest change in any one channel (red, green or blue, on the 0–255 scale). As a cross-check we typed 500 random colours into the HEX box, copied the HSL box into itself and read the HEX box again; this smaller sample gave similar figures (12.8% unchanged, none more than 3 steps off; a sample this size can miss the rarer worst cases). We also compared the white-text contrast ratio before and after each round trip.
| Largest channel change | Share of colours | Colours |
|---|---|---|
| 0 (unchanged) | 10.6% | 1,775,045 |
| 1 step | 54.4% | 9,123,320 |
| 2 steps | 32.1% | 5,378,472 |
| 3 steps | 2.9% | 485,168 |
| 4 steps | 0.09% | 15,103 |
| 5 steps | 0.0006% | 108 |
What it means: only about one colour in ten survives the trip exactly, but about 97 in 100 land within 2 steps, a difference few people will notice side by side. The worst case was 5 steps, for example #02e4e6 becoming #02dfe3. The shift can still matter at a threshold: for 82,470 colours (0.49%) the round trip flipped the AA result for white text. If a colour is near 4.5:1, check contrast with the exact HEX value, not one rebuilt from HSL.
Our test: when the tile reads 4.50:1, does the colour pass?
The ratio tile shows two decimal places, but the Pass and Fail tiles compare the unrounded ratio with the threshold, as WCAG intends. We wanted to know how often that leaves a ratio on screen that looks exactly on the line. With white text, and again with black text, we went through all 16.7 million background colours using the page's own ratio code and kept every colour whose ratio would display as 3.00:1, 4.50:1 or 7.00:1. We then entered each of those background codes into the Background HEX box in Chromium 157.0.8103.78, with a script setting the box the way typing does, and read the four tiles. For 200 of them per text colour, spread across the list, we typed the code key by key instead; those readings matched in all 400 cases.
| Text colour | Ratio on screen | Tile that decides | Backgrounds showing it | Says Pass | Says Fail |
|---|---|---|---|---|---|
| White | 3.00:1 | AA large text | 26,364 | 13,122 | 13,242 |
| White | 4.50:1 | AA normal text | 18,185 | 9,111 | 9,074 |
| White | 7.00:1 | AAA normal text | 8,168 | 4,102 | 4,066 |
| Black | 3.00:1 | AA large text | 19,098 | 9,534 | 9,564 |
| Black | 4.50:1 | AA normal text | 17,722 | 8,879 | 8,843 |
| Black | 7.00:1 | AAA normal text | 11,182 | 5,619 | 5,563 |
What it means: a ratio shown exactly on the threshold is close to a coin toss. In every row about half of the colours failed, because their true ratio was a little below the line, for example 4.4989:1 for white text on #0078d7, which the tile shows as 4.50:1 next to a Fail. Trust the Pass or Fail tile rather than the rounded number, and if a brand colour sits on the line, darken or lighten it by a step or two until the ratio clears the threshold comfortably.
Both result files are plain CSV with a header row:
- Counts for each text colour and threshold: columns text_colour, ratio_shown, tile, backgrounds_showing_this_ratio, tile_says_pass and tile_says_fail.
- Every background that showed 4.50:1 with a Fail on the AA normal text tile, for white and for black text: columns text_hex, background_hex, ratio_shown and aa_normal_text_tile.
More details
Contrast checker
About WCAG contrast
Accessibility guidelines (WCAG) require a contrast ratio of at least 4.5:1 for normal text at level AA, 7:1 for AAA, and 3:1 for large text. Higher contrast helps everyone, especially in bright light.
How HEX, RGB and HSL describe the same color
HEX and RGB describe the same thing. Each pair of hex digits is one channel in base 16, so #2563eb splits into 25, 63 and eb, which are 37, 99 and 235 in decimal: the red, green and blue amounts.
HSL describes the same color in a more human way. Hue is the position on the color wheel in degrees (0 is red, 120 green, 240 blue), saturation is how vivid it is, and lightness runs from black at 0% through the pure color at 50% to white at 100%. That makes HSL convenient for building variations: keep the hue and nudge the lightness to get a lighter hover state or a darker border. For example, hsl(120, 50%, 40%) converts to #339933, and pure red is hsl(0, 100%, 50%).
One thing to know: the HSL box shows whole numbers only. Converting #2563eb gives 221, 83%, 53%, but typing exactly those numbers back gives #2463eb, one step off in the red channel. This rounding is normal; keep the HEX value as your master copy and treat HSL as a convenient view.
Contrast ratio math and pass/fail thresholds
Contrast is judged separately from the converter, with its own text and background controls: a color picker plus a HEX box for each, so you can pick a color or paste a code. The tool calculates each color's relative luminance, a measure of perceived brightness that weights green most heavily, then takes the ratio (lighter + 0.05) divided by (darker + 0.05). The result ranges from 1:1 (identical colors) to 21:1 (black on white). Swapping text and background gives the same ratio.
The four tiles show the ratio and three pass/fail results:
- AA normal text: 4.5:1 or higher.
- AAA normal text: 7:1 or higher.
- AA large text: 3:1 or higher.
Examples: white text on the default blue #2563eb scores 5.17:1, which passes AA but fails AAA. Black on the same blue scores only 4.06:1, which fails normal-text AA even though black looks like the safe choice. White on yellow #ffff00 scores about 1.07:1, which is practically invisible. Mid-gray is a classic edge case: #777777 on white scores 4.48:1 and fails, while #767676 scores 4.54:1 and passes. The comparison uses the exact value, not the rounded one shown.
Handing off colors, checking buttons, building tints
- Moving a color between tools. Design apps often give RGB, CSS wants HEX or HSL, and brand guides may list only one of them.
- Checking button and link colors before publishing, especially light text on a colored background or gray text on white.
- Creating tints and shades by editing the lightness value in HSL and copying out the HEX.
- Documenting a palette with the same color in the formats your team uses.
Large text, flat colors and sRGB only
- Large text in WCAG means roughly 18 point regular or 14 point bold and above. Check your own sizes in the guideline itself before relying on the lower 3:1 threshold.
- Passing a ratio is a minimum, not a guarantee. Thin fonts, small sizes, patterned backgrounds and text over images can still be hard to read.
- The ratio is calculated for flat colors. It does not account for transparency, gradients, shadows or screen brightness.
- The contrast checker does not follow the converter. To test a color you typed in the converter, paste its HEX code into the Text or Background box of the checker.
- Colors are in the sRGB space used by web pages. Wide-gamut or print colors (CMYK) are outside what this tool converts.
- Do not rely on color alone to carry meaning, such as red for errors with no text or icon. Some visitors cannot tell certain hues apart.