CSS techniques

Accessible CSS loading spinners (with copy-ready code)

A CSS loading spinner should animate only transform, announce itself to screen readers and respect reduced motion. Copy-ready code, the accessibility checklist, and when to show a spinner at all.

An accessible CSS loading spinner is a small element that animates only transform or opacity, sits inside a role="status" region with a text label such as “Loading”, and slows or stops its animation for people who prefer reduced motion. That gives screen reader users the same message sighted users get, keeps the animation smooth while the page is busy, and needs no image or JavaScript library. The CSS loader generator builds rings, dots, bars, pulses and progress lines with this built in.

Key takeaways

  • Animate transform and opacity only; they stay smooth while the main thread is busy loading.
  • Put the loader in a role="status" region with a text label so screen readers announce it.
  • Add a prefers-reduced-motion rule.
  • Don’t flash a spinner for very short waits, and use a real progress bar for long, measurable tasks.

How do you make a simple CSS spinner?

<div class="loader" role="status">
  <span class="visually-hidden">Loading…</span>
</div>
.loader {
  width: 40px;
  aspect-ratio: 1;
  border: 4px solid rgb(123 92 255 / .2);  /* track */
  border-top-color: #7b5cff;               /* moving part */
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin { to { transform: rotate(1turn); } }

@media (prefers-reduced-motion: reduce) {
  .loader { animation-duration: 3s; }
}

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

The ring is one element with a faint border all round and a coloured top border. Rotating it makes the coloured arc chase around the track. It is a few hundred bytes, sharp at any size, and inherits any colour you set.

Why animate transform instead of other properties?

Browsers can hand transform and opacity animations to the compositor, which runs separately from the main thread. When a page is busy parsing scripts and building layout, which is exactly when a loader is on screen, those animations keep running smoothly. Animating width, top or margin forces layout on every frame and can stutter just when people are watching it.

How do you make a loader accessible?

NeedHow
Screen readers know something is loadingrole="status" (a polite live region) with text like “Loading…”
The busy area is identifiedAdd aria-busy="true" to the region being updated, and remove it when done
Motion sensitivityA prefers-reduced-motion rule that slows or stops the animation
Completion is announcedReplace the loader with the result, or update the status text to “Loaded”
Colour contrastThe moving part needs 3:1 contrast against its background (WCAG 1.4.11)

The generator adds role="status" and an aria-label of “Loading”. Visually hidden text inside the region, as in the code above, is announced even more consistently across screen readers, so it is worth adding if your users rely on them.

Live regions: Live regions are announced when their content changes. Insert the status element into the page empty (or keep it in the page), then add the loader inside it, rather than injecting an already-filled region, or some screen readers will stay silent.

When should you show a loading spinner?

Response time research from Nielsen Norman Group sets three useful limits: about 0.1 seconds feels instant, about 1 second keeps the user’s flow of thought, and about 10 seconds is the limit for keeping their attention.

  • Under about a second: skip the spinner, or show it only after a short delay. A spinner that flashes for 200 ms makes the wait feel longer.
  • One to ten seconds: a spinner or skeleton screen reassures people that something is happening.
  • Longer, or measurable tasks such as uploads: show a real progress bar with a percentage, and let people cancel if possible.

For images, a loader is often the wrong tool. A blurred placeholder in the image’s own space feels faster; see BlurHash vs LQIP.

Spinner or skeleton screen?

A skeleton screen shows grey shapes where the text and images will appear, so the page looks like it is already arriving. It suits content that loads into a known layout, such as a feed, a product grid or a profile. A spinner suits actions with no layout to preview: submitting a form, saving settings or waiting on a search. Many apps use both, a skeleton for the first page load and small inline spinners on buttons afterwards. Whichever you choose, keep the same accessibility rules: a status message for screen readers and reduced motion for the shimmer animation.

Which loader style should you use?

StyleFeelsGood for
Spinning ringNeutral, familiarButtons, forms, general waiting
Bouncing dotsLight, conversationalChat, messaging, AI responses
BarsTechnicalDashboards, audio and data apps
PulseCalmBackground syncing
Progress lineDirectionalPage transitions, top-of-page loading

Around one second per cycle feels responsive without looking frantic. Match the colour to your brand, and keep it small: a loader only needs to be noticed, not admired.

Using loaders in WordPress and page builders

A loader needs its own HTML, so the generator’s “Paste into” menu outputs one snippet for your builder’s HTML or Code widget, with steps for Elementor, Divi, Bricks, Breakdance or the block editor. You show and hide it with your own code, for example while a form submits.

Make one

Pick a style in the CSS loader generator, set the colour, size, thickness and speed, and copy the HTML and CSS together. For a reading progress bar driven by scrolling instead of time, see scroll-driven animations.

Last checked: October 2026.

Sources: MDN: ARIA status role, Nielsen Norman Group: Response time limits, W3C: Understanding SC 1.4.11 Non-text Contrast.