What is the CSS Polygon Generator?
Generate CSS polygon shapes using clip-path: polygon(). Drag vertices to create any polygon, then copy the clip-path value.
Everything runs locally in your browser. Adjust the controls above, preview instantly, and copy clean, production-ready CSS — no account, no upload.
Using the CSS Polygon Generator
Everything lives in the panel at the top of this page. There is nothing to install — it all runs right here in your browser.
Select a base shape or start custom
Choose from triangle, diamond, pentagon, hexagon, octagon, or star. Or start with a blank canvas for a custom shape.
Drag vertices to reshape
Click and drag any vertex to move it. Double-click an edge to add a new vertex. Click a vertex and press Delete to remove it.
Copy the clip-path value
Click Copy to get the clip-path: polygon() value with all coordinates.
What the generated code looks like
Clean, production-ready CSS — no vendor bloat, no unnecessary declarations.
/* Regular polygons */
.triangle { clip-path: polygon(50% 0%, 0% 100%, 100% 100%); }
.diamond { clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%); }
.pentagon { clip-path: polygon(50% 0%, 100% 38%, 82% 100%, 18% 100%, 0% 38%); }
.hexagon { clip-path: polygon(25% 0%, 75% 0%, 100% 50%, 75% 100%, 25% 100%, 0% 50%); }
.octagon { clip-path: polygon(30% 0%, 70% 0%, 100% 30%, 100% 70%, 70% 100%, 30% 100%, 0% 70%, 0% 30%); }Polygon coordinates are percentages relative to the element bounding box. The shape scales automatically with the element size.
Pro tips for better results
Use percentage coordinates for responsive shapes
Percentage values in polygon() are relative to the element dimensions. The shape scales perfectly as the element resizes - no media queries needed.
Clip-path does not affect layout space
The element still occupies its original rectangular box. Use negative margins or padding to make adjacent elements visually align with the clipped edges.
Animate between polygons with the same vertex count
CSS transition on clip-path works when both states use polygon() with the same number of points. Animating between a 4-point and a 6-point polygon does not work.
Frequently asked questions
From the blog
Read more →CSS Box Shadow: A Complete Guide with Examples (2026)
Master CSS box-shadow: every value explained, layering multiple shadows for realistic depth, inset shadows, the spread trick, and copy-paste examples for cards, buttons, and more.
How to Create Glassmorphism in CSS: The Complete 2026 Guide
Learn how to build the frosted-glass effect with CSS backdrop-filter. Real code, the accessibility traps nobody mentions, browser support, and performance tips from production.
The Complete Guide to CSS Gradients (2026)
Master linear, radial, and conic CSS gradients. Learn color stops, angles, hard stops for stripes, multi-layer gradients, and the tricks behind smooth, professional results.