A CSS clip path generator with draggable points
The clip-path property hides every part of an element outside a shape you define. This CSS clip path generator lets you build that shape visually: start from a preset, drag the corner handles on the preview, and copy a rule with coordinates already calculated. It covers the four basic shape functions: polygon(), circle(), ellipse() and inset().
Example output
The default hexagon produces:
.clipped {
-webkit-clip-path: polygon(25% 0%, 75% 0%, 100% 50%, 75% 100%, 25% 100%, 0% 50%);
clip-path: polygon(25% 0%, 75% 0%, 100% 50%, 75% 100%, 25% 100%, 0% 50%);
}
Each pair is an x and y position as a percentage of the element's box, listed clockwise from the top left. Because the values are percentages, the shape scales with the element. The prefixed line is only there for older Safari versions; current browsers use the unprefixed property.
The basic shapes are shorter:
clip-path: circle(40% at 50% 50%);
clip-path: ellipse(45% 30% at 50% 50%);
clip-path: inset(10% 10% 10% 10% round 12px);
Shapes and options
Polygon presets
The presets cover triangle, trapezoid, parallelogram, rhombus, pentagon, hexagon, heptagon, octagon, 5- and 6-point stars, cross, left and right arrows, left and right chevrons, a speech-bubble "message" shape, bevel, frame and a close "X". Once you drag any point the shape becomes custom, and you can keep editing it.
Editing points
- + Add point inserts a new point halfway between the selected point and the next one, so the outline does not change until you move it.
- Remove point deletes the selected point. A polygon needs at least three.
- With a handle focused, the arrow keys move it by 1% (5% with Shift). The readout under the buttons shows the exact position.
Circle, ellipse and inset
Circle takes a radius and a center; Ellipse has separate X and Y radii. Inset cuts a rectangle in from each edge and can round its corners in pixels, a quick way to crop an image with rounded corners without an extra wrapper.
Tips and common mistakes
- Shadows and outlines get clipped.
clip-pathremoves everything outside the shape, includingbox-shadow, borders and focus outlines. For a shadow, wrap the element and putfilter: drop-shadow()on the wrapper, which follows the clipped outline. - Hidden areas do not receive clicks. Pointer events only hit the visible shape, which is good for shaped buttons but can surprise you on large clipped images.
- Keep the aspect ratio. The preview box is square. On a wide element the same percentages stretch the shape; add
aspect-ratio: 1to keep a regular hexagon or star. - Animating polygons. Browsers can transition between two
polygon()values only when both have the same number of points. Use + Add point to give the start shape as many points as the target shape. - Layout is unchanged. The element still occupies its full rectangle, so neighboring content does not flow into the cut-away corners.
When to use clip-path vs other techniques
- For rounded corners and organic blobs, use border-radius; borders and shadows then follow the curve.
- For a small arrow on a tooltip, the classic border trick from the CSS triangle generator needs no clipping at all.
- For shapes with curves, holes or soft edges, an SVG or a CSS
maskis more flexible than basic shapes. - For reveal and wipe effects, clip-path pairs well with keyframes from the CSS animation generator.
Privacy
The shape is edited and the CSS generated entirely in your browser. The sample photo background is built into the page, and nothing is uploaded.