CSS rotate Property

Beginner
⏱️ 6 min read
📚 Updated: Jun 2026
🎯 4 Examples
Transforms

What You’ll Learn

The rotate property turns an element by a chosen angle. It is part of the modern CSS transforms module and works great for icons, cards, and playful UI motion.

01

deg

Degrees.

02

turn

Full spins.

03

none

No rotation.

04

origin

Pivot point.

05

hover

Animations.

06

2D

Flat rotation.

Introduction

The rotate property in CSS is used to rotate elements in a two-dimensional space. This transformation is part of the CSS Transforms module and allows you to rotate elements by a specified angle.

This property is particularly useful for creating dynamic and visually interesting web designs.

Definition and Usage

Use rotate when you want a simple angle change without writing the full transform shorthand. It pairs naturally with transition for hover effects on buttons and icons.

You may also see the older form transform: rotate(45deg). Both rotate the element, but the standalone rotate property is cleaner when rotation is the only transform you need.

💡
Beginner Tip

Rotation happens around transform-origin. The default pivot is the center of the element, which is why a square turned 45deg looks like a diamond.

📝 Syntax

The syntax for the rotate property is straightforward. You can specify the angle of rotation using degrees, gradians, radians, or turns.

syntax.css
element {
  rotate: angle;
}

Here, angle can be a value in degrees (deg), gradians (grad), radians (rad), or turns (turn).

Basic Example

rotate-45deg.css
.rotate-box {
  rotate: 45deg;
}

Syntax Rules

  • Positive angles rotate clockwise in the default 2D coordinate system.
  • Negative angles rotate counter-clockwise, such as -15deg.
  • none removes rotation.
  • 1turn equals a full 360-degree rotation.
  • Set transform-origin to change the pivot point.
  • Animate rotate with transition for smooth effects.

🎯 Default Value

The default value of the rotate property is none, which means no rotation is applied. This is equivalent to 0deg visually.

⚡ Quick Reference

QuestionAnswer
Default valuenone (same visual effect as 0deg)
Common unitsdeg, turn
Pivot controltransform-origin
InheritedNo
AnimatableYes
Classic equivalenttransform: rotate()

💎 Property Values

ValueExampleDescription
degreesrotate: 45deg;A value in degrees, such as 45deg, 90deg, etc.
gradiansrotate: 50grad;A value in gradians, such as 50grad.
radiansrotate: 0.5rad;A value in radians, such as 0.5rad.
turnsrotate: 0.25turn;A value in turns, such as 0.25turn for a quarter spin.
nonerotate: none;No rotation is applied.
45deg 90deg 0.25turn -15deg none

When Does rotate Matter?

rotate is the right tool when a visual angle change improves the design:

  • Icons — Spin a refresh or chevron icon on hover.
  • Labels — Tilt badges or stickers for a playful look.
  • Cards — Rotate featured tiles slightly for emphasis.
  • Loading states — Animate continuous rotation for spinners.

Use rotation sparingly on body text because tilted paragraphs are harder to read.

👀 Live Preview

The square below uses rotate: 45deg, turning it into a diamond shape.

Default pivot is the center of the box.

Examples Gallery

Start with the reference 45-degree square, compare common angles, try turns, and animate rotation on hover.

🔄 Basic Rotation

Rotate a simple shape by a fixed angle — matching the reference example.

Example 1 — Square Rotated 45deg

In this example, we’ll rotate a square div by 45 degrees.

rotate-box.html
<style>
  .rotate-box {
    width: 100px;
    height: 100px;
    background-color: lightblue;
    rotate: 45deg;
  }
</style>

<div class="rotate-box"></div>
Try It Yourself

How It Works

The element keeps its layout box, but its painted shape turns 45 degrees around the transform origin.

Example 2 — Compare Common Angles

Try 0deg, 45deg, and 90deg to see how the same shape changes at different rotations.

rotate-angles.html
<style>
  .a { rotate: 0deg; }
  .b { rotate: 45deg; }
  .c { rotate: 90deg; }
</style>
Try It Yourself

How It Works

Degrees are the most readable unit for beginners. A full circle is 360deg.

🔢 Units & Motion

Use turns for spinners and transitions for interactive rotation.

Example 3 — Rotate with turn Units

0.25turn equals 90deg. Turns are handy when you think in fractions of a full spin.

rotate-turn.html
<style>
  .card {
    rotate: 0.25turn;
    transform-origin: center;
  }
</style>
Try It Yourself

How It Works

1turn is one complete rotation. Use decimals like 0.5turn for half turns.

Example 4 — Hover Rotation

Animate rotate with transition to spin an icon when the user hovers a button.

rotate-hover.html
<style>
  .icon {
    rotate: 0deg;
    transition: rotate 0.35s ease;
  }

  button:hover .icon {
    rotate: 180deg;
  }
</style>
Try It Yourself

How It Works

Because rotate is animatable on its own, you do not need to transition the entire transform shorthand.

rotate vs transform: rotate()

The standalone rotate property is the modern way to turn elements. The classic form is transform: rotate(45deg), which still appears in many codebases.

Control the pivot with transform-origin. Combine rotation with scale and translate when building richer transform effects.

rotate-and-origin.css
.badge {
  transform-origin: top left;
  rotate: -12deg;
}

🧠 How rotate Works

1

Pick an angle

Choose deg, turn, rad, or grad.

rotate
2

Find the pivot

transform-origin decides which point stays fixed during rotation.

origin
3

Apply the transform

The browser rotates the element visually in 2D space.

Render
=

Dynamic visuals

Icons, cards, and UI details gain motion and personality with a simple angle change.

Browser Compatibility

The rotate property is supported in all modern browsers, including the latest versions of Chrome, Firefox, Safari, Edge, and Opera. However, it is always a good practice to test your website across different browsers to ensure compatibility.

Transforms · Modern support

Reliable rotate support

Current Chrome, Firefox, Safari, Edge, and Opera support the standalone rotate property. Older browsers may need transform: rotate().

96% Modern browser support
Google Chrome 104+ · Desktop & Mobile
Full support
Mozilla Firefox 72+ · Desktop & Mobile
Full support
Apple Safari 14.1+ · macOS & iOS
Full support
Microsoft Edge 104+ · Chromium
Full support
Opera 90+ · Modern versions
Full support

Testing tip

If you must support very old browsers, provide transform: rotate() as a fallback alongside rotate.

rotate property 96% supported

Bottom line: The standalone rotate property is safe in modern projects; use transform: rotate() only when you need older fallback support.

Conclusion

The rotate property is a powerful tool for web developers looking to add dynamic transformations to their elements.

By rotating elements, you can create engaging and visually appealing designs. Experiment with different angles and see how this property can enhance the look and feel of your web projects.

💡 Best Practices

✅ Do

  • Start with simple deg values like 45deg or 90deg
  • Set transform-origin when the pivot matters
  • Use transition: rotate for smooth hover motion
  • Keep text mostly unrotated for readability
  • Provide transform: rotate() fallback only when needed

❌ Don’t

  • Rotate large blocks of body copy
  • Forget that layout space may not match the visual angle
  • Overuse spin animations on every icon
  • Mix too many transforms without testing on mobile
  • Assume rotate changes document flow like width or height

Key Takeaways

Knowledge Unlocked

Five things to remember about rotate

Use these points when turning elements in CSS.

5
Core concepts
02

deg

Easy angles.

Pattern
03

turn

Full spins.

Use case
04

origin

Pivot point.

Companion
🔄 05

transition

Smooth spin.

Motion

❓ Frequently Asked Questions

rotate turns an element around its transform origin by a given angle. Positive values rotate clockwise in the default coordinate system.
rotate is a standalone transform property. transform: rotate() is the older shorthand function form. Both rotate elements, but rotate is easier to animate and compose with other individual transform properties.
The initial value is none, which means no rotation is applied. Visually this matches 0deg.
Common units are deg, turn, rad, and grad. Beginners usually start with deg or turn.
Rotation happens around transform-origin. Change transform-origin to center, top left, or another point to control the pivot.

Practice in the Live Editor

Open the HTML editor and rotate a square with rotate: 45deg.

HTML Editor →

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.

5 people found this page helpful