CSS loader generator

This CSS loader generator creates spinners, dots, bars and pulse indicators with @keyframes, transform and opacity, so you can preview the motion and copy the HTML and CSS.

A CSS loader is a pure-CSS loading indicator (spinner, dots or bar) that animates with @keyframes and needs no JavaScript or image; pick a style below, adjust it and copy the code.

#6366f1
#e5e7eb

Live preview

Loading…

HTML

<div class="loader" role="status" aria-label="Loading">
  <span class="loader-sr">Loading…</span>
</div>

CSS

.loader {
  width: 48px;
  height: 48px;
  border: 5px solid #e5e7eb;
  border-top-color: #6366f1;
  border-radius: 50%;
  animation: loader-spinner 1s linear infinite;
}

.loader-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

@keyframes loader-spinner {
  to {
    transform: rotate(360deg);
  }
}

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

How to add a CSS loader to your page

  1. Pick a loader style and set its size, colour, stroke and speed with the controls above.
  2. Copy the HTML into the element that shows the loading state, and the CSS into your stylesheet.
  3. Show the loader while data is loading, then hide or remove it when the content arrives.

Which loader style should I use?

StyleBest for
SpinnerButtons and inline waits
DotsChat and typing indicators
BarsAudio and data loading
PulseAvatars and placeholders
RingFull-page loading
ProgressTop-of-page loads

Making loaders accessible

  • Add role="status" to the loader container so assistive technology announces the loading state.
  • Give it an aria-label such as "Loading" and include visually hidden text for screen readers.
  • Wrap the animation in @media (prefers-reduced-motion: reduce) and slow or stop it for visitors who ask for less motion.

To tune the motion itself, open the CSS animation keyframes generator or the cubic-bezier generator.

Frequently asked questions

How do I make a loading spinner with only CSS?

Draw a square with equal width and height, give it a border and border-radius: 50%, then make one side of the border transparent. Animate transform: rotate(360deg) with @keyframes and the transparent gap becomes a spinning arc. No image or JavaScript is needed.

How do I center a CSS loader?

Put the loader in a flex container and set display: flex, align-items: center and justify-content: center on the parent, with a height such as 100vh for a full-page wait. For a loader inside a button or card, use margin: 0 auto on a block loader or place it in a grid with place-items: center.

How do I stop the loader animation for users who prefer reduced motion?

Wrap the animation in @media (prefers-reduced-motion: reduce) and either set animation: none or slow it down. Keep a static loading label visible so the state is still clear without movement, and never rely on motion alone to communicate progress.

Should I use a spinner or a skeleton screen?

Use a spinner for short, indeterminate waits such as a button submit or an inline fetch. Use a skeleton screen when you know the shape of the content that is coming, because it previews the layout and reduces the perceived wait. A progress bar suits longer loads where you can report a percentage.

More CSS generators

Color tools

Image tools

Image & SVG tools

Typography & units

More free tools

All free tools