CSS Clip-path Shapes Guide
The CSS clip-path property lets you clip elements to geometric shapes — circles, ellipses, rectangles, and arbitrary polygons. This guide covers every shape function with practical code examples.
CSS Clip-path Generator
Create CSS clip-path shapes visually — circle, ellipse, inset, or polygon with draggable points. Copy production-ready CSS.
Polygon Points (3)
Drag points on the preview or edit values below.
Shape Presets
Preview Colors
Preview
CSS Output
clip-path: polygon(50% 0%, 0% 100%, 100% 100%);Ctrl+Enter to copy CSS
Clip-path Reference
circle(r at cx cy) — circular clipellipse(rx ry at cx cy) — elliptical clipinset(t r b l round br) — rectangular clip with optional roundingpolygon(x1 y1, x2 y2, ...) — arbitrary polygon with unlimited verticesSupported in all modern browsers. Use -webkit-clip-path for older Safari versions.
circle() — circular clips
circle(radius at centerX centerY) creates a circular clip. The radius can be a length or percentage — 50% means the circle touches the edges. Position defaults to the element center. Example: clip-path: circle(40% at 50% 50%) creates a circle at 40% radius centered in the element. Use closest-side or farthest-side keywords for responsive circles.
/* CSS clip-path basic shapes */
/* Circle — center at 50% 50%, radius 50% */
.circle { clip-path: circle(50% at 50% 50%); }
/* Ellipse — 50% horizontal, 30% vertical radius */
.ellipse { clip-path: ellipse(50% 30% at 50% 50%); }
/* Inset — rectangle with optional border-radius */
.rounded-inset { clip-path: inset(10% round 20px); }
/* Polygon — custom shape with x,y coordinate pairs */
.triangle { clip-path: polygon(50% 0%, 0% 100%, 100% 100%); }
.diamond { clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%); }
.hexagon { clip-path: polygon(25% 0%, 75% 0%, 100% 50%, 75% 100%, 25% 100%, 0% 50%); }
/* All shapes work with images, divs, and any HTML element */ellipse() — oval clips
ellipse(radiusX radiusY at centerX centerY) creates an oval. Two radii control horizontal and vertical size independently. clip-path: ellipse(50% 35% at 50% 50%) makes a horizontally wider oval. Like circle(), position defaults to center and you can use closest-side/farthest-side keywords.
polygon() — custom shapes
polygon(x1 y1, x2 y2, ...) defines a shape with any number of vertices. Each pair is a percentage or length coordinate. polygon(50% 0%, 100% 100%, 0% 100%) creates a triangle. More points create more complex shapes — stars, arrows, hexagons, and any custom outline. Points are connected in order and the shape is automatically closed.
Frequently Asked Questions
Can I animate CSS clip-path?
Yes, clip-path is animatable with CSS transitions and keyframes as long as both states use the same shape function with the same number of points. For example, transitioning between two polygon() values with 6 points each will smoothly morph. Transitioning between different shape types (e.g., circle to polygon) does not interpolate.
What is the difference between clip-path and mask?
clip-path clips to hard geometric edges — the boundary is either visible or hidden. CSS mask uses an image (gradient, SVG, PNG) as an alpha channel, allowing soft edges, transparency, and gradual fading. Use clip-path for geometric shapes and mask for complex transparency effects.
How do I clip to an SVG path with clip-path?
Use clip-path: url(#clipId) referencing an SVG clipPath element, or clip-path: path('M...') with an inline SVG path string. The path() function gives you full SVG path control including curves (C, Q), arcs (A), and complex outlines beyond what polygon() can express.
Related Generate Tools
JSON to GraphQL Schema
Generate GraphQL schema definitions from JSON data with automatic type inference, Query/Mutation generation, and .graphql download
HTTP Request Builder
Build HTTP requests visually and generate code in cURL, JavaScript, Python, Go, Rust, and PHP — lightweight Postman/ReqBin alternative
HTML Table Generator
Build HTML tables visually with an interactive editor — add rows, columns, header rows, captions, and styling. Export as plain HTML, inline CSS, or Tailwind classes
CSS Filter Generator
Build CSS filter effects visually — blur, brightness, contrast, grayscale, hue-rotate, invert, opacity, saturate, sepia, and drop-shadow with 12 presets and live preview