Clip-path generator
Pick from ready-made CSS clip-path shapes — triangle, hexagon, star, message and more — preview and copy the code.
clip-path: polygon(50% 0%, 0% 100%, 100% 100%);What this clip-path generator does
Choose one of ten preset shapes, see it applied to a live gradient tile and copy the clip-path declaration. The presets cover the shapes people most often reach for — triangle, trapezoid, rhombus, pentagon, hexagon, star, chevron, message bubble, circle and a rounded inset — written as plain polygon(), circle() and inset() values with percentage coordinates, so they scale to any element size and need no SVG.
How to use it
- Click a shape name under Shape. The active button is highlighted and the preview morphs to the new outline.
- Read the generated declaration, for example
clip-path: polygon(50% 0%, 0% 100%, 100% 100%);. - Click Copy and paste it onto any element — a
div,img,videoor section. - Tweak coordinates by hand if you need a variation; the reference below explains the coordinate system.
Preset reference
| Shape | Value | Points |
|---|---|---|
| Triangle | polygon(50% 0%, 0% 100%, 100% 100%) | 3 |
| Trapezoid | polygon(20% 0%, 80% 0%, 100% 100%, 0% 100%) | 4 |
| Rhombus | polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%) | 4 |
| Pentagon | polygon(50% 0%, 100% 38%, 82% 100%, 18% 100%, 0% 38%) | 5 |
| Hexagon | polygon(25% 0%, 75% 0%, 100% 50%, 75% 100%, 25% 100%, 0% 50%) | 6 |
| Star | 10-point polygon | 10 |
| Chevron | polygon(75% 0%, 100% 50%, 75% 100%, 0% 100%, 25% 50%, 0% 0%) | 6 |
| Message | polygon(0% 0%, 100% 0%, 100% 75%, 75% 75%, 75% 100%, 50% 75%, 0% 75%) | 7 |
| Circle | circle(50% at 50% 50%) | — |
| Inset (rounded) | inset(10% 10% 10% 10% round 12px) | — |
Coordinates are x y pairs measured from the element’s top-left corner: 0% 0% is top-left, 100% 100% is bottom-right. Points are joined in order and the last point connects back to the first, so listing them clockwise keeps the shape easy to read. Shapes with the same point count (hexagon and chevron, both 6) can be transitioned into one another.
Editing and extending the presets
- Slanted section divider:
polygon(0 0, 100% 0, 100% 85%, 0 100%)on a full-width section, or with a fixed slant height:polygon(0 0, 100% 0, 100% calc(100% - 60px), 0 100%). - Hexagon avatar: apply the hexagon preset to a square
imgwithobject-fit: cover. For a pointy-top hexagon rotate the coordinates:polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%). - Reveal animation: start with
inset(0 100% 0 0)and transition toinset(0 0 0 0)to wipe an image in from the left.inset()toinset()interpolates cleanly. - Hover morph: hexagon at rest, chevron on hover,
transition: clip-path 0.3s ease— same point count, so it tweens. - Rounded polygons:
polygon()has noroundkeyword yet; for a rounded hexagon use an SVGclipPathwithclip-path: url(#id)or layer aninset(... round ...).
Gotchas
- Shadows and borders are clipped. Put
clip-pathon an inner element andfilter: drop-shadow(0 8px 16px rgba(0,0,0,0.3))on its parent. - Clicks follow the shape. Clipped-away areas do not receive pointer events, which is usually desirable but surprising for hover effects near the edges.
- Text inside gets cut. Add padding so content stays within the visible region, especially for triangles and chevrons.
-webkit-clip-pathis still required for Safari 9–13.0. Most projects no longer need it.- Performance. A static clip is cheap; animating a complex polygon forces repaint on every frame. Keep animated polygons under about 20 points and avoid clipping large, frequently updated areas.
Related tools and snippets
- Border-radius generator — soft blob shapes that keep box-shadow and borders working.
- Box-shadow generator — build the shadow you will apply via
drop-shadow()on the wrapper. - Corner ribbon snippet — a rotated ribbon badge, the classic companion to a clipped card corner.
- Gradient generator — a background gradient to fill the clipped shape.
- SVG optimizer — when a shape needs curves and must fall back to an SVG
clipPath.
FAQ
Does clip-path change the element's layout?
No. The element keeps its full box for layout and flow; only the painted area and the hit-test area shrink to the shape. Neighbors do not move in to fill the clipped space.
Which browsers support clip-path?
Basic shapes (polygon, circle, ellipse, inset) work unprefixed in Chrome 55+, Firefox 54+, Safari 13.1+ (9.1 with -webkit-) and Edge 79+. The path() function needs Chrome 88+, Firefox 97+ and Safari 13.1+.
Can I animate clip-path?
Yes, between two shapes of the same type with the same number of points. A polygon with 6 points can morph into another 6-point polygon via transition or keyframes; a polygon cannot morph into a circle.
Why do I lose my box-shadow when I add clip-path?
The shadow lies outside the shape and gets clipped. Use filter: drop-shadow() on a wrapper element instead, which follows the clipped outline.
What is the difference between clip-path and mask?
clip-path uses a hard-edged geometric shape; mask uses an image or gradient and supports soft, partial transparency. For crisp polygons clip-path is lighter and easier.
Can I use pixels instead of percentages in polygon()?
Yes, any length works, and you can mix them, for example polygon(0 0, 100% 0, 100% calc(100% - 40px), 0 100%) for a slanted bottom edge that stays 40px tall at every width.