Free tools • Fresh ideas
Colour Contrast Checker
Calculate WCAG contrast for two opaque HEX colours.
How to use the Colour Contrast Checker
Normal text needs 4.5:1 for AA and large text needs 3:1. Check hover and focus states separately. This calculation does not account for gradients, backgrounds beneath translucent colours or image variation.
Example input
#10244a
#ffffff
Compare the colours that render together
Choose the text or icon colour as the foreground and the surface immediately behind it as the background. For a website, obtain the actual rendered colours from the browser. The named colour token in a stylesheet can differ from the result when a component is disabled or when another CSS rule overrides its value. Test the default and active palettes separately. An accessible blue on a white page can become difficult to read on a light blue panel.
The ratio compares relative luminance, a measure that weights colour channels according to how people perceive brightness. A ratio of one to one means the two colours have the same luminance. Black and white produce the largest possible contrast for this calculation. Changing only the hue may look like a significant branding change while having little effect on how dark or light the text appears against its surface. Adjust the lightness while comparing each result in its real context.
Read the text thresholds correctly
The tool reports WCAG results for the two entered colours. Normal text needs a ratio of at least 4.5 to 1 at level AA. Large text can pass AA at 3 to 1. The lower threshold accounts for the larger letterforms, so check the actual font size and weight before relying on it. A heading visually styled as regular body text still needs the threshold appropriate to its rendered size. Check labels and explanatory copy at the size they actually use.
The higher AAA text thresholds are 7 to 1 for normal text and 4.5 to 1 for large text. Use the displayed result as evidence about the specific pair you entered. A matching ratio cannot explain whether a control is labelled, if text can be enlarged or whether the interface works with a keyboard. Those require their own checks. Some graphical objects, focus indicators and control boundaries also have relevant contrast requirements that differ from the normal text threshold.
Sample gradients and translucent layers
The two colour inputs model flat, opaque colours. If text sits above a translucent dark panel, the relevant background is the colour obtained after that panel is composited over what is behind it. Flatten a representative screenshot or inspect pixels at the expected position. If the image beneath the panel changes, test light and dark regions while thinking about where each line of text lands. A single centre sample can miss a bright edge that crosses the heading after a responsive crop.
Gradients pose a similar issue. Check the area the foreground occupies and look for its weakest contrast, then repeat after text wraps or the button changes width. An opaque surface behind text can make the pairing predictable if the artwork moves. Compare status variants as well. Red and green of similar brightness may provide little contrast between each other, so give status labels explicit words or an additional shape that communicates meaning independently of hue.
Record results as pairs
For a shared design system, write down which foreground goes with which background and record the tested state. A list of acceptable colours by itself provides no guarantee that all combinations work. Specify foreground, surface, size category and intended use. When you make a dark scheme, repeat the checks for that palette. If a hover state introduces a new colour, include the hover state in the same record.
Use Copy result to save the numerical result with the pairing. Then inspect the actual page at narrow widths and increased zoom. View links in their visited state and test the keyboard focus indicator. Small edits to tokens can affect several components, so keeping a short pairing list makes future reviews easier. It also helps distinguish an issue with the palette from one caused by opacity, a local override or a background image.
Related tools
Related guides
- How to Create Accessible Buttons With HTML and CSS
- How to Create a Dark Mode Toggle Using HTML, CSS and JavaScript