The transform-origin property sets the pivot point for CSS transforms — controlling where rotation, scaling, and skewing appear to happen.
01
Pivot
Origin point.
02
center
Default.
03
Keywords
top left.
04
% / px
Exact spot.
05
rotate
Spin around.
06
scale
Grow from edge.
Fundamentals
Introduction
The transform-origin property in CSS is used to change the position of the origin of a transformation. By default, transformations like rotate, scale, and skew are performed around the center of an element.
The transform-origin property allows you to adjust this point to a different location within the element.
Definition and Usage
Use transform-origin when the default center pivot does not look right — for example, a door swinging from a hinge on the left, or an icon scaling from the bottom edge.
💡
Beginner Tip
transform-origin does not move the element by itself. It only changes the anchor point used by transform functions like rotate() and scale().
Foundation
📝 Syntax
The syntax for the transform-origin property is straightforward. You can specify one, two, or three values to set the origin point along the x-axis, y-axis, and z-axis.
syntax.css
element{transform-origin:x-axis y-axis z-axis;}
x-axis — Defines where the transformation’s x-origin is located.
y-axis — Defines where the transformation’s y-origin is located.
z-axis (optional) — Defines where the transformation’s z-origin is located.
Two values set x and y. Keywords or lengths are allowed.
Three values add a z-axis origin for 3D transforms.
Must be paired with a transform to see a visual effect.
The property is not inherited.
Related Properties
transform — applies the actual rotation, scale, or skew
perspective — adds depth for 3D transform origins
transform-style — preserves 3D space for child elements
transition — animates transform changes smoothly
Defaults
🎯 Default Value
The default value of the transform-origin property is 50% 50% 0, which means the transformation is performed around the center of the element along the x and y axes, with no offset along the z-axis.
Cheat Sheet
⚡ Quick Reference
Question
Answer
Default value
50% 50% 0 (center)
Rotate from top-left
transform-origin: top left;
Scale from bottom
transform-origin: bottom center;
Exact pixel pivot
transform-origin: 20px 40px;
Needs transform?
Yes
Inherited
No
Reference
💎 Property Values
The transform-origin property accepts lengths, percentages, and keywords.
Value
Example
Description
length
transform-origin: 10px 20px;
A length value (e.g., 10px, 2em) that defines the origin point.
percentage
transform-origin: 50% 0%;
A percentage value relative to the element’s size.
keyword
transform-origin: top left;
Keywords such as top, bottom, left, right, and center.
z-axis (optional)
transform-origin: center 50% 100px;
A length or percentage defining the z-axis origin for 3D transforms.
centertop left50% 50%10px 20px
Context
When to Use transform-origin
transform-origin matters whenever the pivot point changes the visual effect:
Door or panel animations — Rotate from left center like a hinge.
Dropdown menus — Scale from top center so they expand downward.
Loading spinners — Keep center for symmetric rotation.
Card flip effects — Set z-origin for 3D flip animations.
Preview
👀 Live Preview
Same rotate(30deg) with different origin points:
center
top left
bottom center
Hands-On
Examples Gallery
In this example, we’ll change the transform origin of a square to the top left corner and rotate it by 45 degrees.
📜 Basic Origins
Change the pivot point and see how the same transform looks different.
Example 1 — Rotate from top left
In this example, we’ll change the transform origin of a square to the top left corner and rotate it by 45 degrees.
CSS defines the x, y, and optional z pivot with keywords or lengths.
Pivot
3
Transform applies around pivot
The element rotates, scales, or skews relative to that anchor point.
Effect
=
✅
Controlled motion
The same transform feels completely different with a new origin.
Compatibility
Browser Compatibility
The transform-origin property is supported in all modern browsers, including the latest versions of Chrome, Firefox, Safari, Edge, and Opera. Ensure that your website is tested across different browsers to confirm compatibility.
✓ Universal · All modern browsers
Reliable pivot control
2D and 3D transform origins work in all current major browsers without vendor prefixes.
99%Browser support
Google Chrome36+ · Desktop & Mobile
Full support
Mozilla Firefox16+ · Desktop & Mobile
Full support
Apple Safari9+ · macOS & iOS
Full support
Microsoft Edge12+ · All versions
Full support
Opera23+ · All versions
Full support
Testing tip
Verify 3D flip animations with z-axis origins in Safari and Firefox on mobile devices.
transform-origin property99% supported
Bottom line:transform-origin is safe to use for transform animations in all modern browsers.
Wrap Up
Conclusion
The transform-origin property is an essential tool for web developers looking to create complex and visually engaging transformations.
By adjusting the origin point of transformations, you can achieve a wide range of effects and animations that enhance the user experience. Experiment with different origin points and see how this property can elevate your web designs.