CSS Free, no sign-up

CSS transform generator

Drag the sliders to move, rotate, scale and skew the card. The dashed outline shows where the element was before the transform, the red dot is the pivot (transform-origin), and ready-made CSS appears below.

Result
Ready-made CSS
.element {
  transform: translate(40px, 20px) rotate(15deg) scale(1.1);
}

How to use it

  1. Use translate, rotate, scale and skew to change the card. The dashed outline stays at the original position.
  2. Pick a transform-origin — the point the element rotates and scales around; the red dot marks it.
  3. Tick “3D” to add rotateX, rotateY and the perspective of the parent element.
  4. Press “Animate from none” to see the change from no transform to your result, then click “Copy”.

How it works

Four 2D functions

translate(x, y) moves the element, rotate(angle) turns it clockwise, scale(x, y) stretches or shrinks it (scale(-1) mirrors it) and skew(x, y) slants it. A transform changes only how the element is drawn: its original space in the layout stays reserved and neighbors do not move — that is what the dashed outline shows. Percentages in translate refer to the element's own size, so translate(-50%, -50%) is a classic centering trick.

The order of functions matters

Each function works in the coordinate system already changed by the previous ones. translateX(100px) rotate(45deg) first moves the element 100px to the right and then turns it in place. rotate(45deg) translateX(100px) first turns the axes, so the element moves 100px along the tilted axis — diagonally. The generator writes functions in a fixed order: translate, rotateX, rotateY, rotate, scale, skew.

/* moves right, then rotates in place */
transform: translateX(100px) rotate(45deg);

/* rotates first, then moves diagonally */
transform: rotate(45deg) translateX(100px);

transform-origin: the pivot point

By default the origin is the center of the element (50% 50%). rotate and scale keep this point fixed, so transform-origin: top left rotates the element around its top-left corner. The value accepts keywords, percentages and lengths.

transform-origin: top left;
transform-origin: 20% 80%;

3D: perspective, rotateX and rotateY

rotateX tilts the element forward or back and rotateY turns it left or right. Without perspective the result looks flat. Set perspective on the parent: the smaller the value, the stronger the depth. The same effect is available inside a single element as the perspective() function at the start of the transform list.

.parent  { perspective: 600px; }
.element { transform: rotateX(25deg) rotateY(-20deg); }

Individual properties: translate, rotate, scale

Modern browsers also support translate, rotate and scale as separate properties. They are applied in the order translate, rotate, scale and then transform, so you can change or animate one of them without rewriting the whole transform list. They have been supported by all major browsers since 2022.

.element {
  translate: 40px 20px;
  rotate: 15deg;
  scale: 1.1;
}

FAQ

Why does transform not work on my element?

The most common reason is display: inline: transforms do not apply to non-replaced inline elements such as <span> or <a>. Set display: inline-block (or block, flex). Also check that a later rule does not override transform.

Does the order of transform functions matter?

Yes. translate(100px) rotate(45deg) and rotate(45deg) translate(100px) give different results because every function changes the coordinate system for the next one. Think of them as moves of the element's own axes, applied from left to right.

What is the difference between transform: rotate() and the rotate property?

The result is the same, but the individual property is applied in a fixed order (translate, rotate, scale, then transform) and can be animated on its own. transform is better supported in older browsers and lets you control the order.

Does transform affect page layout or performance?

A transform does not change the layout: neighbors keep their positions and the element's original space stays reserved. It also creates a new stacking context. Animating transform is cheap because browsers usually handle it on the GPU without recalculating the layout, which makes it preferable to animating top or left.

This topic in the HTML & CSS course

More CSS tools

CSS gradient generator Linear, radial and conic gradients: pick colors, angle and stops, then copy the code. Flexbox generator and playground Try flex properties on a container and its items: direction, alignment, gaps and ready-made CSS. CSS Grid generator Set columns and rows, gaps and alignment, then copy the ready-made grid code. CSS box-shadow generator Pick offset, blur, color and layers for a shadow, then copy the ready-made box-shadow code. Cubic-bezier generator Drag the control points of an easing curve and copy the ready-made CSS transition. SVG animation generator Pick a shape and an effect — get inline SVG and CSS keyframes ready to paste. CSS specificity calculator Type selectors to see their (a,b,c) weight, a color-coded breakdown and which rule wins. CSS box model visualizer See content, padding, border and margin as a DevTools-style diagram and copy the CSS. CSS clamp() calculator Enter min and max font size and viewport width — get a ready clamp() for fluid typography. Color contrast checker (WCAG) Check text and background contrast against WCAG AA and AAA, and fix a failing pair of colors. CSS clip-path generator Polygons, bevels, arrows and circles: drag control points on the live canvas and copy ready-made CSS. CSS glassmorphism generator Frosted glass effect: backdrop-filter blur, saturation, border highlight and clean CSS. CSS border-radius (Blob) generator Organic shapes and 8-value border-radius: tune horizontal and vertical corner radii. CSS Stacking Context & z-index Visualizer Why z-index: 9999 fails! Explore CSS Stacking Contexts in interactive 3D exploded layers with transform, opacity and isolation triggers. CSS aspect-ratio & object-fit Generator Eliminate squished images & CLS layout jumps: live aspect-ratio proportions and interactive object-position focal point. CSS Filters Studio & Generator Photo effects without design tools: blur, contrast, hue-rotate, sepia, and trending Instagram-style presets. OKLCH Color Picker & Palette Generator Perceptually uniform brightness & vibrant Display P3 colors: OKLCH picker, design system scales, and fallbacks. CSS Scroll-driven Animations Generator Scroll-linked animations without JavaScript: animation-timeline scroll() & view(), reading progress bar & reveal on scroll. CSS Container Queries (@container) Generator Beyond viewport media queries: components adapt directly to their parent container width. Live resizer & @container rules.
WhatsApp