CSS Transition Generator — Free Online Tool

Generate copy-paste CSS transitions — pick a property, set the duration and easing, and get working transition code with a matching hover example. No signup, no build step, just CSS.

Select one or more. Choose “All” for a catch-all transition.

300ms
0ms
Drag the points to shape a custom curve. cubic-bezier(0.25, 0.1, 0.25, 1)

Hover the button to preview


      

How It Works

A CSS transition animates a property’s change over time instead of jumping straight to the new value. Every transition is built from four parts, each of which the generator above lets you set visually:

  • Property — what changes: transform, opacity, background-color, color, border-color, box-shadow, width/height, or all of them at once
  • Duration — how long the change takes, from instant (0ms) up to a slow 3-second fade
  • Timing function — the acceleration curve: linear, ease, ease-in, ease-out, ease-in-out, or a fully custom cubic-bezier() curve you drag into shape
  • Delay — how long to wait before the transition starts, useful for staggering multiple elements

Combine them into a single transition declaration on the element, then define the end state on a trigger like :hover, :focus, or a JavaScript-toggled class. The browser interpolates every frame in between automatically — no keyframes required.

.your-element {
  transition: background-color 300ms ease;
}

.your-element:hover {
  background-color: #FFC502;
}

When to Use a CSS Transition

  • Hover and focus states — buttons, links, and cards that need to feel responsive without a jarring instant color or scale change
  • Theme or dark-mode toggles — smoothing a background-color and color swap so the switch doesn’t flash
  • Micro-interactions on WordPress sites — theme customizers and page builders (Elementor, Gutenberg blocks, Divi) accept raw CSS in their custom-CSS fields, so a generated transition drops straight into a block’s advanced settings without touching a plugin

Custom Easing with cubic-bezier()

The five timing keywords cover most cases, but a cubic-bezier(x1, y1, x2, y2) curve gives full control over acceleration — a sharp snap-in-then-settle, or an anticipatory pull-back before a move. The generator’s draggable curve editor writes the exact four-number value for you, so there’s no need to hand-tune numbers against a mental model of the curve.

Color Transitions

Background, text, and border color changes are the most common transition on the web — link hovers, button states, dark-mode switches. The generator’s color transition mode lets you pick an exact “from” and “to” color and previews the fade live, then outputs a ready :hover block using those values instead of a placeholder color.

Using the Output in Tailwind CSS

Toggle to the Tailwind tab for utility classes instead of raw CSS. Because Tailwind’s built-in ease-in, ease-out, and ease-in-out classes use different bezier curves than the native CSS keywords of the same name, the generator outputs an explicit ease-[cubic-bezier(...)] arbitrary value rather than the built-in class — so what you see in the preview matches what ships in your class list exactly.

FAQ

What does cubic-bezier() mean in CSS?
cubic-bezier(x1, y1, x2, y2) defines a custom easing curve for a transition or animation using two control points, where each keyword (ease, ease-in-out, etc.) is really just a preset set of four bezier numbers.

What’s a good transition duration for a hover effect?
200–350ms reads as responsive without feeling instant; durations past 500ms start to feel sluggish for hover and focus states specifically, though slower is fine for larger UI moves like modals or page transitions.

What’s the difference between a CSS transition and a CSS animation?
A transition needs a trigger — hover, focus, a class change — and moves between exactly two states, while an animation runs on its own via @keyframes and can loop, reverse, or move through many states without any interaction.

Can I transition multiple CSS properties at once?
Yes — list them comma-separated in a single transition declaration, each with its own duration, timing function, and delay if needed, which is exactly what the generator’s multi-property and independent-timing mode produce.

How do I write a transition class in Tailwind CSS?
Tailwind exposes transition, transition-colors, transition-transform, transition-opacity, and transition-shadow as shorthand utilities, paired with duration-*, delay-*, and ease-* classes — or an arbitrary value like duration-[350ms] for anything off the default scale.

Why isn’t my color transition working?
The transitioned property has to be set in both the base state and the trigger state (e.g. :hover) with an actual value change — a transition on background-color does nothing if the hover rule never redefines background-color.

Does a CSS transition slow down my page?
No — CSS transitions run on the browser’s compositor and are effectively free for transform and opacity; properties like width, height, and box-shadow are more expensive to animate since they can trigger layout recalculation, so prefer transform: scale() over animating width/height where the effect allows it.

Scroll to Top