CSS transform-origin Property

Beginner
5 min read
Updated: Oct 2026
3 examples
Live preview

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.

CSS Syntax

syntax.css
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).

Property Values

ValueDescriptionTry it
centerDefault pivot — middle of the elementTry it
top leftPivot at the top-left cornerTry it
bottom rightPivot at the bottom-right cornerTry it
LengthsAbsolute offsets such as 50px 20pxTry it
PercentagesRelative to the element box, such as 0% 50%Try it
right topKeyword order can be y then x for keyword pairsTry it

How to Use transform-origin

Pick a pivot, then apply a transform so you can see it.

  1. Apply a transform (often rotate() or scale()) with transform.
  2. Set transform-origin to the point that should stay fixed.
  3. Use keywords for corners/edges, or lengths/percentages for precise offsets.
  4. For 3D, add a third length for the z origin when needed.

Live Preview

The blue box is rotated 45deg. Change only transform-origin and watch how the pivot moves.

Rotation stays at 45deg. Only the origin changes.

Box
45°

transform-origin: center

CSS Examples

Each snippet uses rotate(45deg) so the origin is easy to see. Use Try It Yourself for a live editor.

Example 1 — Center Origin

The default pivot — the box spins around its middle.

CSS
<style>
  .box {
    transform: rotate(45deg);
    transform-origin: center;
  }
</style>

<div class="box">Box</div>
Try It Yourself

How It Works

  1. Apply a transform. rotate(45deg) turns the box.
  2. Set the pivot. center is the same as 50% 50%.
  3. Middle stays put. Corners swing around the center point.
  4. Default behavior. Omitting transform-origin looks the same.

Example 2 — Top-Left Corner

Rotate around a corner so the box swings from that point.

CSS
<style>
  .box {
    transform: rotate(45deg);
    transform-origin: top left;
  }
</style>

<div class="box">Box</div>
Try It Yourself

How It Works

  1. Same rotate. Still 45deg — only the origin changes.
  2. Corner keywords. top left pins the pivot to that corner.
  3. Swing effect. The rest of the box orbits around top-left.
  4. 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.

CSS
<style>
  .box {
    transform: rotate(45deg);
    transform-origin: 0% 50%;
  }
</style>

<div class="box">Box</div>
Try It Yourself

How It Works

  1. x = 0%. The horizontal origin is the left edge.
  2. y = 50%. The vertical origin is halfway down.
  3. Relative to the box. Percentages use the element’s size, not the parent.
  4. 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.

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.

97% Browser support
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.

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

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%).
The default is 50% 50% (center), with a z offset of 0 when a third value is used.
It only has a visible effect when a transform is applied. Alone it does not move the element.
Yes. Keywords such as top, bottom, left, right, and center can set the origin, for example transform-origin: top left.
No. Each element sets its own pivot point.
It is Baseline and widely available since about September 2015. It is a browser CSS property, not a Node.js feature.

Next: transform-style

Learn how nested elements keep a 3D transform context.

transform-style tutorial →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

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