This contrast checker reads a foreground and a background and reports the WCAG 2 contrast ratio for opaque sRGB. Each channel is scaled from 0–255 to 0–1, linearized with the 0.04045 breakpoint, and combined as 0.2126 R + 0.7152 G + 0.0722 B. The ratio is the lighter luminance plus 0.05, divided by the darker luminance plus 0.05.
The ratio is shown to two decimal places. Pass or fail uses that displayed number, so the digits and the result cannot disagree. The four rows are always present: normal text AA at 4.5:1, normal text AAA at 7:1, large text AA at 3:1, and large text AAA at 4.5:1. Large text means 18pt regular or 14pt bold. This page does not measure font size, font weight, zoom, or a user stylesheet. You choose which threshold matches the text you ship.
Accepted syntax is the same closed set as the HTML Color Code Converter: hex, comma-form rgb(), rgba(), hsl(), and hsla(), plus that page’s named colors. The checker does not change the converter. It carries its own copy of those rules. oklch(), lab(), lch(), hwb(), color(), color-mix(), and relative color syntax are rejected. Space-separated rgb is rejected.
Missing alpha means opaque. Alpha exactly 1 is allowed, including rgba alpha 1, 100%, and an eight-digit hex whose alpha byte is 255. Any other alpha is an error. The page does not flatten transparency onto white or onto a third color. The swatches are painted from the opaque hex the parser produced, not from the raw paste.
An invalid color, an unsupported function, or a non-opaque alpha clears the ratio and the rows. A previous success is not left on screen. The page does not invent a ratio for a color it refused.
#000000 on #ffffff is 21.00:1. All four rows pass. The same color on itself is 1.00:1, and all four rows fail. black and white are the named colors from the converter table and produce the same 21.00:1 pair of hex values, #000000 and #ffffff.
rgb(255, 255, 255) and hsl(0, 0%, 0%) are accepted comma forms. rgba(0, 0, 0, 1) is opaque and allowed. rgba(0, 0, 0, 0.5) is an error. #0008 expands like the converter and is rejected because the alpha is not 1. oklch(0.6 0.1 30) is an error. transparent is not opaque.
A pass on this page means the displayed ratio met the threshold for that row. It does not mean a particular stylesheet, a zoomed browser, or a user font setting meets WCAG. Those depend on the page you publish.
The swatch is a plain element whose background is the parsed hex. The paste is never assigned to HTML. If Check fails, the swatches go away with the numbers.
WCAG 2 contrast for two opaque sRGB colors. Alpha must be 1. Transparency is not flattened. Large text means 18pt regular or 14pt bold. This page does not measure the font, zoom, or a user stylesheet. Not APCA. Not WCAG 3. Not a page audit. Named colors are the HTML Color Code Converter table. oklch(), lab(), lch(), hwb(), color(), color-mix(), and relative colors are rejected. Nothing is sent or stored.
No. Large text here means 18pt regular or 14pt bold. The page always shows normal and large results. You decide which row applies to your text.
WCAG 2 contrast here is for opaque sRGB. Alpha must be missing or exactly 1. The page does not composite a transparent color onto white or onto another background.
Yes. The ratio is rounded to two decimal places, and pass or fail uses that displayed number. The status does not use a longer hidden value.
No. This is WCAG 2 contrast, not APCA and not WCAG 3. oklch(), lab(), lch(), hwb(), color(), color-mix(), and relative colors are rejected.