Home CSS Properties transform-origin Definition
Definition and Usage The transform-origin property sets the pivot point for an element’s transforms. For rotate , it is the center of rotation. For scale and skew, it is the fixed point the transform grows from.
The default is the element’s center (50% 50%). You can move it with keywords (top, left, …), lengths, or percentages. It only has a visible effect when a transform (or individual transform property) is applied. It is not inherited.
Baseline · Widely available. Not deprecated. Cross-browser since about September 2015. Safe for everyday 2D transforms.
Pivot tip. Use top left (or similar) when a card or icon should swing from a corner instead of spinning in place.
Syntax
CSS Syntax transform-origin: [ <length-percentage> | left | center | right | top | bottom ]{1,2} <length> ? | initial | inherit ;
1 value = horizontal (or a single keyword like top). 2 values = x then y (or keyword pairs like top left). 3 values = x, y, then a length for the z offset (3D).
Values
Property Values Value Description Try it centerDefault pivot — middle of the element Try ittop leftPivot at the top-left corner Try itbottom rightPivot at the bottom-right corner Try itLengths Absolute offsets such as 50px 20px Try itPercentages Relative to the element box, such as 0% 50% Try itright topKeyword order can be y then x for keyword pairs Try it
Approach
How to Use transform-origin Pick a pivot, then apply a transform so you can see it.
Apply a transform (often rotate() or scale()) with transform . Set transform-origin to the point that should stay fixed. Use keywords for corners/edges, or lengths/percentages for precise offsets. For 3D, add a third length for the z origin when needed. Try it
Live Preview The blue box is rotated 45deg. Change only transform-origin and watch how the pivot moves.
Code
CSS Examples Each snippet uses rotate(45deg) so the origin is easy to see. Use Try It Yourself for a live editor.
1. Center 2. Top left 3. Percentage Example 1 — Center Origin The default pivot — the box spins around its middle.
<style>
.box {
transform: rotate(45deg);
transform-origin: center;
}
</style>
<div class="box">Box</div> How It Works Apply a transform. rotate(45deg) turns the box.Set the pivot. center is the same as 50% 50%.Middle stays put. Corners swing around the center point.Default behavior. Omitting transform-origin looks the same.Example 2 — Top-Left Corner Rotate around a corner so the box swings from that point.
<style>
.box {
transform: rotate(45deg);
transform-origin: top left;
}
</style>
<div class="box">Box</div> How It Works Same rotate. Still 45deg — only the origin changes.Corner keywords. top left pins the pivot to that corner.Swing effect. The rest of the box orbits around top-left.Useful for menus. Dropdowns and cards often open from a corner.Example 3 — Percentage Origin Percentages are relative to the element’s own width and height.
<style>
.box {
transform: rotate(45deg);
transform-origin: 0% 50%;
}
</style>
<div class="box">Box</div> How It Works x = 0%. The horizontal origin is the left edge.y = 50%. The vertical origin is halfway down.Relative to the box. Percentages use the element’s size, not the parent.Same idea as left center. 0% 50% matches a left-edge midpoint pivot. Edge Cases & Pitfalls If the pivot looks wrong, one of these is usually why.
transform No transform, no visible change transform-origin alone does not move the element. Pair it with transform, rotate, scale, or similar.
translate Translate ignores the origin A pure translate() moves the whole box the same way. Origin mainly matters for rotate, scale, and skew.
percent Percentages use the element box 50% is half of the element’s own width or height — not the parent’s size.
order Keyword pairs can be swapped top left and left top both work for keyword pairs. With two lengths or percentages, the order is always x then y.
3d Z must be a length The optional third value is a length only (for example 20px). Percentages are not valid for the z offset.
Compatibility
Browser Support transform-origin is a browser CSS property for transform pivots. Node.js, Deno, and Bun do not apply it.
✓ Baseline · Widely available
transform-origin Chrome 36+, Firefox 16+, Safari 9+, Edge 12+, IE 9+. Widely available since September 2015.
Google Chrome 36+
Full support
Mozilla Firefox 16+
Full support
Apple Safari 9+
Full support
Microsoft Edge 12+
Full support
Opera 23+
Full support
Samsung Internet 4+
Full support
Internet Explorer 9+
Full support transform-origin Widely supported
Bottom line: Safe for modern and older sites that support CSS transforms. It is not a runtime API.
Remember
Key Takeaways Role: pivot point for rotate, scale, and skew.
Default: 50% 50% (center of the element).
Values: keywords, lengths, percentages; optional z length for 3D.
Needs a transform: without one, changing the origin does nothing visible.
One line: transform-origin sets where rotate and scale pivot — default is center.
Frequently Asked Questions What does the CSS transform-origin property do? It sets the pivot point for transforms such as rotate, scale, and skew. By default the origin is the center of the element (50% 50%).
What is the default value of transform-origin? The default is 50% 50% (center), with a z offset of 0 when a third value is used.
Does transform-origin work without a transform? It only has a visible effect when a transform is applied. Alone it does not move the element.
Can I use keywords like top left? Yes. Keywords such as top, bottom, left, right, and center can set the origin, for example transform-origin: top left.
Is transform-origin inherited? No. Each element sets its own pivot point.
Which browsers support transform-origin? It is Baseline and widely available since about September 2015. It is a browser CSS property, not a Node.js feature.
About the author Developer, cloud engineer, and technical writer
I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.
8 people found this page helpful
Helpful Share Copy link Suggestion