CSS Clip Path Generator

Generate CSS clip-path shapes visually. Drag polygon points, adjust circles and ellipses, and copy the generated code.

The CSS clip-path property clips an element to a shape, hiding everything outside it. Per MDN (February 2026), it accepts basic shape functions including polygon(), circle(), ellipse(), inset(), path(), rect(), xywh(), and the newer shape(). This generator provides a visual editor for the four core shapes with draggable polygon points, sliders for circles and ellipses, and a live preview you can copy as CSS.

Ad
Ad

About CSS Clip Path Generator

How the clip-path Shape Functions Work

Each shape function takes a set of numeric arguments and produces a clipping region inside the element's reference box (border-box by default). Coordinates can be lengths (px, rem) or percentages relative to the box, and percentages make the shape responsive as the element resizes.

FunctionSyntaxWhat It Does
polygon()polygon(<fill-rule>? x1 y1, x2 y2, ...)Creates a shape from connected points. Optional fill-rule is nonzero (default) or evenodd.
circle()circle(radius at cx cy)Circular clip with a centre position. Radius can be a length, percentage, or closest-side/farthest-side keyword.
ellipse()ellipse(rx ry at cx cy)Oval clip with horizontal and vertical radii.
inset()inset(top right bottom left round radius)Rectangular clip with adjustable insets from each edge and optional rounded corners.
path()path("M 0 0 L 100 0 ...")Accepts raw SVG path syntax. Supports curves and arcs but uses absolute pixel units only.
shape()shape(from x y, line to x y, ...)Per the Chrome for Developers blog, a newer CSS-native equivalent of path() that accepts percentages and CSS units for responsive curves. Cross-browser since early 2026.

Worked example: The pentagon preset outputs clip-path: polygon(50% 0%, 100% 38%, 19% 100%, 0% 38%, 81% 100%);. Each pair is an x,y coordinate as a percentage of the box. Point 1 is the top apex (50% across, 0% down), point 2 is the upper-right (100%, 38%), and so on. Because the coordinates are percentages, the same CSS renders a scaled pentagon on a 100x100 avatar, a 400x300 card, or a full-width hero.

Common Polygon Shapes

The preset buttons load these shapes as starting points. You can drag any point afterwards to customise.

ShapePointsCSS
Triangle3polygon(50% 0%, 100% 100%, 0% 100%)
Diamond4polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%)
Pentagon5polygon(50% 0%, 100% 38%, 81% 100%, 19% 100%, 0% 38%)
Hexagon6polygon(25% 0%, 75% 0%, 100% 50%, 75% 100%, 25% 100%, 0% 50%)
Chevron6polygon(0% 0%, 75% 0%, 100% 50%, 75% 100%, 0% 100%, 25% 50%)
Arrow right7polygon(0% 20%, 60% 20%, 60% 0%, 100% 50%, 60% 100%, 60% 80%, 0% 80%)
Star10Alternating inner and outer radii around a centre point
Cross12polygon(33% 0%, 67% 0%, 67% 33%, 100% 33%, 100% 67%, 67% 67%, 67% 100%, 33% 100%, 33% 67%, 0% 67%, 0% 33%, 33% 33%)

Most decorative shapes can be built from 3 to 12 points. Stars and gears may need 16-24. Beyond that, the shape() or path() functions are more practical than hand-placing coordinates.

When Should You Use clip-path vs border-radius?

Use border-radius for rounded corners on rectangles. Use clip-path when you need non-rectangular shapes like triangles, hexagons, stars, diagonal edges, or custom paths. The key behavioural differences matter for layout and interaction.

Concernclip-pathborder-radius
Shape varietyAny shape - polygons, circles, custom outlinesRounded rectangles, circles, ellipses only
Content outside shapeCompletely hidden (clipped)Still present, visible at corners unless overflow: hidden
Layout boxElement still occupies full rectangle for layoutElement still occupies full rectangle
Clickable areaOnly the clipped region receives pointer eventsFull rectangle remains interactive
Box shadowShadow follows the rectangular box, not the clip (use drop-shadow filter instead)Shadow follows the rounded corners
PerformanceHardware-accelerated in modern browsersHardware-accelerated
AnimationInterpolates between shapes with matching function and point countEasily animatable

A common mistake is expecting a drop shadow to follow the clipped silhouette. It will not - box-shadow traces the element's geometric box. To cast a shadow along a clipped shape, apply filter: drop-shadow(0 4px 6px rgba(0,0,0,0.2)) to a wrapping element instead. The CSS Box Shadow Generator covers the rectangular shadow case.

Practical Uses for clip-path

Use CaseShapeNotes
Hero section dividerAngled polygonClip the bottom of a hero with polygon(0 0, 100% 0, 100% 90%, 0 100%) for a diagonal edge
Image masksCircle, polygon, customCrop photos into non-rectangular frames without editing the source file
Reveal animationscircle() growing from 0%Animate the radius from 0 to 100% for a spotlight reveal
Card corner cutsPolygon with notched cornersCyberpunk or ticket-stub card designs
Page transitionsInset or polygon wipeUsed on award-winning sites like Apple product pages for scroll-driven section reveals
Scroll-triggered revealsinset() changing valuesAnimate inset from the edges inward to reveal content
Avatar shapesHexagon, squircleDistinctive profile pictures without SVG masking overhead

In the real world, clip-path is most commonly used for diagonal section dividers (the "angled hero" look popularised by startup marketing sites around 2017 and still in active use) and for decorative image masks. Geometric shapes like hexagons for team member avatars are another recurring pattern.

Animating clip-path

The browser interpolates clip-path values smoothly when both keyframes use the same shape function and, for polygon(), the same point count. Use a simple CSS transition:

.card { clip-path: circle(0% at 50% 50%); transition: clip-path 0.6s ease; }
.card:hover { clip-path: circle(100% at 50% 50%); }

This creates a radial reveal on hover. For polygon animations, pad the smaller shape with duplicate points so both states have the same count - otherwise the shape snaps instead of tweening. The newer shape() function handles this automatically and can interpolate between curves, lines, and arcs, which is why Chrome's CSS team positions it as the replacement for path() going forward (per developer.chrome.com, 2025).

Browser Support and Fallbacks

Per caniuse.com, clip-path with basic shapes has over 97% global support as of April 2026. Chrome, Firefox, Safari, and Edge all support polygon(), circle(), ellipse(), and inset() without prefixes on current versions. Safari historically needed -webkit-clip-path; modern Safari accepts the unprefixed property, but shipping both is still the safest pattern for older installs:

-webkit-clip-path: polygon(50% 0%, 100% 100%, 0% 100%);
clip-path: polygon(50% 0%, 100% 100%, 0% 100%);

The shape() function reached cross-browser support in Chrome 139 (early 2026) and Firefox ships it in the current stable channel. For broader reach, path() remains the fallback for complex curves. For rounded rectangles without clipping, use the CSS Border Radius Generator.

The Reference Box: border-box, padding-box, and Beyond

By default, clip-path measures percentages against the element's border-box. You can change this by adding a geometry keyword after the shape function, which becomes important when the element has padding or border widths that affect the visible area:

clip-path: circle(50% at center) padding-box;

The five accepted reference boxes are margin-box, border-box (default), padding-box, content-box, and fill-box (for SVG elements). A 50% circle in a 200px-wide box with 20px padding produces a different visual radius under padding-box than under border-box - the padding-box version is centred on a 160px region. This is rarely needed for straightforward UI work but becomes essential when clipping elements that have thick borders or decorative padding. The MDN specification documents this as the <geometry-box> component of the property grammar.

Performance Considerations

clip-path is GPU-accelerated in Chrome, Safari, and Firefox for basic shapes, making it cheap to animate at 60fps on modern devices. A 2024 analysis by the Chrome DevTools team showed that clip-path transitions on polygons under 20 points stay well under the 16ms frame budget on mid-range mobile hardware. However, animating clip-path with path() or very complex polygons (50+ points) can drop frames on low-end Android devices - profile with the Rendering tab in DevTools if you hit this ceiling. For heavy reveal effects, consider mask-image as an alternative: it can leverage cached bitmap masks where clip-path recomputes on every frame.

Common Mistakes and Gotchas

Several issues trip up developers new to clip-path:

  • Shadows disappearing. box-shadow is clipped along with the element. Move the shadow to a wrapping div as a drop-shadow filter.
  • Hover states on notched corners. The clicked corner is hidden but still in the layout. Users can hover "empty space" and trigger the element. Combine with pointer-events: none on the wrapper if this matters.
  • Animating polygon with different point counts. The browser cannot tween 4 points into 6 - the shape jumps. Pad both states to the same count.
  • path() not scaling. path() coordinates are pixels, not percentages. Use shape() for responsive curves.
  • clip-path on fixed-position elements. Before Safari 16, clip-path on position: fixed elements inherited the viewport as the reference box unexpectedly. Test on older iOS if your audience skews that way.
  • Text selection beyond the clip. Selected text can extend outside the visible shape because the text nodes still exist at full size. Consider overflow: hidden on the parent to contain selection highlights.

For layered depth effects behind clipped shapes, pair this with the CSS Box Shadow Generator on a wrapper. Everything on this page runs in your browser; no CSS is uploaded anywhere.

Sources

Frequently Asked Questions

What clip-path shapes are supported?

The tool supports all standard CSS clip-path shapes. Polygon lets you create custom shapes with any number of points. Circle creates a circular clip. Ellipse creates an oval clip. Inset creates a rectangular clip with optional rounded corners.

How do I drag polygon points?

In polygon mode, white circle handles appear on the preview at each point. Click and drag any handle to reposition it. The coordinates update in real time and the CSS output reflects the new positions instantly. You can also add or remove points from the list below.

Can I use an image as the preview background?

Yes. Toggle the "Image preview" checkbox to see your clip path applied to a sample photograph. This is useful for visualizing how the shape will mask real content. When toggled off, a solid color is used instead.

What is the inset shape for?

The inset shape creates a rectangular clip with adjustable margins on each side. It is useful for cropping elements without polygon complexity. The optional round parameter adds border radius to the inset rectangle.

Is this tool free and private?

Completely free with no account needed. All calculations run in your browser. Nothing is uploaded to any server, so your work remains private.

Link to this tool

Copy this HTML to link to this tool from your website or blog.

<a href="https://toolboxkit.io/tools/css-clip-path-generator/" title="CSS Clip Path Generator - Free Online Tool">Try CSS Clip Path Generator on ToolboxKit.io</a>