Focus Ring Generator
Design accessible :focus-visible indicators with real contrast checks and a live tab-through demo.
Ring builder
outlineCSS and preview
1/1 contrast checks passExamples
WCAG-safe outline
:focus-visible {
outline: 3px solid rgb(29, 78, 216);
outline-offset: 2px;
}A 3 px ring with a 2 px gap passes 3:1 non-text contrast on a white page.
Brand shadow ring
:focus-visible {
outline: 2px solid transparent;
outline-offset: 0px;
box-shadow: 0 0 0 3px rgb(124, 58, 237);
}The transparent outline is a high-contrast-mode safety net while the shadow carries the visual style.
Forced-colors fallback
@media (forced-colors: active) {
:focus-visible { outline: 2px solid Highlight; box-shadow: none; }
}Windows forced-colors mode drops box-shadow, so the fallback restores a visible system-color outline.
About this tool
Pick a focus indicator style and its color, width, offset and opacity. The tool emits a :focus-visible CSS block (optionally as tokens, with a scoped selector, a pointer-focus reset and a forced-colors fallback) and checks the indicator against the page background and the element surface. Translucent colors are composited in sRGB before luminance is computed. A split demo lets you tab through real controls on light and dark surfaces.
Everything runs locally in your browser — your inputs stay on your device and are never uploaded to a server.
What this tool does not do
- Processes only the inputs provided in this session without connecting to external accounts or background servers.
- Runs entirely in the current browser tab; nothing is synced across devices or backed up to a server.
How to use this tool
Pick outline, shadow, or dual ring
Customize ring color, width, offset, and surface colors.
Verify 3:1 WCAG contrast
Check computed contrast ratios on light and dark backgrounds and tab through the live demo.
Copy :focus-visible CSS
Copy production CSS including optional forced-colors high-contrast fallbacks.
Use cases
WCAG-safe outline
A 3 px ring with a 2 px gap passes 3:1 non-text contrast on a white page.
Brand shadow ring
The transparent outline is a high-contrast-mode safety net while the shadow carries the visual style.
Forced-colors fallback
Windows forced-colors mode drops box-shadow, so the fallback restores a visible system-color outline.
Common mistakes
Mistake:What contrast ratio does WCAG require for focus indicators?
Fix:WCAG 2.1/2.2 Non-text Contrast (1.4.11) and Focus Appearance guidance look for at least a 3:1 contrast ratio between the focus indicator and adjacent background colors.
Mistake:Why include a transparent outline when using box-shadow rings?
Fix:Windows High Contrast (forced-colors) mode strips box-shadow declarations; keeping outline: 2px solid transparent (or a @media (forced-colors: active) rule) preserves a visible system focus ring.
Frequently asked questions
Why prefer :focus-visible over :focus?
:focus-visible shows prominent focus rings for keyboard navigation (Tab, arrow keys) while avoiding persistent rings after routine mouse clicks on buttons.
What contrast ratio does WCAG require for focus indicators?
WCAG 2.1/2.2 Non-text Contrast (1.4.11) and Focus Appearance guidance look for at least a 3:1 contrast ratio between the focus indicator and adjacent background colors.
Why include a transparent outline when using box-shadow rings?
Windows High Contrast (forced-colors) mode strips box-shadow declarations; keeping outline: 2px solid transparent (or a @media (forced-colors: active) rule) preserves a visible system focus ring.
Does this guarantee full page accessibility compliance?
It verifies color math against the surfaces you test here, but real-world compliance also depends on tab order, focus traps, and variable page backgrounds.
Related tools
Aspect Ratio Calculator
Calculate dimensions and ratios for images and videos.
Border Radius Generator
Visually craft CSS border-radius values — including the advanced 8-value slash syntax for organic blob shapes — with a live preview and one-click copy.
Box Shadow Generator
Visual CSS box-shadow generator. Create beautiful shadows with live preview and copy the CSS code.
CSS :has() Selector Playground
Try the CSS :has() parent selector on live editable HTML and CSS, with ten patterns, dropped-rule detection and specificity notes.
CSS Button Generator
Design buttons with hover, active, focus-visible and disabled states — gradients, shadows, borders, icons — and copy clean CSS or Tailwind.
CSS Clip-Path Generator
Draw clip-path shapes visually: drag polygon points, tune circle/ellipse/inset presets, paste an SVG path and copy responsive CSS.