GALAXY OF TOOLS

DESIGN SECTOR

CSS Transform Generator

Translate, rotate, scale and skew in 2D or 3D, reorder the functions, drag the origin and get matrix() output.

Presets
Transform functions (written left to right in this order)
  1. px
    px
  2. px
  3. deg
  4. deg
  5. deg
  6. ×
    ×
  7. deg
    deg

transform-origin
%
%
Or drag the yellow dot on the preview (arrow keys nudge it).
Live previewDashed = original box · dot = origin
CSS

      
      
Same transform as a matrix

      

Runs entirely in your browser. Nothing you enter or upload is sent to a server.

A CSS transform generator for 2D and 3D, with origin and matrix output

The CSS Transform Generator builds the transform property with sliders: translate, rotate, scale and skew in 2D, plus rotateX, rotateY, rotateZ, translateZ and perspective in 3D. A dashed ghost stays where the box started, so you always see how far it has moved, turned or stretched.

Unlike most transform tools, it lets you change the order of the functions and tells you live whether the order changes the result. Drag the yellow dot to move the transform-origin, switch to the newer individual translate, rotate and scale properties, and read the exact matrix() or matrix3d() the browser computes. Everything runs locally in your browser.

How to use the CSS Transform Generator

  1. Choose 2D or 3D at the top, or start from a preset such as “Pivot on corner” or “3D tilt”.
  2. Move the sliders (or type values) for each function. Untick a function to switch it off without losing its values.
  3. Use the arrow buttons beside a function to move it earlier or later in the list, and read the note under the list to see how the order changes the result.
  4. Drag the yellow origin dot on the preview, or type X and Y percentages, to change the point the box turns and scales around.
  5. In 3D, set the perspective distance and choose whether it goes on the parent element or into the transform as perspective().
  6. Copy the CSS, or copy the equivalent matrix.

CSS Transform Generator features

Reorderable function list

Seven functions in any order; hidden 3D functions keep their place when you return to 2D.

Live order explanation

The tool reverses your list behind the scenes and shows the different matrix you would get — or says when the functions commute.

Draggable transform-origin

Drag with a mouse or finger, nudge with arrow keys (Shift for 10%), or type percentages.

Individual properties

Moves translate, rotate and scale out of transform only as far as that keeps the result identical, and explains anything that stays.

Exact matrices

matrix() for flat results and matrix3d() when depth is involved, rounded to four decimals; the selftest checks them against the browser’s own computed style.

Why the order of transform functions matters

CSS multiplies the functions from left to right into one matrix, and that matrix is applied to the box — so the rightmost function acts on the box first. An easier way to think about it: reading left to right, every function moves, turns or stretches the coordinate system that the next function works in.

Take translateX(100px) rotate(90deg): the box moves 100px to the right and then turns on the spot, giving matrix(0, 1, -1, 0, 100, 0). Swap them to rotate(90deg) translateX(100px) and the axes are turned first, so “X” now points down the screen: the box ends up 100px below its start, matrix(0, 1, -1, 0, 0, 100). Rotation and a uniform scale, on the other hand, commute — rotate(45deg) scale(2) equals scale(2) rotate(45deg).

Reading matrix() and matrix3d()

matrix(a, b, c, d, e, f) is the 2D affine matrix with a c e on the first row and b d f on the second. For a rotation by θ and a uniform scale s, a = s·cos θ, b = s·sin θ, c = −s·sin θ and d = s·cos θ; e and f are the translation in pixels. So rotate(45deg) scale(2) becomes matrix(1.4142, 1.4142, -1.4142, 1.4142, 0, 0), because 2 × cos 45° = 1.4142. Skew adds tan of its angles to c (skewX) and b (skewY).

matrix3d() takes all sixteen values of the 4×4 matrix, column by column. A perspective(d) function puts −1/d into the bottom row, which is why perspective(800px) rotateX(60deg) contains −0.0011 (−0.00125 × sin 60°). Matrices are handy for animation libraries and for comparing results, but the readable function list is better for hand-written CSS.

Origin, perspective and the individual properties

  • transform-origin is the fixed point of rotation, scaling and skewing; it defaults to 50% 50%. 0% 100% makes a box swing like a door hinged at its bottom-left corner. Translation is not affected by the origin.
  • perspective on the parent gives all children one shared vanishing point; the perspective() function gives each element its own and must come first in the list to affect the functions after it. Smaller distances look more dramatic.
  • translate, rotate and scale as separate properties are supported in all current browsers. They are always applied in that order and before transform, which lets a hover rule change just scale without repeating the rest.
  • Performance: transforms do not trigger layout, so animating them is cheap; respect prefers-reduced-motion for large movements. For a box to transform, see the CSS Border Generator and Box Shadow Generator.

CSS Transform Generator FAQ

How do I rotate an element in CSS?

Use transform: rotate(45deg);. Positive angles turn clockwise. To turn around a corner instead of the centre, add transform-origin: 0% 0%; — in this CSS transform generator, drag the yellow dot there.

Can I use more than one transform at once?

Yes, list them in one property separated by spaces, such as transform: translateX(20px) rotate(10deg) scale(1.1);. A second transform declaration replaces the first rather than adding to it.

What is the difference between rotate and rotateZ?

None in the result: both turn the element around the axis pointing out of the screen. rotateX and rotateY tilt it towards or away from you and need perspective to look three-dimensional.

Why does my 3D transform look flat?

Without perspective, depth is projected straight onto the screen. Add perspective: 800px to the parent or put perspective(800px) first in the transform list.

Should I use transform: translate() or the translate property?

Both work. The separate properties are easier to animate and override individually, but they are always applied as translate, rotate, scale, then transform. The generator only uses them in a way that gives the same result as your list.

How do I flip an element horizontally?

Use transform: scaleX(-1); for a mirror image, or rotateY(180deg) in 3D for a card-flip effect — try the Flip card preset.

You might also need