CSS Transform Generator
Reorder 2D and 3D transforms, preview a box, and export CSS, matrices, and Tailwind classes.
How to use
- Start with Sample or edit translation in pixels, rotation and skew in degrees, and unitless scale. Zero perspective disables it; enabled perspective starts at 1 px.
- Use the arrow buttons or Reverse order to change the written function order. Coordinates transform from right to left, so order changes the result.
- Set the origin with X/Y percentages and a Z length. The outline marks the original box.
- Copy CSS, matrix CSS, or Tailwind arbitrary classes. Keep transform-origin with the matrix. Reset restores the identity; numeric input is not saved.
FAQ
Why does CSS transform order matter?
Transform matrices generally do not commute. With the default origin, translateX(60px) rotateZ(90deg) rotates then moves right; rotateZ(90deg) translateX(60px) moves along the rotated axis and ends down instead. The playground lets you reorder each function independently.
When does matrix CSS use matrix3d()?
Active perspective, Z translation, or X/Y rotation produces a 4 × 4 matrix3d() in CSS column-major order. Planar transforms use matrix(a, b, c, d, e, f). Entries are rounded to 12 significant digits. The origin is not baked into the matrix; both CSS outputs include the same transform-origin declaration.
How can I combine rotate, scale, translate and skew CSS in Tailwind?
Copy the generated [transform:…] and [transform-origin:…] arbitrary property classes into literal source text. One transform class preserves the selected order. Avoid additional transform utilities or individual translate, rotate and scale properties, which can change the result.
Why can a 3D transform make the preview disappear?
A zero scale collapses an axis, a 90-degree rotation can turn the box edge-on, and perspective can place it behind the viewer. Large translations can also leave the clipped preview area. Reset restores the box. This tool edits geometry, unlike the related shadow and gradient generators.