This is a DRAFT resource that supports Working Drafts of WCAG 3. Content in this resource is not mature and should not be considered authoritative. It may be changed, replaced or removed at any time.
🔙 WCAG 3.0 (Silver) Guidelines (Visual contrast of text)
Visual contrast of text
Provide sufficient contrast between foreground text and its background.
Get Started
Summary
Sighted users need good contrast between foreground and background to read easily. Users with low vision need strong contrast between foreground and background to perceive content.
Why
Many users need a high enough level of visual contrast to distinguish elements from each other and foreground from background. By visual contrast we mean the total perceived color and lightness difference between the text and the background. As text gets smaller and/or thinner, visual contrast may need to be increased to achieve the same readability.
EXAMPLE: you can increase perceived contrast by:
- Make the darkest of two colors darker
- Make the lightest of two colors lighter
- Increase the font weight (make it bolder, but letter spacing may need to be increased)
- Increase the font size (make it larger, but avoid letter spacing that is too tight)
- Use a different font design with intrinsically better contrast relative to the same x-size.
The use of color (hue/saturation) can help communication, but is does not replace the need for luminance (lightness) contrast. When using color it should align with the purpose of the content. Too many colors with no purpose can cause confusion. Using hue and saturation to help group related content can be useful. Certain color pairs should be avoided.
Some users find too much contrast in large/bold elements may be distracting or overwhelming due to glare or neurological issues.
This guidance focuses on the needs of all users as well as users with low vision or visual/neurological impairments, and including CVD (Color Vision Deficiency, commonly known as color blindness).
Who it helps
- People with color blindness need adequate luminance contrast to perceive text and graphic elements, and some color pairs require greater contrast than others to compensate.
- People with low vision (due to poor contrast sensitivity and/or visual acuity) may need higher visual contrast for readability. This is particularly true for those over 40, and also young children.
- People with some cognitive, language, and learning disabilities may benefit from the use of color and luminance contrast that is more homogenous, serving the purpose of the content such as grouping related items.
How
Authors need to balance font size, font stroke width, background color, font color, and nearby colors to achieve good visual contrast. Authors can use tools to evaluate elements that predict the needed visual contrast for a given font size and weight to achieve a presentation which meets these requirements.
The complex, interrelated nature of font and graphic elements to provide visual readability is aided by the use of the APCA algorithm (Advanced Perceptual Contrast Algorithm) which allows authors to input color pairs to find a predicted contrast value. That contrast value then defines the minimum useable font weight and size.
Plan
Planning responsibilities
- Because perceived contrast, and therefore readability, is tightly connected to font weight and font size. it is important to plan your CSS styles to provide predictable and consistent size and weight for the target display(s).
- This is particularly important for responsive designs that resize or reconfigure to different device resolutions.
- While designers are free to use any size units such as em, vw, calc(), etc., it is important for the calculated sizes as rendered meet or exceed the size values listed as px in the visual contrast chart.
- For non-standard fonts, compare the relative x height to the x height of a standard reference font, and adjust the font-size value for a match.
- The design of each font also plays a significant part in readability and perceived contrast. When planning, selected fonts should be compared against the
standardized
fonts in the visual contrast matrix. - The available useable colors to achieve readable visual contrast is largely constrained by font weight & font size. Alternately if a specific color palette is required, the color palette may limit the minimum font weight & size.
- The needs of font weight, size, and color extends to readable text content in images.
- The colorspace standard for web content is sRGB. Images with other profiles may give unpredictable results.
- Plan to get images early in the design process so they can be evaluated and adjusted if needed
- A suggested best practice is to use textless versions of images and CSS compositing techniques to apply dynamic text over the image.
Tips for collaboration
The planning and design phases will often be very interactive, and it is important to maintain communication and understanding of the available range of colors, sizes, and weights early in the process to allow adjustments to meet design goals and client needs.
Planning for each stage
Consider early design wireframes
and the space allocated for various elements, and how this will affect the desired font size in the final design.
Determine early on if the site will be responsive, to dynamically adjust and work on all device sizes, or if it will use a mobile separate
paradigm. This choice will significantly affect font weight & size.
To simplify early planning, remember that smaller and thinner (light weight) fonts require greater contrast between the font color and the background. Conversely, a lower contrast can be used with larger and thicker fonts.
How to get started early
- Still to be developed. We will include this in a future working draft.
How to remediate
- Still to be developed. We will include this in a future working draft.
Design
Design responsibilities
- Smaller, lighter weight fonts require higher contrast colors.
- The CSS property
Font-Smooth:
should be set to auto (default), and notantialiased
.- This is especially true for normal weight fonts less than 24px, and light fonts less than 48px.
- The
antialiased
mode in font smoothing is actually a blending that reduces contrast by 30% or more. - If the faux
antialiasing
mode is to be used, take note that normal and thin fonts will need to have their CSS colors set to a 30% higher APCA contrast.
- Certain color combinations can be very problematic on a computer monitor or mobile device.
- Never rely on hue alone for differentiating details. Adequate luminance contrast is required.
- The green in a monitor makes up the vast majority of luminance (light), so it will usually be a significant part of the lighter colors.
- Pure blues should typically be the darkest of two colors
- To use blue as the lighter of two colors, green needs to be added, otherwise there will be insufficient contrast and poor readability.
- This is both due to the low contrast and due to the human eye seeing blue at a lower resolution than green and red.
- The nature of blue light causes it to focus at a different location on the retina than red, so a pure red and a pure blue may
shimmer
when next to each other. - In the example below: Left, pure red (#F00) and a pure blue (#00D). Right, an equal amount of blue was added to the background which removes all detail from the blue channel.
BG #F00 TEXT #00DBG #E0D TEXT #00D - For many people, reducing or avoiding details in the blue channel can prevent chromatic aberration or shimmer.
- Pure red (#F00) text on a pure black (#000) background is the bare minimum contrast for a 16px 400 weight (normal) standard font.
- Different font designs affect perceived contrast and readability.
- While different font families use weights such as 400 or 700, those are not standardized in terms of contrast.
- Different families also vary in terms of x-height, so a 16px font in one family may be smaller or larger than a 16px font in another.
- Other font design attributes also create inconsistent perceived contrast between families.
- It is useful to visually compare a font family against the standard fonts used in the visual contrast matrix and take note of the differences in size, weight and the perceived contrast.
- When placing text in a container with a significantly different background color than the overall page, it is typically necessary to add padding around the text, so the eye can
locally adapt
to the text and container background. - Line spacing and letter spacing (leading and tracking), line length, and effects such as transparency and shadow all have an effect on perceived contrast and readability.
- Generally speaking, blocks or columns of text should be set to the highest contrast colors, especially for thin fonts. Contrast can be reduced for big bold headlines to reduce glare.
Designer tips
- Keep in mind that web content is displayed on a wide variety of display types, devices, and resolutions. It is important to test how content renders on different browsers and systems.
- If you normally work on a
retina
display it is particularly important to examine content on a normal display. - Different browsers and operating systems render content differently, especially features such as shadows and other effects.
- Don't rely on
developer mode, mobile emulation
in a desktop browser, verify with different actual devices.
- If you normally work on a
- The sRGB colorspace is the standard for web content, and the standard for accessibility. This should be the default colorspace, and any other colorspaces should be a selectable user option.
- Workspace is important. Variations in monitor calibration and ambient lighting will affect the final output. See the Develop Tab for details on workplace setup.
User testing and meaningful involvement
The need for a beta period for testing designs with the input of end users cannot be understated. During planning, design, and development, familiarity with user interface controls may obscure elements that an enduser finds non-intuitive. It is important to identify these stumbling blocks early in design.
In the context of visual contrast and readability, this includes features where the user can adjust color or theme, and where the user may want to adjust font size or line spacing on their end.
Develop
Technical responsibilities
- Still to be developed. We will include this in a future working draft.
Technical tips
- Javascript, PHP, and other dynamic page scripts must maintain the proper contrast and weight and size ratios.
- Ensure Javascript and other dynamic page scripts allow text to be scaled in size without breaking content, so that:
- User can scale the smallest content text five times larger on a full sized desktop screen without breaking content nor requiring horizontal scrolling for any single text element or text block.
- User can scale the smallest content text two times larger on a mobile device without breaking content nor requiring horizontal scrolling for any single text element or text block.
- User can scale the smallest content text five times larger on a mobile device without breaking content but horizontal scrolling is permitted in this use case.
- For all of the above, larger text does not have to increase by the scale amount, provided it remains larger than the smaller text that is scaled up.
- Ensure CSS style sheets, and inline styles do not use artificial font smoothing, and smoothing remains at default or
auto.
- The sRGB colorspace is the standard for web content, and the standard for accessibility. This should be the default colorspace, and any other colorspaces should be a selectable user option.
- The designer's workspace is important. Variations in monitor calibration and ambient lighting will affect the final output, often in unexpected ways.
- Use a hardware calibrator such as an XRite Display, and use software to calibrate the monitor to the sRGB standard.
- The ambient room lighting should be about 20% of the brightness of the monitor at peak white. For a monitor with a peak white of 160 cd/m2, the ambient should be around 64 lux.
- Put another way, setting the full screen to sRGB mid grey color #808080, the monitor should appear around the same brightness as the
overall
room lighting. - The color temperature of the room lighting should be 5500K, ideally with a CRI over 90.
- Don't paint the walls 18% grey. Instead, paint the walls pure white and set the lighting level so the white walls approximate the monitor at #808080 grey.
- And finally, avoid bright colors in the field of vision when looking at a monitor. Nearby colors can affect how you perceive the monitor content.
Examples
The examples over black or white are the font Montserrat at 16px normal (400 weight). The examples over yellow are 18px 200 weight, except the large text which is 32px bold. CSS font-smoothing is at default (auto). The last example is 18px and 300 weight, and shows the difference with font smoothing if supported by this browser.
Notice that the pure blue over black is very difficult to read. To use blue as the brightest of two colors, green must be added. Similarly, full green is hard to read against white, this is because green makes up the majority of luminance, or lightness.
Black background
#00F This is Maximum Blue on Black. Difficult to Read. ☆ ★ ◯ ♥ ☎
#08F Add some green for a readable blue against black. ☆ ★ ◯ ♥ ☎
#F00 This is Pure Red on Black, approximately -80% contrast. Some types of color vision problems cause the red to be ~35% darker (on sRGB) thus pure red is better as the darkest of two colors. ☆ ★ ◯ ♥ ☎
#0A0 This is Green on Black at -80% contrast. ☆ ★ ◯ ♥ ☎
White background
#0F0 This is Maximum Green on White. Difficult to Read. ☆ ★ ◯ ♥ ☎
#080 Keep green less than #080 for readability against white. ☆ ★ ◯ ♥ ☎
#E00 This is Pure Red on White, approximately 80% contrast. Since some color vision problems cause the red to be ~35% darker (on sRGB) pure red can be okay as the darker color against white. ☆ ★ ◯ ♥ ☎
#00F Full Blue on White is 110% contrast. Since the blue is the same value in the white background, there is no detail in the blue channel at all. This is advantageous as it can reduce glare and chromatic aberration. ☆ ★ ◯ ♥ ☎
Yellow background
This is Blue #009 very thin text on a #FE9 BG (120%). ☆ ★ ◯
This is #504 dark purple thin text (120% contrast on #FE9). ☆ ★ ◯
#79F (50% contrast on #FE9) is too light for small thin text, ☆ ★ ◯
but #79F is okay for large bold text.