CSS Clip Path Generator

Build CSS polygon, circle, and ellipse clip masks visually using an interactive canvas with draggable handle points. Create custom shapes, section dividers, and image masks and export clean clip-path CSS instantly.

Shape Type
Preset Polygons

Drag handles on the canvas to reshape the clip boundary

Export CSS Code
Interactive Clip Canvas
polygon(0% 0%, 100% 0%, 100% 100%, 0% 100%)
Clip Preview
Polygon Point Coordinates
4 points

How CSS clip-path Works: Painting Boundaries with the Browser

The CSS clip-path property instructs the browser's rendering engine to restrict the paintable area of an element to a defined geometric shape. Conceptually, it is like applying a stencil over the element — anything outside the stencil boundary is simply not rendered, regardless of how the element's actual content or box model extends. This differs from overflow: hidden, which clips to the element's rectangle boundary and does create a new block formatting context that affects layout flow. The clip-path property, by contrast, never participates in layout — elements clipped by complex polygons still occupy their full rectangular grid space.

Under the hood, the browser evaluates the clip shape at paint time. For each pixel in the element's bounding box, the rendering engine tests whether that pixel's screen coordinates fall within the clip polygon using point-in-polygon math (the ray casting algorithm). Pixels that pass the test are painted normally; those that fail are discarded. This evaluation happens on the GPU for composited elements, making clip-path animations smooth and performant when combined with CSS transitions — the GPU simply re-evaluates the polygon boundary at each frame rather than sending repaint commands to the CPU.

Before & After: Square Section vs Diagonal Divider

❌ Before — Flat Section Break

.hero-section {
  background: #6366f1;
  /* Hard horizontal edge,
     no visual dynamism */
}

✅ After — Diagonal Clip Path Section

.hero-section {
  background: #6366f1;
  clip-path: polygon(
    0 0,
    100% 0,
    100% 88%,
    0 100%
  );
  /* Responsive diagonal cut */
}

Popular clip-path Shape Reference

Knowing a handful of common clip-path polygon values by heart can dramatically speed up your design workflow. These shapes are all fully responsive because they use percentage coordinates that scale with the element's bounding box. Each can be used as a starting template in this generator's preset panel.

Shape Name clip-path Value Typical Use
Triangle polygon(50% 0%, 0% 100%, 100% 100%) Tooltip arrows, decorative icons
Chevron Down polygon(0% 0%, 100% 0%, 100% 75%, 50% 100%, 0% 75%) Section dividers, navigation arrows
Diagonal Cut polygon(0 0, 100% 0, 100% 85%, 0 100%) Hero section bottom edges
Hexagon polygon(25% 0%, 75% 0%, 100% 50%, 75% 100%, 25% 100%, 0% 50%) Skill badges, avatar frames
Circle circle(50% at 50% 50%) Avatar thumbnails, icon containers

Common Mistakes & Troubleshooting

  • Box shadow is clipped away: The clip-path masks the element's paint output entirely — including its box-shadow. If you need a shadow on a clip-path shaped element, apply the shadow to a wrapper parent element using filter: drop-shadow() instead of box-shadow, as filter effects are applied after the compositing stage.
  • Animating between different point counts: CSS transitions on clip-path only work when the number of polygon points is identical in both states. If your hover state polygon has a different number of vertices than the default state, the transition will not interpolate — it jumps. Add phantom points (redundant stacked coordinates) to equalize the point count.
  • Pixel coordinates break responsiveness: Using pixel values in polygon() (e.g., polygon(0 0, 200px 0, 200px 150px)) creates a fixed-size clip that does not scale with the element. Always use percentage coordinates for fluid responsive layouts.
Best Practices for CSS clip-path
  • Always use percentage coordinates in polygon() for responsive clip shapes that scale with the element's bounding box.
  • Use filter: drop-shadow() on a wrapper element instead of box-shadow on the clipped element to preserve shadow effects.
  • When animating clip-path, ensure both states have identical numbers of polygon points — add redundant stacked points to simpler shapes.
  • Test clip-path shapes on iOS Safari 15+ specifically — older versions had known rendering issues with complex polygons.
  • Use clip-path: polygon() for section dividers in preference to SVG overlays — it is simpler, more maintainable, and requires no inline markup.

Frequently Asked Questions

What is CSS clip-path and how does it work?

The CSS clip-path property restricts the visible region of an element to a specific geometric shape, hiding all content that falls outside the defined boundary. Unlike overflow: hidden, clip-path does not create a new stacking context or affect layout flow — the element still occupies its original space in the document, but pixels outside the clip region are simply not painted. The browser evaluates the clip shape on every render frame, making clip-path animatable and GPU-accelerated when combined with CSS transitions or animations. It accepts shape functions including polygon(), circle(), ellipse(), inset(), and path() for arbitrary SVG path shapes.

What is the difference between clip-path: polygon() and clip-path: path()?

The polygon() function defines a clip region using a series of percentage or pixel coordinate pairs connected by straight edges — it can only create shapes with straight sides. The path() function accepts full SVG path syntax including cubic Bezier curves (C, c), quadratic curves (Q, q), and arcs (A, a), enabling smooth curved clip shapes. However, polygon() uses percentage coordinates which scale with the element, making it responsive out of the box, while path() uses absolute pixel coordinates by default, requiring additional CSS (like a path() with box sizing) to scale responsively. For most design tasks, polygon() with percentage coordinates is preferred.

How do I animate a clip-path shape transition in CSS?

CSS clip-path transitions require that both the starting and ending clip shapes have the same number and type of coordinate points. A polygon with 6 points can transition to another polygon with exactly 6 points — adding or removing vertices mid-transition is not supported and produces an abrupt jump. To animate between differently-shaped polygons, use a "morphing" technique where both shapes have the same point count but some points are stacked on top of each other (redundant points at the same coordinate) in the simpler shape. The CSS transition property targeting clip-path is GPU-composited in modern browsers, producing smooth 60fps shape morphing.

What are the browser support considerations for CSS clip-path?

The clip-path property with polygon(), circle(), ellipse(), and inset() shapes has excellent browser support across all modern browsers — Chrome 55+, Firefox 54+, Safari 9.1+, and Edge 79+. However, the path() function with SVG path syntax is newer and only reached full cross-browser support with Safari 15.4+ and Firefox 97+. The deprecated clip property (without the -path suffix) had different syntax and should not be used in new projects. The -webkit-clip-path prefix is no longer required for any currently supported browser version. Always test on iOS Safari specifically, as clip-path rendering has historically had edge cases on older iOS versions.

How does clip-path interact with hover effects and pointer events?

By default, pointer events (clicks, hovers, touch) still register on the full rectangular bounding box of the clipped element, not just the visible clip region. This means a user hovering over an area that appears visually empty due to clipping can still trigger hover styles — a counterintuitive behavior. To align pointer events with the clip boundary, set pointer-events: none on the clipped element and handle clicks on a sibling overlay element instead, or use the SVG clip-path attribute approach which does constrain pointer events to the visible clip region. This distinction is particularly important for interactive polygon-shaped buttons or image cards.

What percentage coordinate system does clip-path polygon() use?

The clip-path polygon() function uses a coordinate system relative to the element's reference box, which defaults to the border-box. The top-left corner of the element is 0% 0%, the top-right is 100% 0%, the bottom-right is 100% 100%, and the bottom-left is 0% 100%. The reference box can be changed using the box keyword after the shape — for example, clip-path: polygon(...) content-box will size the coordinate system relative to the content area instead of the border box. When using pixel coordinates instead of percentages, the clip shape is fixed in absolute pixel space and does not scale when the element is resized.

Can I use clip-path to create responsive diagonal section breaks?

Yes — diagonal section dividers are one of the most popular production uses of clip-path. A simple slanted bottom edge is achieved with: clip-path: polygon(0 0, 100% 0, 100% 90%, 0 100%). This creates a parallelogram-like cut where the bottom-right corner is at 90% height and the bottom-left is at 100% height, producing a left-to-right ascending diagonal. For a chevron or arrow shape, you would add a fifth midpoint: polygon(0 0, 100% 0, 100% 100%, 50% 85%, 0 100%). Because percentage coordinates are used, these shapes scale perfectly with any viewport width without modification.