CSS Transform Generator
Compose translate, rotate, scale, skew and perspective with a live preview, the equivalent matrix() and copyable CSS.
Transform controls
noneTransform output
identitytransform value
none
Equivalent 2D matrix
matrix(1, 0, 0, 1, 0, 0)
.element {
transform-origin: 50% 50%;
transform: none;
}
Examples
Centered overlay
translateX −50%, translateY −50%transform: translate(-50%, -50%);Percentage translation is relative to the element's own size, which centers an absolutely positioned overlay.
Rotate around a corner
rotate 30°, origin 0% 0%transform-origin: 0% 0%; transform: rotate(30deg);The matrix readout assumes the default center, so the origin is emitted as a separate declaration.
About this tool
CSS Transform Generator composes translate, rotate, scale, skew and perspective into a single transform value using sliders, with a live preview that applies exactly what you will ship. Functions are emitted in a fixed, documented order and zero-valued functions are omitted so the result stays readable.
The tool also computes the equivalent 2D affine matrix() for the same controls. Translation contributes e and f; rotation, skew and scale multiply into a, b, c and d. Perspective is shown in the transform string but explicitly excluded from the matrix readout because it is a projection, not an affine transform. A transform-origin control is emitted separately and the matrix note explains when it changes the visual result.
Controls cover px, % and em translations, rotations from −180° to 180°, X/Y scaling with an optional aspect lock, skews and a perspective distance. The preview sits on a grid so movement and origin shifts are easy to see, and a text description of the current transform accompanies the code. All computation runs locally in the browser.
What this tool does not do
- The generator covers 2D transforms with an optional perspective prefix, not full 3D transform chains.
- The matrix readout assumes a 50% 50% origin even when you choose a different one.
- Percentage translations resolve against the element's own box and are shown as authored CSS, not baked into the matrix.
- History and URL sharing are not included; the current state lives in the page until you copy it.
How to use this tool
Set values
Move the translate, rotate, scale, skew and perspective sliders; choose px, % or em for translation.
Pick an origin
Use a preset or set custom X/Y percentages to change the point the element rotates and scales around.
Compare the matrix
Read the equivalent matrix() beside the transform string; notes explain origin and perspective caveats.
Copy the CSS
Copy the selector block with transform-origin and transform, or download it as a .css file.
Use cases
Hover effects
Dial in a small scale-and-rotate interaction and copy the finished CSS.
Centering
Use percentage translations for modals and tooltips without guessing offsets.
Teaching transforms
Show the same state as function lists and a matrix to explain composition.
Function order and matrix terms
| Function | Matrix contribution |
|---|---|
| perspective(d) | None |
| translate(x, y) | e, f |
| rotate(θ) | a, b, c, d |
| skew(x, y) | a, b, c, d |
| scale(x, y) | a, d |
Emitted order is perspective → translate → rotate → skew → scale; changing the order changes the result.
Common mistakes
Mistake:Expecting translate to follow the rotated axes.
Fix:Put translate before rotate, as this generator does, to move in parent axes.
Mistake:Looking for perspective() in the matrix() readout.
Fix:Perspective is a projection; the tool explains why it cannot be expressed as a 2D affine matrix.
Mistake:Scaling an element to zero and wondering why it vanished.
Fix:Keep both scale values above zero; the tool warns for non-positive scales.
Frequently asked questions
Does transform order matter?
Yes. Transforms are composed in the order written, so translate(10px) rotate(45deg) differs from rotate(45deg) translate(10px). This generator always emits perspective, translate, rotate, skew and scale so the result is predictable.
What is transform-origin?
It is the point around which rotation, scaling and skewing happen. The default is 50% 50%; choosing a corner moves that point and changes where the element ends up, even if the transform string is unchanged.
When should I use matrix() instead?
matrix() is rarely hand-written; it is useful for interpolating or inspecting a composed transform. The generator shows the equivalent matrix so you can see how translate, rotate, skew and scale combine.
Why is my scaled element blurry?
Scaling a rasterized element enlarges its pixels. Use vector assets or render at the target resolution when sharpness matters; the transform itself is geometrically correct.
How does perspective work in 2D?
The perspective() function adds a projection distance to a transform list. It changes depth cues but cannot be represented by a 2D matrix(), which is why the matrix readout omits it.
References & standards
Related tools
Aspect Ratio Calculator
Calculate dimensions and ratios for images and videos.
Border Radius Generator
Visually craft CSS border-radius values — including the advanced 8-value slash syntax for organic blob shapes — with a live preview and one-click copy.
Box Shadow Generator
Visual CSS box-shadow generator. Create beautiful shadows with live preview and copy the CSS code.
CSS :has() Selector Playground
Try the CSS :has() parent selector on live editable HTML and CSS, with ten patterns, dropped-rule detection and specificity notes.
CSS Button Generator
Design buttons with hover, active, focus-visible and disabled states — gradients, shadows, borders, icons — and copy clean CSS or Tailwind.
CSS Clip-Path Generator
Draw clip-path shapes visually: drag polygon points, tune circle/ellipse/inset presets, paste an SVG path and copy responsive CSS.