Compare one solid foreground with one explicit background
Start with an opaque color pair
This tool converts a supported HEX, RGB or HSL foreground and compares it with a solid opaque HEX background. It returns representations and a computed contrast ratio with threshold labels. Select the source format explicitly and provide the actual background you want checked. Leaving the background blank in the interface uses white. A color-pair result is useful for an early design check, but it does not inspect a whole page, discover an image beneath text or determine every state a component can enter. Keep those broader layout and accessibility questions separate.
A practical task is checking a candidate text color against a known flat surface before building a component. Use the foreground and background from that specific state rather than substituting a nearby shade from a design file. Transparent layers, gradients and images are not supported by this calculation. A button can also change color on hover, focus or disabled states, and those pairs need their own assessment where relevant. Do not describe one successful default pair as proof that every state, screen or assistive technology requirement has passed.
The tool works with opaque sRGB-style channels under its documented syntax. It is not a full CSS parser and does not accept every modern color notation. HEX accepts the supported short or six-digit form; RGB uses whole channels; HSL uses the required numeric hue and percentage components. Choose the matching format rather than pasting a different notation and hoping for automatic detection. The output is text you can copy or download. It does not edit a stylesheet, publish a palette or test the real rendered component automatically.
Check black on white before comparing another pair
Checked synthetic input
Source format: HEX
Foreground: #000
Background: #ffffffExact observed output
HEX: #000000
RGB: rgb(0, 0, 0)
HSL: hsl(0, 0%, 0%)
Background: #FFFFFF
Contrast ratio (approx.): 21:1
Normal text AA (4.5:1): PASS
Normal text AAA (7:1): PASS
Large text AA (3:1): PASS
Large text AAA (4.5:1): PASSEnter short HEX #000 with white background #ffffff. The checked result expands the foreground to #000000, reports RGB channels all zero and HSL lightness zero, and gives a contrast ratio of 21:1. All displayed text-threshold rows pass for this particular pair. The checked example records the settings and complete output so the background is not lost from the reproduction. The diagram shows the pair and its numerical result, rather than suggesting that a color alone has one universal contrast score independent of its surroundings.
A second checked pair uses red #ff0000 on white. Its ratio is approximately 3.99847677:1. The normal-text AA row fails while the large-text AA row passes under the tool's thresholds. This demonstrates why a familiar, vivid color is not necessarily appropriate for ordinary small text on a given surface. It also shows why the threshold category matters. Do not relabel a large-text pass as an ordinary-text pass, and do not change a recorded result by rounding the displayed ratio to a convenient whole number before comparing it with a threshold.
Equivalent supported representations can describe the same foreground. The checked red RGB triple and hue 360 with full saturation and half lightness produce the same displayed red result; hue 360 is treated as zero in this profile. That is a useful conversion fixture, but it does not establish that every rounded representation can be converted repeatedly without change. Preserve the original channel values when precision matters. The tool displays rounded values while making its threshold decisions from unrounded internal values, so the printed representation and decision process should not be confused.
Understand the numerical and accessibility boundaries
The calculation converts the color channels to relative luminance and compares the lighter and darker values using the documented contrast formula. The result is a comparison of this foreground/background pair, not a measure of whether a page is pleasant, comprehensible or fully accessible. The displayed normal-text AA threshold is 4.5:1, and the large-text AA threshold is 3:1. Additional AAA rows are shown separately. Consult the applicable accessibility guidance and actual text size rather than using a passing row whose category does not match the component being reviewed.
Large text in the tool's guidance means at least 18 points for regular text or 14 points for bold text. A size that appears large in one screenshot may not meet that definition in the actual rendered context. Weight, antialiasing, neighboring content and other usability concerns also need appropriate review. This page does not certify WCAG conformance for a site or replace keyboard, semantic, zoom and assistive-technology checks. Keep the numerical pair assessment as one piece of evidence within that larger process rather than treating it as a complete accessibility verdict.
Unsupported inputs are rejected rather than clamped into an apparently usable color. The checked cases include alpha HEX, an RGB channel above 255 and a negative HSL hue. RGB channels must be whole integers in range, and HSL saturation and lightness need their supported percentage spelling. Background accepts only the supported opaque HEX form. These restrictions describe this interface's profile, not every color syntax available on the web. If a real design uses transparency or layered imagery, calculate and inspect the appropriate rendered context with tooling suited to that task.
Record a design decision with enough context
For a component review, record the source format, foreground, background, text-size category and result. Include the actual design state, such as default text on the primary surface, rather than a free-floating ratio without context. Use the exact output when comparing an implementation with a design specification. Copy and Download provide a local handoff of generated text, not a stylesheet change or a certificate. Check the actual component afterward so an inherited background, opacity or state rule cannot silently invalidate the pair that was originally tested.
For a palette exploration, compare a small set of deliberate pairs and keep their intended roles explicit. A color can work for a border or large label while failing for normal body text on the same surface. This tool does not choose the role for you or assess whether color is the only way information is communicated. Preserve meaningful text labels and other cues in the product. The diagram's numerical labels and accessible text explanation make its lesson available without requiring the reader to distinguish the swatches by sight alone.
For a failed check, retain the original pair and make one intentional change at a time. Recheck the actual category rather than selecting whichever row happens to pass. Do not promise that a small numerical improvement fixes every reading or interaction issue. The useful endpoint is a reproducible pair calculation with honest syntax, rounding and category qualifications. Full-page accessibility, real-device behavior, design quality, security and publication remain separate responsibilities, even when the local conversion and its contrast arithmetic are correct.
Supporting reference: Contrast guidance; this pair result is not whole-page certification.