Home › Developer Tools › CSS Transform Generator

CSS Transform Generator

Drag the sliders to move, rotate, scale and skew a box, pick the transform-origin, and add 3D tilt with perspective. The preview and CSS update live, along with the equivalent matrix().

Last updated:

Presets

Translate

Rotate & skew

Scale

3D

Transform origin

%
%
CSS

        
Advertisement
Advertisement

How to use the CSS Transform Generator

  1. Start from a preset or drag the sliders. Type exact values in the number boxes.
  2. Set the transform origin with the 3×3 grid or custom X/Y percentages; the orange dot shows the pivot point.
  3. Turn on 3D to tilt the element with rotateX and rotateY; lower perspective values give a stronger effect.
  4. Change the function order to see why rotate-then-translate differs from translate-then-rotate.
  5. Copy the CSS, or tick the :hover option to get a ready-made hover effect with a transition.

CSS transform functions at a glance

FunctionExampleEffectIdentity value
translate(x, y)translate(40px, -10px)Moves right 40px and up 10px0, 0
rotate(a)rotate(15deg)Turns clockwise around the origin (negative = anticlockwise)0deg
scale(x, y)scale(1.2) or scale(-1, 1)Resizes; 1 = original size, negative values mirror1
skew(x, y)skewX(-15deg)Slants the element along an axis0deg
rotateX / rotateYrotateY(30deg)3D rotation around the horizontal or vertical axis0deg
perspective(d)perspective(800px)Viewer distance for 3D functions that follow itnone
matrix(a, b, c, d, e, f)matrix(1, 0, 0, 1, 40, 0)All 2D functions combined into one affine matrix1, 0, 0, 1, 0, 0

How the matrix is calculated

Each 2D function is a 3×3 matrix, and a transform list multiplies them from left to right. For rotation by angle θ the matrix is matrix(cos θ, sin θ, −sin θ, cos θ, 0, 0); scaling by (sx, sy) is matrix(sx, 0, 0, sy, 0, 0); translation by (tx, ty) is matrix(1, 0, 0, 1, tx, ty); skew by (α, β) is matrix(1, tan β, tan α, 1, 0, 0). For example rotate(30deg) becomes matrix(0.866, 0.5, −0.5, 0.866, 0, 0). The generator shows the combined matrix for your settings, which is also what getComputedStyle() returns.

Practical tips

  • Use transform: translate(-50%, -50%) with top: 50%; left: 50% to centre an absolutely positioned element of unknown size.
  • Percentages in translate refer to the element's own size, not its parent's.
  • Transforms do not work on inline elements such as a plain <span>; give it display: inline-block.
  • Pair transforms with transition or @keyframes for smooth motion; the CSS animation generator builds keyframes for you.
  • Respect users who prefer less motion by disabling large transforms inside @media (prefers-reduced-motion: reduce).

Frequently asked questions

What does the CSS transform property do?

transform changes how an element is drawn without changing the page layout around it. It can move (translate), turn (rotate), resize (scale) and slant (skew) the element, in 2D or 3D. Neighbouring elements keep their places, as if the element still had its original size and position.

Why does the order of transform functions matter?

Functions are applied from right to left in the element's coordinate system, so each one changes the axes for the ones before it. translate(100px) rotate(45deg) moves the element right and then spins it in place, while rotate(45deg) translate(100px) moves it 100px along the rotated, diagonal axis.

What is transform-origin?

It is the fixed point that rotation, scaling and skewing happen around. The default is the centre (50% 50%). Setting it to top left makes the element rotate around its top-left corner, like a door hinge on that corner.

How do I flip an element in CSS?

Use a negative scale: transform: scaleX(-1) mirrors it horizontally and scaleY(-1) flips it vertically. Text and images are mirrored too. Use the Flip horizontal and Flip vertical presets to try it.

What is the difference between transform and the translate, rotate and scale properties?

Modern browsers also support separate translate, rotate and scale properties. They are handy for animating one part at a time, but they are always applied in the fixed order translate, rotate, scale and cannot express skew. The tool shows the individual-property version when it gives the same result.

Does transform affect performance?

Transforms are among the cheapest properties to animate, because browsers can usually move the already painted element on the GPU without recalculating layout. Animating width, height, top or left instead triggers layout and is slower.

What does perspective() do?

perspective(n) sets how far the viewer is from the screen, in pixels, for 3D transforms. Small values such as 300px give a dramatic, close-up effect; large values such as 1500px look flatter. It must come first in the transform list to affect the 3D functions after it.

Are all the tools on FreeToolCabin tested for quality and accuracy?

Yes! Every tool on our site undergoes automated Q/A testing in real browser environments to ensure high precision, correct output, and zero errors. If you happen to spot a bug or have a suggestion, please contact us at [email protected] and our team will review it right away.

Related tools

CSS Animation GeneratorCreate CSS keyframe animations from 23 presets with live preview, timing controls and Copy CSS.CSS Box Shadow GeneratorDesign layered CSS box shadows with a live preview, presets and one-click Copy CSS.CSS Clip-Path GeneratorDraw CSS clip-path shapes by dragging points: polygons, circle, ellipse and inset. Copy the CSS.CSS Filter GeneratorAdjust blur, brightness, contrast, hue, sepia and drop-shadow on an image and copy the CSS filter.Open Graph PreviewPaste OG tags and preview how links look on Facebook, X and LinkedIn.YouTube Embed Code GeneratorCreate responsive YouTube embed code with start time, autoplay, loop and privacy mode.CSS Border Radius GeneratorRound each corner, draw elliptical 8-value radii or random blob shapes and copy the CSS.CSS Button GeneratorDesign CSS buttons with gradients, borders, shadows and hover and active states, then copy the code.CSS Flexbox GeneratorBuild flexbox layouts visually: set container and item properties, then copy the CSS and HTML.Twitter Card GeneratorCreate X / Twitter Card meta tags with Open Graph fallbacks, character counters and a live preview.CSS Grid GeneratorDraw CSS grid layouts: set tracks and gaps, drag to name areas, then copy the CSS and HTML.PX to REM ConverterConvert px to rem or em and back, with a 1-100px table and a whole-CSS converter.Glassmorphism CSS GeneratorDesign frosted-glass UI cards with blur, transparency and border sliders, then copy the CSS.CSS Text Shadow GeneratorLayer CSS text shadows with a live preview and neon, 3D, outline and retro presets.HTML Editor (Live Preview)Write HTML, CSS and JavaScript and see a live, sandboxed preview as you type.HTML to JSX ConverterConvert HTML to valid React JSX: className, htmlFor, style objects, self-closing tags and events.CSS Triangle GeneratorMake CSS triangles in 8 directions with the border trick or clip-path. Set size and color, copy CSS.CSS Loader GeneratorPick from 14 pure CSS spinners and loaders, set color, size and speed, then copy the HTML and CSS.Cubic Bezier GeneratorDrag the control points to design a CSS easing curve, compare it with linear and copy cubic-bezier().CSS Specificity CalculatorCalculate CSS selector specificity (a, b, c), including :is(), :not(), :has() and :where(), and compare.Google Maps Embed GeneratorTurn an address or coordinates into responsive Google Maps iframe embed code, no API key.Neumorphism CSS GeneratorDesign soft UI neumorphic shapes with live preview and copy the box-shadow CSS.SVG Wave GeneratorMake layered SVG waves for section dividers and export SVG, PNG or a CSS background.SVG Blob GeneratorGenerate random organic SVG blob shapes with gradients and export SVG, PNG or CSS clip-path.CSS Clamp GeneratorTurn min/max sizes and viewport widths into a fluid CSS clamp() value in rem and vw.CSS @font-face GeneratorTurn font files or URLs into ready-to-paste @font-face rules with weights, styles and a preview.CSS Media Query GeneratorBuild @media rules for widths, orientation, dark mode and hover, or get framework breakpoints.CSS Scrollbar GeneratorStyle scrollbars: width, colors, radius and hover, with ::-webkit-scrollbar and scrollbar-color CSS.CSS Sprite GeneratorPack many icons into one sprite sheet PNG and get CSS classes with background-position.CSS Text Gradient GeneratorMake gradient text with background-clip:text: color stops, angle, font preview and fallback CSS.CSS Toggle Switch GeneratorDesign pure-CSS toggle switches: size, colors, shape and animation. Copy accessible HTML + CSS.CSS Tooltip GeneratorBuild pure CSS tooltips: position, arrow, colors, padding and animation. Copy HTML and CSS.HTML Form BuilderDrag and drop form fields with labels and validation, then copy accessible HTML and CSS code.Iframe GeneratorCreate iframe embed code: size or responsive ratio, border, allow, sandbox, lazy load, live preview.PX to VW ConverterConvert pixels to vw and vh for any viewport size, and vw/vh back to px, with breakpoint tables.SVG Path EditorEdit an SVG path d attribute visually: drag points, edit commands, convert, scale and minify.SVG to CSS Data URITurn SVG code into a small URL-encoded data URI for CSS backgrounds, with Base64 size comparison.SVG to JSXTurn SVG code into a clean React component: camelCase attributes, style objects, TypeScript.CSS Gradient Animation GeneratorCreate animated gradient backgrounds: pick colors, angle and speed, preview live and copy the CSS.CSS Hover Effects GeneratorPick button, link and image hover effects, tweak colors and timing, and copy the HTML and CSS.CSS InlinerMove CSS from style blocks into inline style attributes so HTML emails render in every client.CSS Shape Divider GeneratorCreate wave, tilt, curve and triangle section dividers and copy the SVG, HTML and CSS.Font Pairing ToolPreview Google Font heading and body pairs on real layouts and copy the embed code and CSS.HTML Accessibility CheckerPaste HTML to find WCAG accessibility problems with impact level, the failing element and a fix.HTML Image Map GeneratorDraw clickable rectangle, circle and polygon hotspots on an image and get image map HTML.SVG ViewerOpen or paste SVG code to preview it live with zoom, backgrounds, size info and PNG export.Pathfinding VisualizerAnimate BFS, DFS, Dijkstra, A* and greedy search on a grid with walls, weights and mazes.Tailwind CSS Cheat SheetSearchable Tailwind class to CSS reference with live previews, class decoder and color palette.Web App Manifest GeneratorCreate a PWA manifest.json and every app icon size from one image, downloaded as a ZIP.CSS Background Pattern GeneratorMake pure-CSS stripes, dots, checkerboard, zigzag and grid backgrounds and copy the code.CSS Color Filter GeneratorTurn a HEX color into a CSS filter that recolors black icons and SVGs, with an accuracy score.
See all 52 Web, HTML & CSS Tools →