🎨 CSS & Design

CSS Loading Spinner Generator

Lightweight CSS loaders — choose one, colour it, copy it.

  • 12loader styles
  • 16–120pxsize range
  • 0.4–3 scycle speed
  • 0images or scripts

CSS


    

HTML


    

How to use the CSS Loader Generator

  1. 1

    Pick a style

    Click any tile in the gallery — ring, dots, bars, ripple, progress bar and more. All tiles animate live in your chosen colour.

  2. 2

    Set colour, size and speed

    Choose a brand colour, drag the size slider and set seconds per cycle. Lower numbers spin faster.

  3. 3

    Check the large preview

    The stage shows the loader at the exact size you set, so you can judge thickness and pace before copying.

  4. 4

    Copy both parts

    Copy the CSS into your stylesheet and the HTML wherever the loading state appears. The tool remembers your last pick.

Features

12 distinct designs

Ring, dual ring, gradient ring, bouncing dots, fading dots, pulse, ripple, bars, flipping square, orbit, progress bar and bouncing ball.

Proportional sizing

Border width, dot size and gaps are calculated from the size you choose, so a 24px and a 96px loader look balanced.

Status role included

The HTML snippet carries role="status" and an aria-label so assistive technology has something to announce.

Prefixed keyframes

Keyframe names start with the class name, such as loader-spin, to reduce clashes with your own animations.

Remembers your choice

The last loader you picked is stored in your browser and selected again next time.

Tiny output

Most loaders are one empty element plus a few CSS rules; the dot styles add only a few span elements.

Who uses it — and for what

Web apps

Button and panel spinners while an API call or form submit is in progress.

Online shops

A slim progress bar at the top of a checkout while the payment page loads.

Dashboards

Placeholder animations in chart cards before the data arrives.

Prototypes

Drop-in loading states for demos without adding an icon library.

Why CSS loaders?

A loader built from a few lines of CSS weighs almost nothing, scales perfectly on high-resolution screens, can be recoloured with one value and keeps animating even while JavaScript is busy (transform animations run on the compositor). That makes them better than GIFs or icon fonts for loading states. Every loader here uses a single class and at most a few child elements, and animates only transform and opacity.

Loading-state best practice

  • Show a loader only if a wait is longer than ~300 ms, otherwise it just flickers.
  • For long waits, prefer a progress bar or skeleton screen so people know something is happening.
  • Add role="status" and visually hidden text like “Loading…” so screen-reader users hear it — the generated HTML includes this.
  • Slow the animation down under prefers-reduced-motion.

Choosing the right loader for the wait

Each style sends a slightly different message, so match it to the situation rather than picking the prettiest:

SituationGood choiceWhy
Inside a button after a clickRing or dual ring at 16–20pxCompact, reads as “working” and fits beside or instead of the label
Whole page or route changeProgress bar across the topThin, out of the way and familiar from many web apps
Chat or typing indicatorBouncing or fading dotsPeople associate three dots with someone composing a message
Empty card waiting for dataPulse or ripple, centredSoft and calm in a large empty area
Known percentage completeNone of these — use <progress>All twelve loaders are indeterminate and cannot show real progress

Waits longer than a few seconds deserve words as well as motion — “Uploading 3 photos…” tells people far more than a spinner alone.

Accessibility, motion and performance details

The generated role="status" turns the element into a polite live region. For it to be useful, add it when loading starts and remove the loader (or change its label to something like “Loaded”) when it ends; a status region that sits on the page forever just adds noise. On the area that is still filling in, aria-busy="true" tells screen readers to wait before reading it.

The copied CSS has no reduced-motion rule, so add one yourself. For loaders, slowing down usually works better than stopping completely, because a frozen spinner looks like a crash:

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

On performance: all twelve styles animate only transform and opacity, which browsers can usually hand to the compositor instead of repainting. The flipping square adds a 3D perspective, and the gradient ring relies on mask with a conic gradient, which needs a reasonably recent browser. Every snippet uses the same class name, loader, and keyframe names such as loader-spin; if you paste two different styles into one project, rename one of them with find-and-replace so their keyframes do not overwrite each other.

Worked examples

Ring at 48px, one second per turn

The default Ring with colour #4f46e5 produces this CSS (border width is size ÷ 8 = 6px, and the track uses the same colour at 20% opacity):

.loader {
  display: inline-block;
  width: 48px;
  height: 48px;
  border: 6px solid rgba(79, 70, 229, 0.2);
  border-top-color: #4f46e5;
  border-radius: 50%;
  animation: loader-spin 1s linear infinite;
}
@keyframes loader-spin { to { transform: rotate(360deg); } }

HTML: <div class="loader" role="status" aria-label="Loading"></div>

Bouncing dots use negative delays

Choosing Bouncing dots at the same settings gives 12px dots with 8px gaps and a 1.4 s cycle. The first two dots get animation-delay: -0.3s and -0.2s. A negative delay starts the animation part-way through its cycle, so the dots are already out of step on the very first frame instead of all popping in together.

Indeterminate progress bar

Progress bar at size 48 is three times as wide (144px) and 4.8px tall, with a 40%-wide inner stripe that slides from translateX(-100%) to translateX(250%) every 1.5 s. The track has max-width: 100%, so it never overflows a narrow phone column.

Pro tips

  • Rename the class from loader to something specific, like btn-spinner, before pasting two styles into one stylesheet.
  • To recolour a loader for dark mode, change the one hex value and the matching rgba() track colour together.
  • Set the loader’s size in the tool rather than scaling it with transform: scale(), so border widths stay crisp.

Glossary

Indeterminate
A loading indicator that shows activity but not how much work is left.
Live region
Part of a page that screen readers announce when its content changes, such as an element with role="status".
aria-busy
An attribute that marks a region as still updating so assistive technology waits before reading it.
Negative animation delay
A delay below zero that starts an animation part-way through its cycle.

Frequently asked questions

Do these loaders need JavaScript?

No. Show or hide the element with your own code; the animation is pure CSS.

How do I centre the spinner?

Put it in a flex container with justify-content and align-items set to center.

Can I change the colour later?

Yes — change the colour value in the CSS (some loaders use currentColor, so the text colour works too).

Can I put a loader inside a button?

Yes. Pick a ring at about 16px, place the HTML inside the button, and disable the button while loading so it cannot be clicked twice.

Why do two loaders on my page interfere?

Every snippet uses the class loader and keyframes named loader-something. Rename the class and keyframes in one of them so the rules no longer overwrite each other.

Found it useful? Share the CSS Loader Generator:

Last updated 2026-11-28 · Built by Vinayak Agarwal · Part of CSS & Design (37 tools)