Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

For a simple spinner, pulsing dot, or progress ornament, use a small CSS animation and connect its visibility to the task that is actually loading. Choose Lottie Web when you need more elaborate exported vector motion or playback controls. In either case, make the loading state understandable without motion, honor the visitor’s reduced-motion preference, and remove the indicator as soon as the awaited content is ready.

How to create a website loading screen animation

Start by deciding what the visitor needs to know: that a particular region is loading, or that the whole page is temporarily unavailable while work completes. Prefer an inline status for a section or control when the rest of the interface remains usable. Use a full-screen overlay only when the task genuinely prevents interaction with the page. The animation should communicate a real wait, not create an artificial pause before ready content appears.

  1. Identify the task. Decide which request or operation starts loading and exactly which result marks completion or failure.
  2. Choose the simplest suitable motion. A dot or spinner is usually a CSS job; reserve a vector animation player for designs that need its extra expressive control.
  3. Provide a status in text. Ensure assistive technology and people who do not perceive the animation can tell that work is underway.
  4. Respect motion preferences. Offer a static status or indicator when reduced motion is requested.
  5. Connect the indicator to application state. Show it while work is pending, then remove or update it on success, failure, or cancellation.
  6. Test the actual interface. Check the target browsers, reduced-motion behavior, slower devices, and both successful and failed loads.

A minimal CSS loading animation

This example is a starting point, not a tested production component. The status text communicates loading, while the dot is decorative. If your application already renders an accessible status message, adapt the markup to avoid announcing the same status twice.

<div class="loading" role="status" aria-label="Loading">
  <span class="loading__dot" aria-hidden="true"></span>
</div>
.loading__dot {
  display: inline-block;
  width: 1rem;
  height: 1rem;
  border-radius: 50%;
  background: currentColor;
  animation: pulse 900ms ease-in-out infinite alternate;
}

@keyframes pulse {
  to {
    opacity: 0.35;
    transform: scale(0.8);
  }
}

@media (prefers-reduced-motion: reduce) {
  .loading__dot {
    animation: none;
  }
}

The 900ms interval is simply the value in this illustrative example, not a universal recommendation. Choose a restrained effect that suits the interface and check it in context. The media query disables the dot’s movement when the visitor’s operating-system or browser preference requests reduced motion. The status remains present, so feedback does not depend on animation.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall

Make loading follow the real task

In a client-rendered interface, toggle the loading element from the same state that tracks the request or operation. For example, start the state before awaiting a fetch, and clear it in a finally block so errors do not leave the indicator spinning forever. On success, render the result; on failure, replace the loading status with a useful error and an appropriate retry path. For a region whose contents are being updated, consider setting aria-busy="true" on that region while work is pending, then setting it to false when the update is complete. Apply semantics to the actual region and interaction rather than adding attributes mechanically.

How do I make a loading animation in CSS?

CSS is a practical default for DOM-based motion that can be expressed with a few shapes and straightforward keyframes. MDN recommends CSS animations where possible for essential DOM animation. A CSS-only loader avoids adding an animation runtime, and it can be styled alongside the rest of the page. Use a small number of elements and animate only what the design needs.

  • Spinner: a border or other simple shape can rotate to suggest ongoing work.
  • Pulsing dot: a circle that changes opacity or scale provides a minimal animated cue.
  • Progress ornament: use an animated fill only when it communicates a meaningful state. Do not imply measured progress if the application cannot estimate completion.

The example above uses opacity and scale for a compact pulse. Keep the visual secondary to the status message; avoid elaborate effects that consume attention while the visitor waits. CSS support and the right semantics depend on the component and browser context, so test the implementation where it will be used.

Rank #2
Sale
HTML and CSS: Design and Build Websites
  • HTML CSS Design and Build Web Sites
  • Comes with secure packaging
  • It can be a gift option

Should I use CSS or Lottie for a loading animation?

Choose according to visual complexity, need for programmatic playback control, and the extra asset and runtime each approach brings. Lottie Web is intended for rendering animation data in a container; its documented options include SVG, canvas, and HTML renderers. The documentation describes capabilities, not a universal speed ranking, so do not assume one renderer will always be fastest.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Approach Good fit Tradeoff
CSS animation A simple spinner, pulsing dot, or small DOM ornament. Best suited to motion that is practical to express with CSS; less convenient for elaborate exported artwork or complex playback control.
JavaScript or Web Animations API Motion that must respond to application state or be controlled from code. Requires scripting and explicit handling of reduced-motion preferences.
Lottie Web An elaborate exported vector animation that needs player controls. Adds a runtime and animation data. Available renderers are documented, but the documentation does not establish a universal performance winner.

When Lottie is worth the extra setup

Use Lottie when the design genuinely calls for artwork or motion that would be cumbersome to build as CSS, or when the player’s controls are useful to the application. Create or export animation data using an appropriate design workflow, put the container in the document before calling loadAnimation, and configure the renderer, looping, and autoplay deliberately. The API accepts a container and either a path to animation data or animationData; do not supply both. It returns an animation instance that can be controlled.

Check the current Lottie Web API documentation and browser compatibility as part of implementation. The API details and rendering capabilities are not a guarantee that a particular animation will meet your page’s performance needs. Measure your own page, especially if the animation is large or appears in a frequently used interface.

Rank #3
Sale
Web Design with HTML, CSS, JavaScript and jQuery Set
  • Brand: Wiley
  • Set of 2 Volumes
  • A handy two-book set that uniquely combines related technologies Highly visual format and accessible language makes these books highly effective learning tools Perfect for beginning web designers and front-end developers

How do I make a loader accessible?

Accessibility depends on more than adding a spinning icon. The interface needs to communicate that work is happening, keep the status associated with the correct task, and avoid motion that some visitors find distracting or uncomfortable. W3C guidance documents both CSS and JavaScript approaches to honoring a motion preference. Keep the status understandable if animation is removed or cannot be seen.

  • Use a concise status such as “Loading results” where the task needs context; a generic label may not distinguish multiple simultaneous operations.
  • Mark purely decorative animation artwork as hidden from assistive technology, while making the actual status available as text.
  • Do not announce repeated updates or duplicate status text unnecessarily. Choose semantics appropriate to the component and test with assistive technology.
  • Do not trap interaction behind a full-screen loader unless the task truly requires it. If the interface is unavailable, make that state clear and ensure it ends or changes on failure.
  • When content finishes loading, update the interface promptly so the visitor is not left with stale status information.

How can I respect prefers-reduced-motion?

For CSS motion, use the prefers-reduced-motion: reduce media query to remove movement or replace it with a static treatment. The CSS example above leaves the loading status intact while stopping the pulse. W3C’s guidance also describes checking the preference in JavaScript for script-driven animation.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

For JavaScript-controlled motion, query the media feature and avoid starting or continuing nonessential animation when reduction is requested. If the preference can change while the page is open, respond to that change as well as the initial value. The exact control depends on the animation library and version in use; confirm the current API for pausing or stopping playback rather than assuming a particular method applies to every player.

  1. Enable the reduced-motion preference in the operating system or browser environment used for testing.
  2. Check whether the motion is essential to understanding the task. For a loading ornament, it generally is not: the textual status can convey the wait.
  3. Verify that the nonessential animation is suppressed or substantially minimized, and that the status remains perceivable.
  4. Restore the default preference and confirm that the ordinary experience still works.

Performance and timing: keep the wait proportionate

Larger animations and more simultaneous animations require more processing and can degrade performance. Keep the animation lightweight, limit the number of animated elements, and test on slower devices rather than assuming a design is inexpensive. W3C’s 2026 Web Sustainability Guidelines are a draft and recommend efficient, controlled animation, including limiting its number and frequency, setting replay limits, and favoring browser or platform-native capabilities while minimizing main-thread or layout-intensive work.

There is no universal file-size budget, ideal loader duration, or performance threshold established for every site. Measure the actual page and asset in the interface where it will run. Most importantly, tie the indicator to real work: do not delay ready content to make a loader visible, and do not leave the animation on after the task has completed. The appropriate treatment may also differ between a brief request and a longer operation; the reviewed guidance does not prescribe one universal loading-screen pattern.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Or skip the browser setup

If your goal is to capture a rendered page for review or an automated workflow rather than build the loader itself, ScreenshotNeo is a website screenshot API and MCP server from Yorker Media. A GET request can return a screenshot or PDF; its response includes page-verdict and billing headers. For this topic, that can help you capture a page while checking how its loading state renders, but it does not replace implementing or testing the animation in your site.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Example cURL request for a screenshot of a page:

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

See the ScreenshotNeo API documentation for request details. Cookie banners, popups, and chat widgets are removed before the shot; bot checks, blank pages, and failed loads are never billed. Its MCP server lets AI agents take screenshots. The Free plan includes 1,000 screenshots a month with no card, and paid plans start at $5 for 3,000. Learn about ScreenshotNeo, then sign up for 1,000 free screenshots a month with no card.

Troubleshooting common loader problems

  • The loader never disappears. The completion path may not clear loading state, especially after an exception. Clear it on both success and failure, and make cancellation an explicit state if the operation can be cancelled.
  • The loader flashes for a very short request. The interface may render a transient state before the result arrives. Avoid delaying usable content just to show an animation; if flicker is a real usability issue, handle the presentation intentionally without misrepresenting progress.
  • Nothing moves for a visitor using reduced motion. That may be the intended result. Check that the textual loading status remains visible and that the preference is not accidentally suppressing the status itself.
  • A Lottie animation does not render. Confirm that the container exists before calling loadAnimation, that the animation data is available, and that the call uses either path or animationData, not both. Check the current library API and browser console for specific failures.
  • The animation is janky or costly. Reduce its complexity or number of elements, reconsider whether a player or elaborate effect is necessary, and profile the actual page on slower devices. Documentation describing renderer options does not establish which renderer will perform best for your animation.
  • The message is missing or confusing to assistive technology. Check that status text is present, that decorative artwork is not being announced as meaningful content, and that updates are associated with the task’s relevant region.

Frequently Asked Questions

Does a loading animation need to show estimated progress?

No. Use an indeterminate spinner or pulse when the application cannot calculate meaningful progress; avoid implying a percentage or completion estimate that is not based on the work being done.

Can I use a static loading indicator instead of animation?

Yes. A textual status or static mark can communicate loading without movement, including when reduced motion is requested.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.