Drag points or focus one and use the arrow keys · click a + dot to add a point · Alt-click a point to remove it
Presets
Edit points by number (6)
.element {
clip-path: polygon(25% 0%, 75% 0%, 100% 50%, 75% 100%, 25% 100%, 0% 50%);
-webkit-clip-path: polygon(25% 0%, 75% 0%, 100% 50%, 75% 100%, 25% 100%, 0% 50%);
}How to use
Pick a starting shape
Choose one of the 21 presets, click Circle, Ellipse or Inset for slider shapes, or use Import SVG or Trace PNG to start from your own artwork. Preview image puts your photo behind the shape.
Adjust the points
Drag the blue handles, click a + dot to add a point, Alt-click to remove one, or focus a handle and use the arrow keys. Set Snap to grid or type values under Edit points by number.
Copy the CSS or download a PNG
Pick CSS, Value only, Tailwind or Hover reveal and copy it. Download PNG saves the clipped image at the chosen aspect ratio, and Copy share link keeps the shape in a URL.
Why CSS Clip Path Generator
- 21 polygon presets plus circle, ellipse and inset modes.
- Import an SVG or trace a transparent PNG into an editable polygon.
- Snap to grid, arrow-key nudging, number fields and four preview aspect ratios.
- CSS, Tailwind and hover snippets, PNG download and share links.
Tracing a PNG into a clip-path polygon
Trace PNG turns a raster image into a shape you can use in CSS. It scales the image down to at most 220 pixels wide, marks every pixel as solid or empty, and walks around the edge of the largest solid area to get its outline. That outline can have hundreds of points, so the tool simplifies it with the Ramer-Douglas-Peucker method, which drops points that barely change the shape.
The result is a polygon() in percentages that scales with the element. The Trace detail slider controls how aggressive the simplification is: move it left for more points and a closer fit, right for fewer points and shorter CSS.
Tips for a clean trace:
- Use a PNG with a transparent background. Without transparency, only near-white pixels are treated as background.
- Only the largest shape is traced. Holes and separate parts, like the dot on an i, are ignored.
- Simple, bold silhouettes give short polygons. Detailed illustrations need many points and may look jagged.
clip-path shape functions at a glance
All five functions are supported in current browsers. The first four use values that can be percentages, so they adapt to the element size. Percentages in circle() are measured against a blend of the width and height, so a circle stays round on a rectangle.
Any of these values can also be transitioned. Two polygon() values animate smoothly only when they have the same number of points, so duplicate a point if one shape needs fewer corners than the other.
| Function | Example | Use it for |
|---|---|---|
| polygon() | polygon(50% 0%, 100% 100%, 0% 100%) | Any straight-edged shape |
| circle() | circle(40% at 50% 50%) | Round avatars and spotlights |
| ellipse() | ellipse(45% 30% at 50% 50%) | Oval crops |
| inset() | inset(10% 10% 10% 10% round 16px) | Rectangles with margins or rounded corners |
| path() | path('M0 0 L100 0 L50 80 Z') | Exact SVG curves at a fixed pixel size |