How much contrast does a keyboard focus indicator need?

For a practical WCAG 2.2 Level AA target, a custom focus indicator should have at least 3:1 contrast against the adjacent colors so users can identify the focused component. Focus Visible at Level AA requires a visible indicator but does not itself define one universal thickness and contrast formula.
Non-text Contrast applies when the authored focus appearance is necessary to identify the component’s state. Evaluate the indicator against every color it touches. A blue outline may pass on a white card and disappear against a dark blue footer. A two-color indicator or contrasting gap can remain visible across mixed backgrounds.
WCAG 2.2 Focus Appearance at Level AAA adds a more specific measurement. An area at least as large as a two CSS-pixel perimeter of the unfocused component must show a contrast change of at least 3:1 between focused and unfocused states, subject to exceptions for unmodified browser indicators. Not every pixel of a larger indicator must meet the change requirement if the qualifying area does.
Use a design-system rule that is easier to test than a subtle background shift:
- a solid two- or three-pixel outline;
- enough offset to avoid merging with the control border;
- a color pair verified on every supported surface;
- a forced-colors style that uses system colors;
- no clipping by overflow or overlapping content.
Measure specified colors with a contrast tool, then confirm the rendered result at zoom and in real component states. Thin antialiased edges and shadows are difficult to judge reliably. A 3:1, sufficiently thick indicator is a defensible baseline, while a larger and more obvious treatment is often better for users.