Free CSS Clip-Path Generator

Choose a shape preset, adjust the sliders, and copy the CSS clip-path code.

Shape Type

Live Preview

Generated CSS

How It Works

  1. Choose a shape type: select from polygon, circle, ellipse, or inset (rectangle with optional rounded corners).
  2. Drag the control points: move the shape handles on the preview to customize the clip region precisely.
  3. Copy the CSS: the generated clip-path property value is ready to paste into your stylesheet.

Why Use CSS Clip-Path Generator?

CSS clip-path creates non-rectangular element shapes by masking everything outside a defined clip region. It is used for diagonal section dividers, hexagonal image crops, custom button shapes, creative hover effects, and masked image reveals. Writing clip-path polygon coordinates by hand requires calculating percentage values for each vertex, tedious and hard to visualize. This interactive generator lets you drag points visually and get the exact CSS values instantly.

Features

Frequently Asked Questions

Does clip-path affect clickable areas?

Yes. By default, pointer events only register within the clip region, the clipped-away area is both invisible and unclickable. To make the full element clickable while only visually clipping it, use pointer-events: all on the element or a transparent overlay.

Can I animate clip-path?

Yes, clip-path can be transitioned and animated with CSS. Animate between two polygon shapes with the same number of points for a smooth morphing effect. Shapes with different point counts will snap rather than interpolate.

Is clip-path supported in all browsers?

clip-path is supported in all modern browsers. For SVG-based shapes via the url(#id) syntax, browser support is broader. The basic polygon, circle, ellipse, and inset values work universally in Chrome, Firefox, Safari, and Edge.

What CSS clip-path actually does

The CSS clip-path property masks an element to a chosen shape: anything inside the shape is visible, everything outside becomes transparent. The element's layout box is unchanged (it still occupies the same rectangle for purposes of margin collapse, flow, and sibling positioning), but only the pixels inside the clip region are drawn. This makes clip-path different from cropping (which permanently changes the image) and different from positioning (which moves things around): clip-path is a display-time mask applied right before pixels hit the screen.

There are four basic shape functions: polygon() (a list of vertices as percent or pixel coordinates), circle() (radius plus a center), ellipse() (two radii plus a center), and inset() (a rectangle measured from each edge, optionally with rounded corners). For shapes too complex for these four (irregular curves, stars with concave indents, calligraphic outlines), clip-path also accepts an SVG path via path() or a reference to an SVG <clipPath> element via url(#id). The browser draws the element, then composites it through the alpha mask defined by your shape.

clip-path matters for modern web design because it enables shapes that would have required image editors a decade ago. A diagonal section divider, a hexagonal avatar grid, a chevron banner, a star-shaped photo: all now possible in pure CSS, scalable to any size, animatable on hover, and accessible because the underlying element is still HTML, not a rasterized image. The trade-off is verbosity: writing polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%) by hand for a simple diamond is doable, but a 12-vertex star or a custom logo cutout is impractical without a visual editor. That is where this generator fits.

How this tool works under the hood

The preview is a div with your chosen clip-path applied as inline CSS, updated on every drag of a control handle. The handles are absolutely positioned circles overlaid on top of the preview at the percent coordinates of each vertex. When you drag a handle, JavaScript captures the mousemove (or touchmove) event, converts the pixel position to a percent of the preview area, updates that vertex in the in-memory polygon, and re-applies the clip-path string. Real-time rendering means you see the shape change as you drag, not after.

The generated CSS is constructed by joining the vertices into a polygon string: polygon(x1% y1%, x2% y2%, ...) for polygon mode, or circle(r% at cx% cy%), ellipse(rx% ry% at cx% cy%), inset(top right bottom left round radius) for the simpler shape types. Percent values rather than pixel values are used because percentages scale with the element automatically: a polygon that looks correct at 300x200 also looks correct at 600x400 with no change to the CSS. The code box updates on every interaction, and the Copy CSS button writes the current value to your clipboard.

Nothing leaves your browser. The preview, the shape calculations, the CSS generation, and the clipboard copy are all client-side JavaScript. No network request is made; no image is uploaded; no analytics on your shape choices. The tool has no backend at all beyond the static HTML and JavaScript served once on first load. Open the browser's network tab during use and you will see zero requests after the initial page load. The CSS you generate is yours to paste into any stylesheet.

Brief history of CSS clipping

Real-world workflows

Common pitfalls and what they mean

Privacy: everything runs in your browser

CSS generator tools traditionally fall into two camps: simple HTML pages with client-side JavaScript (private, fast, no account needed) and full-featured editors with cloud-saved projects (collaborative, but every shape edit gets logged on someone else's server). This tool is firmly in the first camp. The polygon coordinates you drag, the colors you pick, the CSS you copy: all stay in your browser session, never sent anywhere. Refresh the page and the state is gone unless you copied the CSS first.

The privacy implication matters mostly for proprietary work. A design agency prototyping a custom button shape for a confidential brand redesign, an indie developer working on an unannounced game UI, an enterprise team designing layouts for a product still under NDA: any context where the shape itself or its iteration history could leak information about ongoing work. With this tool, none of that risk exists because none of it is captured. Open the browser's Network tab while dragging handles and you will see zero outbound requests.

When another tool is the right pick

Other frequently asked questions

Can I use percentages or pixels for vertex coordinates?

Both work. Percentages scale with the element's box, so a polygon defined in percentages keeps its proportional shape when the element resizes. Pixels are absolute, so a polygon with pixel coordinates keeps the same size regardless of the element. Use percentages for shapes that should resize with the layout (most cases) and pixels for shapes that need exact pixel positions (e.g., aligning to a specific design element). You can also mix: polygon(50% 10px, 100% 50%, ...) is valid.

Will clip-path affect SEO or screen readers?

No. clip-path is a visual-only property. The underlying HTML is fully accessible: text inside a clipped element is still indexed by search engines, still announced by screen readers, still selectable by keyboard navigation. Use clip-path for visual styling; do not use it as a way to hide content semantically (that requires display: none or aria-hidden attributes). Visually clipped content remains present in the accessibility tree.

How do I make a clip-path responsive?

Use percentages instead of pixels, and check the result at different breakpoints. For shapes that need different proportions on mobile versus desktop, use CSS media queries to swap the clip-path value: declare a different clip-path inside @media (max-width: 768px) for the mobile shape. For complex responsive needs (e.g., a polygon that becomes a circle on mobile), consider using JavaScript to recompute the clip-path based on window size, though pure-CSS approaches handle most cases.

Can clip-path be applied to videos and iframes?

Yes. clip-path works on any HTML element, including <video> and <iframe>. The mask applies at the element level, so a video clipped to a hexagon plays back inside that hexagon. The video controls (when shown) are also clipped, which can hide play/pause buttons inadvertently; wrap the video in a container element if you need the controls visible outside the clipped area.

What is the maximum number of polygon vertices?

There is no formal limit specified by the CSS standard. Practically, browsers handle polygons with hundreds of vertices without rendering errors, but performance degrades with vertex count, especially for animated clip-paths. Aim for 3 to 12 vertices for most decorative shapes; if you need more complexity, switch to an SVG path() for cleaner authoring and similar performance characteristics. Beyond 50 vertices, clip-path becomes harder to maintain by hand and an SVG-editor workflow makes more sense.

Can I clip text instead of just images and boxes?

Yes. clip-path works on text elements too, masking them just like any other element. The visual effect is "text peeking through a shape." For more sophisticated text-shape effects (e.g., using a text outline as the clipping mask for an image), combine clip-path with background-clip: text, which uses the text shape itself as the clip region for the element's background. Common pattern: large text with a gradient background visible only inside the text shapes.

Related Tools