DevTools Pro · All tools · About

CSS Loading Spinner Generator

About the Loading Spinner Generator

This loading spinner generator creates pure CSS loaders in nine styles, from a classic circular spinner to dots, bars, ripple and wave. Set the size, color and speed, watch the live preview, and copy a small HTML snippet plus CSS that needs no JavaScript, images or icon fonts.

The nine spinner styles

Circular, Ring and Dual Ring are rotating borders: a single element turned with transform: rotate(). Pulse is one circle that grows and fades, and Ripple uses two expanding rings offset by half a cycle.

Dots fades three dots in turn, Bounce scales three dots up and down, and Bars and Wave stretch a row of vertical bars with scaleY(). For Bars and Wave you can choose 3 to 10 elements and the gap between them.

How the generated CSS works

Every spinner uses a single .spinner element and, for multi-part styles, plain child <div>s. Staggered animation-delay values on :nth-child() selectors create the wave effect, and negative delays make the motion start mid-cycle so there is no pause on first load.

Speed is a multiplier on the cycle time. At 1x the circular spinner completes one turn in 1s; at 2x it takes 0.5s. Every animation repeats with infinite.

Accessible loading indicators

Screen readers cannot see a spinning shape, so the generated HTML includes role="status" and aria-label="Loading". Change the label to describe what is loading, such as "Saving changes".

For users who prefer less motion, add @media (prefers-reduced-motion: reduce) { .spinner, .spinner * { animation-duration: 3s; } } or swap the spinner for static text.

When to show a spinner

Spinners suit short, unknown waits. For operations under about a second, consider showing the spinner only after a short delay so it does not flash. For long tasks with a known length, a progress bar tells people more.

Give the spinner's container a fixed size so the page does not jump when it appears or disappears.

How to Use the Loading Spinner Generator

  1. Choose a Spinner Type, a Color, and drag Size (20 to 100px) and Speed (0.5x to 3x). Stroke Width appears for Circular, Ripple, Ring and Dual Ring; Number of Elements and Gap appear for Bars and Wave. Random example fills in a random combination and Reset restores the defaults.
  2. Check the Spinner Preview, which renders the exact generated HTML and CSS in an isolated frame.
  3. Click the copy button to copy the CSS in a <style> tag plus the HTML, or Download to save a complete .html file you can open in a browser. Select the text in the HTML and CSS boxes if you only need one part.

Loading Spinner Generator Examples

Small red circular spinner for a button

Spinner Type Circular, Size 24px, Color #ef4444, Speed 1.5x, Stroke Width 3px.

Output:

<div class="spinner" role="status" aria-label="Loading"></div>

.spinner {
  box-sizing: border-box;
  width: 24px;
  height: 24px;
  border: 3px solid #f3f3f3;
  border-top-color: #ef4444;
  border-radius: 50%;
  animation: spin 0.67s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

Green dots loader

Spinner Type Dots, Size 48px, Color #10b981, Speed 2x.

Output:

<div class="spinner" role="status" aria-label="Loading">
  <div></div>
  <div></div>
  <div></div>
</div>

.spinner {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  width: 48px;
  height: 48px;
}

.spinner div {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #10b981;
  animation: dots 0.6s linear infinite;
}

.spinner div:nth-child(1) { animation-delay: -0.6s; }
.spinner div:nth-child(2) { animation-delay: -0.5s; }
.spinner div:nth-child(3) { animation-delay: -0.4s; }

@keyframes dots {
  0%, 80%, 100% { opacity: 0.2; }
  40% { opacity: 1; }
}

Purple pulse

Spinner Type Pulse, Size 64px, Color #8b5cf6, Speed 1x.

Output:

<div class="spinner" role="status" aria-label="Loading"></div>

.spinner {
  width: 64px;
  height: 64px;
  background-color: #8b5cf6;
  border-radius: 50%;
  animation: pulse 1s ease-in-out infinite;
}

@keyframes pulse {
  0% { transform: scale(0); opacity: 1; }
  100% { transform: scale(1); opacity: 0; }
}

Common Errors

The spinner appears in the top-left corner of my page instead of the middle.
The snippet does not position itself. Put it in a container with display: grid; place-items: center;, or use Download, whose file centers the spinner on the page.
The CSS shows as plain text, or has no effect, after pasting into a stylesheet.
The copy button includes <style> tags so the result works in an HTML file. For a .css file, copy only the text of the CSS box.
The circular spinner shows a light gray ring on my dark background.
The track color is fixed at #f3f3f3. Change that value in the border rule, or set it to transparent for a single arc.
The animation looks wrong after adding the snippet to an existing project.
The .spinner class and generic @keyframes names such as spin, pulse and bounce may already exist in your CSS. Rename them in both the selector and the animation property.
I cannot find a Stroke Width or Gap control.
Controls depend on the style: Stroke Width exists for Circular, Ripple, Ring and Dual Ring, and Number of Elements and Gap only for Bars and Wave. Dots, Bounce and Pulse have fixed shapes.

Frequently Asked Questions

Do these spinners need JavaScript?
No. They run on CSS @keyframes alone. Use JavaScript only to show or hide the spinner element.
How do I change the gray track on the circular spinner?
The circular style uses #f3f3f3 for the track. Edit the border color in the copied CSS, or set it to transparent for a single arc.
Will the keyframe names clash with my CSS?
They might. The output uses generic names such as spin, pulse and bounce. Rename them in both the @keyframes rule and the animation property if your project already uses those names.
How do I center the spinner?
Place it inside a container with display: grid; place-items: center; or display: flex with centered alignment.
Are CSS spinners bad for performance?
Not usually. Most styles animate transform and opacity, which browsers handle cheaply. Remove the spinner from the page once loading finishes so it stops animating.

Related tools