How to use the css clip path generator
- Choose a shape preset from the dropdown, or select Custom polygon to enter your own coordinates.
- Adjust the numeric fields such as radius, insets or corner rounding to fine-tune the shape.
- For custom polygons, type each vertex as
x,yon its own line using percentage values from 0 to 100. - Copy the generated
clip-pathCSS property and paste it into your stylesheet. - Check the SVG preview to confirm the shape looks correct before shipping it.
How the CSS clip-path property works
The CSS clip-path property defines a clipping region that determines which part of an element is visible. Anything outside the path is hidden. The most versatile function is polygon(), which accepts a comma-separated list of x and y coordinates. Each coordinate can be a percentage relative to the element's reference box.
For example, a triangle pointing up inside a square element uses three vertices: polygon(50% 0%, 0% 100%, 100% 100%). The first point sits at the top center, the second at the bottom left and the third at the bottom right. The browser connects these points in order and closes the path automatically.
Besides polygons, you can use circle(), ellipse() and inset(). A circle takes a radius and an optional center position: circle(50% at 50% 50%) draws a full circle inscribed in the element. An inset clips from each edge inward, and supports a round keyword for border radii.
Preset shapes reference
This clip-path generator includes several built-in shapes. Below is a reference table showing the exact CSS value each preset produces on a square element.
| Preset | CSS value |
|---|---|
| Triangle | polygon(50% 0%, 0% 100%, 100% 100%) |
| Trapezoid | polygon(20% 0%, 80% 0%, 100% 100%, 0% 100%) |
| Pentagon | polygon(50% 0%, 100% 38%, 82% 100%, 18% 100%, 0% 38%) |
| Hexagon | polygon(25% 0%, 75% 0%, 100% 50%, 75% 100%, 25% 100%, 0% 50%) |
| Star | polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%) |
| Arrow | polygon(40% 0%, 40% 20%, 100% 20%, 100% 80%, 40% 80%, 40% 100%, 0% 50%) |
You can modify any of these by switching to the custom polygon mode and adjusting the percentage coordinates.
Using the polygon editor for custom shapes
When the built-in presets do not match your design, the custom polygon editor lets you define any shape. Enter one vertex per line in the format x,y where both values are percentages between 0 and 100. The x-axis runs left to right and the y-axis runs top to bottom.
To draw a diamond, you would enter four points:
50,0(top center)100,50(middle right)50,100(bottom center)0,50(middle left)
The css clip-path maker validates every line. If a coordinate is missing, out of range or not a number, the tool shows an error instead of generating broken CSS. This prevents subtle layout bugs caused by malformed polygon() values.
Browser support and fallbacks
The clip-path property with polygon(), circle(), ellipse() and inset() functions is supported in all modern browsers including Chrome, Firefox, Safari and Edge. Older versions of Safari required the -webkit- prefix, but current releases handle the standard syntax without it.
For graceful degradation, provide a fallback style before the clipped rule. Browsers that do not understand clip-path will ignore it and render the unclipped element. You can also use the @supports query to apply alternative layouts when clipping is unavailable.
Keep in mind that clip-path affects the visual rendering and hit-testing area. Links and buttons inside a clipped region outside the path will not respond to clicks, which is important for accessibility and usability testing.
Common mistakes to avoid
A frequent error is mixing up the coordinate order. The polygon() function expects x first, then y. Writing polygon(0% 50%, 100% 50%, 50% 100%) produces a different shape than swapping those pairs.
Another issue is forgetting that percentages are relative to the element's own dimensions. A 200 by 100 pixel element with polygon(50% 0%, 100% 100%, 0% 100%) places the top vertex at 100 pixels from the left, not 50 pixels. Always test your shapes at the actual rendered size.
Finally, very complex polygons with dozens of points can cause rendering jank on low-end devices. Simplify paths where possible, or consider using an SVG <clipPath> element referenced via url(#id) for intricate illustrations.
Worked examples
| Example | Input | Result |
|---|---|---|
| Triangle | Shape preset: triangle | CSS property: clip-path: polygon(50% 0%, 0% 100%, 100% 100%);; Shape: Triangle; Function: polygon |
| Five-point star | Shape preset: star | CSS property: clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);; Shape: Star; Function: polygon |
| Circle at 40% | Shape preset: circle; Radius (%): 40 | CSS property: clip-path: circle(40% at 50% 50%);; Shape: Circle; Function: circle |
| Inset with rounded corners | Shape preset: inset; Top inset (%): 5; Right inset (%): 5; Bottom inset (%): 5; Left inset (%): 5; Corner rounding (%): 10 | CSS property: clip-path: inset(5% 5% 5% 5% round 10%);; Shape: Inset; Function: inset |
FAQ
What is a clip-path generator?
A clip-path generator is a tool that helps you create CSS clip-path values visually. Instead of calculating polygon coordinates by hand, you pick a shape or enter points and the tool outputs the exact CSS property to paste into your code.
Can I use this css clip path generator for non-square elements?
Yes. Percentage-based coordinates scale to whatever width and height the element has. A point at 50% 50% always lands in the center regardless of aspect ratio.
Does this css clip-path maker work offline?
The tool runs entirely in your browser. Once the page loads, no network requests are made and no data is sent to a server.
How do I add rounded corners to a clipped shape?
For the inset function, use the round keyword followed by a radius value, such as inset(10% round 15%). Polygon shapes do not natively support rounded corners, but you can approximate them by adding extra points along the curve.
What is the difference between clip-path and SVG clipPath?
CSS clip-path applies directly to HTML elements using functions like polygon() or circle(). SVG clipPath is defined inside an SVG document and referenced by other SVG elements. Both achieve clipping, but CSS clip-path is simpler for styling regular DOM nodes.
Why does my polygon look distorted?
Distortion usually happens when the element is not square. Because percentages map to the element's width and height independently, a 50% x-offset covers a different absolute distance than a 50% y-offset on a rectangular box.