For years, web elements were confined to rectangles and circles. Images were square, buttons were rectangular, and creative layouts required complex workarounds with floats, positioning, and background images. Then clip-path arrived — and suddenly, any shape you could describe with coordinates was possible.
clip-path lets you clip an element to any shape: polygons, circles, ellipses, or completely custom paths. It's one of the most powerful CSS properties for creative design, yet many developers underuse it. In this guide, we'll cover every aspect of clip-path, from basic shapes to advanced animations, and show you how a CSS clip-path generator can make shape creation effortless.
clip-path?The clip-path property defines a clipping region that determines which parts of an element are visible. Everything inside the clipping region is rendered; everything outside is hidden. Think of it as a cookie cutter for web elements.
Unlike border-radius (which only rounds corners), clip-path can create virtually any geometric shape. It applies to the entire element — including backgrounds, borders, images, and child content — without affecting layout.
The clip-path property accepts several shape functions:
circle()Clips an element into a circle. Takes a radius and a center position:
/* Circle centered at 50% 50% with 50% radius */
clip-path: circle(50% at 50% 50%);
/* Circle at top-right with specific radius */
clip-path: circle(80px at 80% 20%);
ellipse()Clips into an ellipse with separate horizontal and vertical radii:
/* Ellipse centered, wider than tall */
clip-path: ellipse(60% 40% at 50% 50%);
/* Ellipse shifted upward */
clip-path: ellipse(45% 35% at 50% 35%);
inset()Clips by inset distances from each edge, like an inner rectangle with optional rounding:
/* Simple inset */
clip-path: inset(20px 40px 20px 40px);
/* Inset with rounded corners */
clip-path: inset(10px round 20px);
/* Asymmetric inset with different corner radii */
clip-path: inset(5% 10% 5% 10% round 10px 0 10px 0);
polygon() — The Most Powerful ShapeDefines a polygon by specifying vertex coordinates as percentages or lengths. This is where clip-path truly shines:
/* Triangle pointing up */
clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
/* Pentagon */
clip-path: polygon(50% 0%, 100% 38%, 82% 100%, 18% 100%, 0% 38%);
/* Hexagon */
clip-path: polygon(25% 0%, 75% 0%, 100% 50%, 75% 100%, 25% 100%, 0% 50%);
/* Star (5-point) */
clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
/* Diamond */
clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%);
/* Arrow pointing right */
clip-path: polygon(0% 20%, 60% 20%, 60% 0%, 100% 50%, 60% 100%, 60% 80%, 0% 80%);
path() — SVG Path DataFor complex shapes, you can use SVG path syntax directly:
/* Heart shape using SVG path */
clip-path: path('M 0,200 C 0,100 100,0 200,0 C 300,0 400,100 400,200 C 400,350 200,500 200,500 C 200,500 0,350 0,200 Z');
The path() function supports the full SVG path syntax including curves, arcs, and complex shapes. It's the most flexible option but requires understanding SVG path commands.
Here are the most frequently used shapes in web design:
polygon(50% 0%, 0% 100%, 100% 100%)
polygon(25% 0%, 75% 0%, 100% 50%, 75% 100%, 25% 100%, 0% 50%)
polygon(50% 0%, 100% 38%, 82% 100%, 18% 100%, 0% 38%)
polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%)
polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%)
polygon(20% 0%, 80% 0%, 100% 100%, 0% 100%)
One of the most exciting features of clip-path is that it's animatable — and it performs well because it's typically GPU-composited. This opens the door to creative reveal animations, transitions, and morphing effects.
.reveal {
clip-path: circle(0% at 50% 50%);
transition: clip-path 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}
.reveal.visible {
clip-path: circle(100% at 50% 50%);
}
This creates a smooth circular reveal — the element appears to expand from a point. It's a popular effect for hero images and content transitions.
Morph between shapes by animating between polygon states with the same number of vertices:
.morph {
clip-path: polygon(50% 0%, 100% 38%, 100% 100%, 0% 100%, 0% 38%);
transition: clip-path 0.6s ease;
}
.morph:hover {
clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%, 25% 25%);
}
Both shapes must have the same number of points for the animation to interpolate correctly. The browser smoothly transitions each point from its start to end position.
.wipe-right {
clip-path: inset(0 100% 0 0);
animation: wipeIn 1s ease forwards;
}
@keyframes wipeIn {
to { clip-path: inset(0 0% 0 0); }
}
clip-path is especially powerful for images, allowing you to create shaped thumbnails, hero images, and decorative elements without any image editing:
/* Circular avatar */
.avatar {
clip-path: circle(50% at 50% 50%);
}
/* Hexagonal team photo */
.team-photo {
clip-path: polygon(25% 0%, 75% 0%, 100% 50%, 75% 100%, 25% 100%, 0% 50%);
}
/* Angled hero image */
.hero-img {
clip-path: polygon(0 0, 100% 0, 100% 85%, 0 100%);
}
Creating complex polygon shapes by manually calculating coordinate percentages is painful. A CSS clip-path generator solves this by providing:
clip-path is well-supported across modern browsers:
The path() function has slightly newer support — check Can I Use for the latest compatibility data if you're targeting older browsers.
border-radius only rounds corners. clip-path creates any shape. Use border-radius for simple rounding; clip-path for complex shapes.overflow: hidden clips to the rectangular bounding box. clip-path clips to any defined shape.mask-image controls opacity (grayscale masks). clip-path is a hard edge — pixels are either visible or hidden. Masks offer more nuance but are less performant.clip-path property with url(#id) can reference an SVG <clipPath> element. This is useful for complex reusable shapes.clip-path is one of the most versatile CSS properties available today. From simple circles to complex SVG paths, from static shapes to animated morphing effects, it gives you creative freedom that was previously only possible with images or SVGs. Combined with a clip-path generator, you can design and implement custom shapes in minutes rather than hours.
Use the free RiseTop Clip Path Generator — drag vertices on a canvas, choose from preset shapes, preview animations, and copy production-ready CSS instantly.
Back to Blog · RiseTop — Free CSS Tools for Designers & Developers