The CSS Loader Generator creates a pure-CSS ring spinner from standard borders and a 360-degree keyframe rotation, with overall sizes from 12 to 160 pixels and no image, SVG, JavaScript animation loop, or third-party package.
That makes it a visual-code generator rather than a loading-state system: the copied CSS animates an element, while the application still decides when to show it, what to announce, how to handle failure, and when to remove it.

What the CSS Loader Generator produces
The generated ring uses a straightforward CSS construction. Equal width and height create a square box, and a circular border-radius turns that box into a ring. The full border uses the track color, while border-top-color replaces one segment with the active color to suggest rotation.
The copied output contains a .loader class and a uniquely named @keyframes rule. The keyframe rotates the element through 360 degrees, while the animation shorthand applies the selected duration, linear timing, and infinite repetition. Together, those declarations create a continuous ring without an image file or script-driven animation.
- Geometry: A square element with a circular border forms the visible ring.
- Motion: A transform-based keyframe provides the full rotation.
- Dependencies: The result is CSS that can be pasted into an existing stylesheet without installing a package.
The preview is also a real status element: it uses role="status" and an aria-label, while drawing with the same dimensions, border, colors, and timing values produced in the copied CSS. Because the shape is CSS geometry rather than a raster asset, it remains sharp at different pixel densities.
The MDN CSS animation guide explains how duration, timing functions, and iteration counts work together, while the W3C CSS Animations Level 1 specification defines the underlying animation model.
Accepted values and validation rules
The controls are deliberately bounded so the preview remains a usable ring. The accepted inputs directly determine the generated declarations:
| Control | Accepted input | Effect on the output |
|---|---|---|
| Overall size | 12 through 160 pixels | Sets the square element's width and height. |
| Ring width | At least 1 pixel and no more than half the selected size | Sets the thickness of every side of the border. |
| Active and track colors | Six-digit hexadecimal values | Sets the highlighted border segment and the remaining ring. |
| Animation duration | 0.2 through 5 seconds | Sets the time taken for one continuous rotation. |
The ring-width limit protects the visible opening. A border thicker than half of the selected size would collapse or invert the inner opening, so it would no longer behave like a clear ring. Duration has limits for the same practical reason: extremely fast movement can be uncomfortable, while an extremely slow rotation may appear frozen.
Numeric fields must contain finite values. An empty numeric field is invalid rather than silently becoming zero, and non-finite values are rejected. These rules prevent the preview from accepting unusable geometry or timing while making invalid input visible to the person configuring it.
All work happens locally in the browser. Settings are not uploaded or retained, no account is required, and the tool introduces no new dependency into the project.
Configure and copy a ring spinner
Use the generator to establish a suitable visual baseline, then integrate that CSS with the actual application behavior.
- Open the CSS Loader Generator and choose an overall size between 12 and 160 pixels. Start with the space available in the interface rather than selecting the largest possible ring.
- Set the ring width to at least 1 pixel and no more than half the chosen size. Check the preview at the intended display size so the opening remains easy to see.
- Enter the active and track colors as six-digit hexadecimal values. Choose colors with enough distinction for the surrounding theme, and confirm that the animation does not become the only indication that an operation is running.
- Adjust the duration between 0.2 and 5 seconds while watching the live rotation. Choose a pace that communicates activity without making the interface feel frantic or visually stalled.
- Copy the generated CSS and paste the .loader class and its uniquely named @keyframes rule into the relevant stylesheet. If either identifier already exists, rename the class or keyframes to prevent a conflict.
- Add an application element that uses the generated class. For example, a page awaiting results might include <div class="loader" role="status" aria-label="Loading results"></div>. Replace the example label with wording that matches the real task.
- Connect the element to the actual request state. Show it only while the operation is pending, remove it promptly after success or cancellation, and display an explicit error state if the operation fails.
The copied CSS provides the visual ring, not the surrounding page layout. The generator does not automatically create an overlay, reserve its own space, position itself over content, or decide when an operation begins and ends.
Connect the animation to real loading states
A spinner answers only one part of the loading experience: it indicates activity visually. The application must provide the surrounding state and feedback.
| Scenario | Recommended feedback |
|---|---|
| The operation has no measurable progress | Show the ring with a specific status message that explains what is loading. |
| Progress can be measured | Use a progress bar with a current value because it is often more informative than an indeterminate spinner. |
| The operation fails or stalls | Expose the error, timeout, cancellation option, or retry action instead of leaving an animation running indefinitely. |
| The operation succeeds or is cancelled | Remove the loader promptly and present the resulting content or cancellation feedback. |
Give the production element an accessible name or place meaningful status text near it. A label such as “Loading results” is more useful than a generic visual ring with no explanation. Avoid repeatedly announcing rapid, minor updates, since frequent status messages can interrupt users without adding useful information.
Reserve layout space for the loader before it appears so the page does not shift when feedback is inserted or removed. Never use continuous animation to conceal a failed request or a process that has stopped responding; a visible timeout or error state must replace the impression of normal progress.
Add reduced motion and visual safeguards
Continuous rotation should respect the user's reduced-motion preference. Add an @media (prefers-reduced-motion: reduce) rule that slows, simplifies, or replaces the animation according to the product's accessibility policy. The copied baseline does not add that policy automatically. Removing the movement without replacing it with another way to identify the loading state would leave some users without useful feedback.
Test the loader in high-contrast modes, forced-colors environments, dark themes, browser zoom, and small screens. The active and track colors should remain distinguishable, but color and motion should not be the only ways users learn that content is loading. Check the complete page, not just the isolated ring, because surrounding text and controls can affect the final appearance.
Transform-based rotation generally performs well because it can be composited efficiently. However, many simultaneous spinners still consume resources and create visual noise. Render a loader only where feedback is needed, and avoid displaying several copies of the same generic indicator.
Test the complete loading lifecycle
The preview demonstrates geometry and timing, but it cannot prove that an application handles success, failure, or cancellation correctly. Test the copied CSS with realistic network delay rather than relying only on a permanent demonstration animation.
- Confirm that the loader appears when the request enters the pending state.
- Verify that it disappears reliably after success, cancellation, and error.
- Check that status text describes the task and remains understandable without color or motion.
- Exercise the reduced-motion rule and verify that an alternative status remains available.
- Test zoom, small screens, dark themes, forced colors, and high-contrast settings.
- Look for class or keyframe name collisions before the CSS reaches production.
- Watch for layout shifts and remove unnecessary simultaneous spinners.
Know what the generator leaves out
The generator produces a compact visual baseline, not a complete interface component. It does not add JavaScript state management, overlay positioning, modal behavior, skeleton content, progress calculation, timeout handling, cancellation, or retry logic. Those decisions belong to the surrounding application.
The practical workflow is therefore simple: choose and validate the visual settings, watch the matching preview, copy the class and keyframes, then add meaningful status text, reduced-motion behavior, failure handling, and lifecycle logic. This separation keeps the CSS reusable while leaving control of the actual user experience with the application.
If you're weighing options, Border Radius Generator for Beginners: A First CSS Guide covers this in detail.
If you're weighing options, Neumorphism Generator Example: Build a Raised CSS Card covers this in detail.