Loader & Spinner Tool

Keep your users engaged while your app thinks. Generate perfectly looping, single-element CSS loading animations without heavy image files.

<div class="loader"></div>
/* Generated on cssgen.org */

The Anatomy of a Pure CSS Loader

A loading animation serves a critical psychological purpose in UI design. By giving the user something active to look at, you reduce their perceived wait time and reassure them that your application hasn't frozen.

Our generator uses a "Single Element" architecture. Instead of cluttering your HTML with multiple spans or SVG paths, we rely on a single <div>. By cleverly utilizing the border properties and CSS @keyframes, we can create complex looping animations that render at a flawless 60fps.

⏳

Pro Tips for Loading States

  • Contrast is Crucial: When designing a "Classic Spinner", make sure the Secondary/Track color has very low contrast against your background, while the Primary Color has extremely high contrast. This draws the eye to the moving segment rather than the stationary circle.
  • The Full Screen Overlay: If you are loading an entire page or submitting a form, you often need an overlay to block user clicks. Wrap your generated loader in a container with position: fixed; inset: 0; background: rgba(0,0,0,0.5);.
  • Avoid the Jitter: We exclusively animate the transform: rotate() or transform: scale() properties in these loaders. If you ever try to build a loader that animates width or border-width, the browser will lag heavily on mobile devices.

Frequently Asked Questions

Why should I use a CSS loader instead of an animated GIF?

CSS loaders are vastly superior for performance. A GIF requires an extra HTTP network request, adds to your page weight, and often looks pixelated on high-resolution Retina displays. A CSS loader is instantly available, scales perfectly to any size, and consumes almost zero bandwidth.

How do you center a CSS spinner on the screen?

The most reliable way to center a loader over your entire viewport is to wrap the <div class="loader"></div> inside a container div, and apply these styles to the container: position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; display: flex; justify-content: center; align-items: center;.

Can I slow down or speed up the animation?

Yes. The speed is controlled by the duration parameter inside the CSS animation property. Changing animation: spin 1s linear infinite; to 0.5s will make it spin twice as fast, while changing it to 2s will make it spin twice as slow.