CSS Clip-Path Maker: Plot Custom Polygon Masks Visually
Click to add vertices, drag to reposition, double-click to delete. Get the live clip-path: polygon() CSS code as you build.
The Complete Guide to CSS Clip-Path Polygon Masking
CSS clip-path lets you crop any HTML element into a custom polygon shape without touching an image editor or writing a separate SVG file. This guide covers how the percentage coordinate system works, why responsive units matter, how to animate polygon shapes on hover, and when to use SVG clipping instead.
How to Use This Tool
Start by clicking a preset button to load a starting shape, or click directly on the canvas to place your first vertex. Every additional click adds a new corner to your polygon. Once three or more vertices are plotted, the live preview splits the canvas into a dimmed unmasked area and a fully visible masked area so you can see exactly what your clip-path will look like. Drag any yellow node to fine-tune its position. Double-click a node to remove it. Use the ratio toggles to match your target layout (square, widescreen, or photo format), and upload your own image to preview the mask over real content.
Understanding the CSS Coordinate Grid
Every polygon coordinate is expressed as a percentage of the element's own bounding box width and height. The origin, 0% 0%, sits at the top-left corner. The point 100% 100% is the bottom-right corner. A vertex at 50% 0% is always the exact horizontal center of the top edge, regardless of whether the element is 200 pixels wide or 2000 pixels wide. This makes percentage-based clip-paths inherently fluid and responsive. Pixel values do not share this property - a shape authored for a 400px card breaks visually on a 200px thumbnail or a full-width hero image.
Floating-Point Precision in the Polygon Output
Dividing raw pixel positions by canvas dimensions often produces long floating-point decimals, such as 33.333333333336%. This tool clamps every output coordinate to two decimal places (e.g., 33.33%). Two decimal places provides sub-pixel precision on any realistic element size while keeping the generated CSS clean and readable in your stylesheet.
Animating CSS Clip-Path Polygons on Hover
Browsers can tween between two polygon() values as long as both shapes have the same number of vertices. The browser interpolates each coordinate pair independently on every animation frame. To create a hover reveal, apply a CSS transition on the base state and define a second polygon() value in a :hover rule. The vertex count must match exactly between states. If your resting shape has six points, your hover shape must also have six points, even if two of them are collapsed to the same position to simulate a simpler outline.
SVG clipPath vs CSS clip-path
CSS clip-path with polygon() is the right choice for most layout masking work. It lives entirely in your stylesheet, needs no extra markup, and supports smooth CSS transitions and animations. SVG clipPath is a better fit when you need curved edges (Bezier curves are natively supported in SVG path data but not in the polygon() function), when you want to define one mask and apply it to multiple elements by referencing a shared id, or when you need to clip SVG elements themselves. For curved clip shapes in pure CSS, use the path() function value rather than polygon().
Browser Support and the Webkit Prefix
The clip-path property with polygon() is supported in every modern browser. The -webkit-clip-path prefix targets Safari versions prior to 13.1 (released 2019). This tool outputs both declarations for maximum coverage across older devices. If you are targeting only evergreen browsers you can safely omit the -webkit- line. On mobile, support is complete across Chrome for Android, Safari for iOS, and Samsung Internet.