CSS Animation Keyframe Generator

Visually build and test CSS keyframe animations, durations, timings, and effects.

Controls

Animate Me
.animated-element {
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.1); }
  100% { transform: scale(1); }
}

How to Use the Animation Keyframe Generator

What Is the CSS Animation Keyframe Generator?

The CSS Animation Keyframe Generator is a free visual tool for creating CSS keyframe animations with built-in presets and customizable timing controls. CSS animations bring web pages to life - they draw attention to important elements, provide visual feedback, guide user focus, and create engaging, dynamic interfaces that feel responsive and modern.

This tool includes popular animation presets like pulse, bounce, spin, shake, and fadeUp, along with controls for duration, timing function, and iteration count. The live preview plays the animation in real time so you can fine-tune the exact behavior before exporting the code.

How Does It Work?

Select an animation preset to start with a professionally crafted animation. Each preset defines a complete @keyframes rule with multiple steps that create the desired motion effect. The live preview immediately starts playing the animation so you can see exactly how it looks and feels.

Customize the animation using three main controls. The duration slider adjusts how long one animation cycle takes - shorter durations (0.3-0.5s) feel snappy and responsive, while longer durations (2-3s) create slow, ambient effects. The timing function dropdown controls the acceleration curve - 'ease' starts slow and ends slow, 'linear' maintains constant speed, and 'ease-in-out' creates a natural, physics-based feel.

The iteration count lets you set how many times the animation repeats. Choose 'infinite' for continuous animations (like loading spinners and hover effects) or a specific number (like 1 or 3) for triggered animations. You can play and pause the animation in the preview to refine your settings, then copy or download the generated CSS.

CSS Animation Syntax

/* Keyframe Definition */
@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

/* Applying the Animation */
.animated-element {
  animation: pulse 2s ease-in-out infinite;
}

/* Animation Shorthand */
/* name | duration | timing | delay | count | direction | fill | play-state */
animation: bounce 0.5s ease 0s 1 normal forwards running;

/* Multi-step Animation */
@keyframes slideIn {
  0% { transform: translateX(-100%); opacity: 0; }
  60% { transform: translateX(10%); }
  100% { transform: translateX(0); opacity: 1; }
}

Built-in Animation Presets

  • Pulse - rhythmic scale animation that draws attention to call-to-action buttons and notifications
  • Bounce - spring-like vertical movement that adds playful energy, ideal for scroll-triggered reveals
  • Spin - continuous 360° rotation, perfect for loading spinners and processing indicators
  • Shake - rapid horizontal oscillation that signals errors, invalid inputs, or attention-needed alerts
  • FadeUp - smooth upward slide with opacity transition, the most popular entrance animation for scroll-triggered content

Animation Best Practices

The most important rule for web animations is to only animate properties that trigger GPU compositing - transform and opacity. These properties can be handled entirely by the GPU without triggering layout recalculations or repaints, ensuring smooth 60fps animations even on mobile devices. Avoid animating width, height, top, left, padding, or margin, as these trigger expensive layout changes.

Always respect user preferences for reduced motion. Use the @media (prefers-reduced-motion: reduce) media query to disable or simplify animations for users who have enabled this accessibility setting in their operating system. Motion-sensitive users can experience discomfort, nausea, or seizures from certain animations.

Keep animation durations appropriate for their context. Micro-interactions (button hovers, toggle switches) should be fast - 150ms to 300ms. Page transitions and modal entrances work well at 300ms to 500ms. Looping ambient animations (floating elements, gradients) can be longer at 2s to 5s. Durations over 1 second for interactive feedback feel sluggish.

Use the animation-fill-mode property to control what styles apply before and after the animation. 'forwards' keeps the final keyframe state after completion - essential for entrance animations where you want elements to stay visible after animating in. 'backwards' applies initial keyframe styles during the delay period before the animation starts.