What is a CSS clip-path generator?
The clip-path property cuts an element into a shape. Everything outside the shape is hidden, so a plain rectangular image or card can become a triangle, a hexagon, a circle or an arrow without editing the image. The shape is described with a function: polygon() for any straight-sided figure, circle(), ellipse() and inset() for the basic ones. Writing a polygon by hand means guessing percentages and reloading the page, which is slow.
This generator lets you build the shape visually. Pick one of the 12 ready shapes or drag the points of a polygon on the preview, with the mouse, by touch or with the keyboard. You can also switch to circle, ellipse or inset and use sliders. The CSS updates as you go, and you can copy it as CSS or as a Tailwind class. It can also read a clip-path you paste. It runs in your browser and nothing is sent anywhere.
How to create a clip-path
- Pick the "Shape type": Polygon, Circle, Ellipse or Inset. Or paste an existing value into "Paste a CSS to edit".
- In Polygon mode, start from "Ready shapes": Triangle, Trapezoid, Parallelogram, Rhombus, Pentagon, Hexagon, Octagon, Star, Cross, Arrow, Chevron or Message.
- Drag the round handles on the preview. You can also focus a handle and use the arrow keys (Shift moves 10%). Double-click the shape to add a point, and press Delete to remove the focused one.
- For exact values, use the X and Y fields under "Points of the polygon". "Add a point after the selected one" adds a point and "Remove" deletes one. A polygon needs at least 3 points.
- In Circle and Ellipse mode set the radius and the center. In Inset mode set Top, Right, Bottom, Left (up to 50%) and the "Corner radius" in px.
- Check the preview on light and dark, choose CSS or Tailwind under "Format" and copy with "Copy CSS".
Examples
A triangle
Pick the Triangle shape. The output is:
clip-path: polygon(50% 0, 100% 100%, 0 100%);The points are the top center, the bottom right and the bottom left. A zero is written without the percent sign. As a Tailwind class, the spaces become underscores:
[clip-path:polygon(50%_0,100%_100%,0_100%)]A regular hexagon
The Hexagon shape places six points on a circle that fits the box:
clip-path: polygon(100% 50%, 75% 93.3%, 25% 93.3%, 0 50%, 25% 6.7%, 75% 6.7%);Circle, ellipse and inset
The three basic functions with the tool's starting values:
clip-path: circle(50% at 50% 50%);
clip-path: ellipse(50% 35% at 50% 50%);
clip-path: inset(10% round 12px);circle(50% at 50% 50%) is the biggest circle centered in the box. inset(10% round 12px) trims 10% from every side and rounds the new corners by 12 px. When the opposite sides match, the output is shortened, so Top 0, Right 10%, Bottom 0, Left 10% gives inset(0 10%).
Common mistakes
- Pasting values in px. The paste field reads percentages (and a lone 0). Convert px to % first, or the tool shows an error.
- Using functions that are not supported here. Keywords like
closest-side, thepath()function and theevenoddrule are not read. Use polygon, circle, ellipse or inset. - Expecting a hidden part to stay clickable. The clipped area does not receive clicks or hover. This is useful, but it surprises people.
- Clipping shadows and outlines.
clip-pathalso cutsbox-shadowandoutline. Put the shadow on a parent element, or usefilter: drop-shadow()on the parent. See the box-shadow generator. - Fewer than three points. A polygon needs three points. The "Remove" button is disabled when only three are left.
- Forgetting the box. Percentages refer to the element box. If the element has a different size at another breakpoint, the shape scales with it.
FAQ
Can I animate a clip-path?
Yes, when both states use the same function with the same number of points. A polygon with 6 points can animate to another polygon with 6 points. Build the two shapes here and drive the change with the animation generator.
What is the difference between clip-path and border-radius?
border-radius only rounds corners. clip-path can cut any shape, but it also removes shadows and borders outside the shape. For plain rounding, use the border-radius generator.
How do I make a polygon with more points?
Double-click the shape on the preview to add a point, or use "Add a point after the selected one". Then drag it where you want.
Does clip-path work in all browsers?
polygon(), circle(), ellipse() and inset() work in all current browsers, without a prefix.