Skip to content

Contrast for buttons, links, form fields and icons

The contrast rules reach past body text. Here's the ratio for buttons, form borders, icons, focus outlines and links, and what's exempt.

Checked 24 November 2026

Yes, the rules reach past body text. A button's edge, a form field's border and a menu icon all need to be seen, and WCAG gives them their own minimum: 3 to 1.1

The 3 to 1 rule for non-text parts

MDN states a minimum colour contrast ratio of 3 to 1 for user interface components and graphical objects.1 WebAIM's checker gives form input borders as an example, and says WCAG 2.1 asks for at least 3 to 1 for graphics and user interface components.2

Think of it this way. A sighted reader needs to find the box before they can type in it. If the border is a pale grey line on a white page, the box can all but disappear.

What to measure

A control usually has more than one part, and the ratio is measured against the colours next to it.

  • Button label. This is text, so it follows the text rules. Use the 4.5 to 1 minimum unless the label is big enough to count as large text.1
  • Button edge or fill. If the shape is what shows a reader it's a button, it needs 3 to 1 against the page around it.1
  • Form field border. Same again: 3 to 1 against the background.2
  • Icons that carry meaning. A search magnifier or menu symbol with no words beside it needs 3 to 1.1
Checking a controlList the parts: label, border, icon, outlineMeasure the label against its fillMeasure the border against the pageMeasure the focus outlineRepeat for hover and focus states
A control has several parts, and each part gets its own measurement.

An icon with a word beside it

WebAIM's example is a social media icon that's also a link. On its own, the icon needs 3 to 1. If the link also includes the name in readable text, the icon is no longer required to understand the content, so it has no contrast requirement of its own.3 The words still need to pass the text rule.

States count too

Hover, keyboard focus and other temporary changes are states. Each state of the component must also reach 3 to 1.3 A button that passes at rest but turns a pale colour on hover has a problem, even if you only see it for a second.

The focus outline, the line that shows where a keyboard user is, is the usual weak spot. WebAIM suggests using the CSS focus and outline properties to build a focus indicator that matches your design. Its aim is at least 3 to 1 against every background it appears on, including headers and footers.3

Browser defaults are exempt, but weak

If you use the default styles the browser provides, the contrast requirements don't apply.3 That sounds convenient. WebAIM points out that Chrome's default border on a text box has 2.4 to 1 contrast, which is below the line. It recommends using CSS to increase the contrast for text boxes and other form inputs.3

So the exemption exists, but the better move is to set your own border. Pick a dark enough grey and measure it.

What's exempt

MDN says the ratios don't apply to incidental text, such as inactive controls, logotypes or purely decorative text.1 A greyed-out disabled button is allowed to look faded. Real-life photos and screenshots also fall into the category where a particular look is essential.3

Links inside paragraphs

Links in a block of text are a special case. WebAIM's advice is to maintain the underline on links.3 If you remove it and rely on colour alone, two conditions must be met. One is 3 to 1 contrast between the link text and the body text. The other is a visual cue, not just a colour change, that appears on keyboard focus. WebAIM also recommends it on mouse hover, and says the most common way is to underline the link on hover and focus. Both come on top of the 4.5 to 1 text contrast requirement.3

Don't use colour alone for errors either. A red border on an empty required field is not enough on its own, and WebAIM says it also needs an icon or an inline message.3

For the measuring steps, see the checking guide.

Cited material

  1. Color contrast, MDN Web Docs, Mozilla
  2. Contrast Checker, WebAIM, Utah State University
  3. Contrast and Color Accessibility, WebAIM, Utah State University