⏳ CSS Spinner & Loading Animation Generator
Generate CSS loading spinners and animated loaders. 6 types: spinner, dots, bars, ring, pulse, bounce. Customize color, size, speed. Copy CSS + HTML free.
Choose from 6 CSS animation types — spinner, dots, bars, ring, pulse, and bounce. Adjust color, size, and speed, then copy the CSS and HTML code ready to paste into any project. No images, no JavaScript — pure CSS animations.
How to Use
Choose a loader type
Click one of the 6 type buttons: Spinner, Dots, Bars, Ring, Pulse, or Bounce.
Customize appearance
Set the color using the color picker, adjust size with the slider, and set animation speed.
Copy the code
Click Copy Code to copy both the CSS and HTML markup. Paste into your project.
Frequently Asked Questions
Complete Guide: CSS Loader Generator
Loading indicators — spinners, progress bars, and skeleton screens — are a critical part of perceived performance. A well-designed loader reassures users that work is in progress and reduces abandonment. CSS-only loaders are preferable to JavaScript-driven animations because they run on the browser's compositor thread, remain smooth even when the main JavaScript thread is busy, and require zero JavaScript to function.
CSS Animation vs JavaScript Animation Performance
The browser renders frames in a specific pipeline: JavaScript → Style → Layout → Paint → Composite. Animating properties that require Layout (like width, height, top, left) or Paint (like background-color, border-color) forces the browser to recalculate the entire pipeline each frame, capping smooth animation at lower frame rates under load. Animating only transform and opacity skips Layout and Paint, going straight to Composite — enabling consistent 60fps animations.
The Classic CSS Spinner: Border Trick
The most popular pure-CSS spinner uses a single <div> with a circular shape and three transparent borders plus one visible border:
.spinner {
width: 40px;
height: 40px;
border-radius: 50%;
border: 4px solid rgba(0, 0, 0, 0.1); /* 3 transparent sides */
border-top-color: #3498db; /* 1 visible side */
animation: spin 0.8s linear infinite;
}
@keyframes spin {
to { transform: rotate(360deg); }
}
The border-radius: 50% makes the element circular. linear timing gives smooth, constant-speed rotation. Only transform is animated, keeping it compositor-only.
@keyframes vs animation Shorthand
The @keyframes rule defines the animation sequence. The animation property applies it. The shorthand order is: animation: name duration timing-function delay iteration-count direction fill-mode play-state. For loaders, you typically only need the first three:
animation: spin 1s linear infinite;
Spell out individual properties (animation-duration, animation-timing-function) when you need to change just one value without rewriting the full shorthand.
Timing Functions for Spinners
Use linear for spinners — constant speed looks natural for a continuous rotation. Easing functions like ease-in-out produce a stuttering effect as the spinner accelerates and decelerates each loop, which feels unnatural. Reserve easing functions for animations that have a clear start and end state, like a button press or a modal appearing.
Skeleton Loaders vs Spinners: UX Guidance
Spinners are best for short operations (under 3 seconds) where the final layout is unknown. A spinner provides generic feedback without committing to a layout. Skeleton loaders — grey placeholder shapes that mimic the expected content layout — are better for content-heavy pages (feeds, article lists, dashboards). Research shows skeleton loaders reduce perceived wait time and set better user expectations about content structure. Avoid using a full-page spinner for individual components that load at different times; a per-component skeleton is significantly less disorienting.
prefers-reduced-motion: Accessibility
Some users experience vestibular disorders that make spinning animations cause dizziness or nausea. Always wrap continuous animations in a prefers-reduced-motion media query to provide a static alternative:
@media (prefers-reduced-motion: reduce) {
.spinner {
animation: none;
border-top-color: #3498db;
opacity: 0.6;
}
}
For applying shadows and depth to loader containers, see the Box Shadow Generator. For a frosted-glass loader backdrop, try the CSS Glassmorphism generator.