DevTools Logo

CSS Clip-Path Generator

CSS Clip-Path Generator

Draw clip-path shapes over an image and copy responsive CSS — polygon, circle, ellipse, inset or path.

Runs in your browser

Shape editor

4-point polygon

Import an existing value

Coordinates are normalized to the element box. Percent output keeps the shape responsive; px output is anchored to a 400×300 preview box.

Live preview and CSS

4-point polygon

clip-path updated

clip-path: polygon(0% 0%, 100% 0%, 100% 100%, 0% 100%);
clip-path: polygon(0% 0%, 100% 0%, 100% 100%, 0% 100%) border-box;

Examples

Diagonal hero

Input
Four-point polygon with a slanted bottom edge
Output
polygon(0% 0%, 100% 0%, 100% 80%, 0% 100%)

Percentage points keep the cut at the same relative position on every viewport.

Rounded inset

Input
Top 10%, right 5%, bottom 12%, left 8%, round 20px
Output
inset(10% 5% 12% 8% round 20px)

The radius stays in pixels while side offsets remain responsive — a common card treatment.

Invalid path

Input
0 0 L 10 10
Output
Validation error: an SVG path must begin with M

The editor explains the failure instead of emitting CSS the browser would silently drop.

About this tool

CSS Clip-Path Generator builds reusable clip geometry instead of baking a mask into pixels. Drag polygon points over a sample stage, use circle, ellipse or inset presets with sliders, or paste an SVG path string for path() mode. The CSS panel updates as you edit and can include the legacy -webkit-clip-path line for older Safari.

Coordinates are stored on a 0–100 viewBox and serialized as percentages by default. That matters for responsive layouts: a 100% point stays at the right edge whether the element is 300px or 3000px wide. A pixel mode is available when exact natural dimensions are needed, and the stage width/height fields define the anchor values.

The editor supports keyboard and pointer workflows: points are focusable, arrow keys nudge by 1% (Shift for 5%), edge midpoints can be inserted as new points, and overlapping points are called out. Path mode validates the d string before emission and rejects percentage coordinates — path() is pixel-based. What you get is CSS, not a raster image.

What this tool does not do

  • No image upload: the editor uses a built-in gradient stage, so shape math is the deliverable rather than pixel editing.
  • Undo/redo history, shareable URLs and autosave are not implemented in this version.
  • Animation output requires equal polygon point counts and is available through the pure module rather than the UI.
  • Path validation uses a lightweight syntax check plus the browser's Path2D parser; it is not a full SVG grammar validator.
  • Pixel output is anchored to the stage dimensions entered by the user, not to an uploaded image's natural size.

How to use this tool

  1. Pick a shape mode

    Choose Polygon, Circle, Ellipse, Inset or Path from the mode tabs.

  2. Edit the shape

    Drag points with a pointer, or focus a point and use arrow keys. Use Add point for a new midpoint and Remove point to delete the selected one.

  3. Adjust parameters

    Circle, ellipse and inset modes expose sliders for every value, including the inset round radius.

  4. Choose units

    Keep percentages for responsive output, or switch to px and set the natural stage dimensions.

  5. Copy the CSS

    Read the live declaration, optionally enable the -webkit- prefix, and copy the generated rule.

Use cases

Angled heroes

Cut a diagonal edge into an image without exporting a new asset.

Blob cards

Design an organic polygon and paste the declaration into a component stylesheet.

Image reveals

Prototype a circle/ellipse reveal and keep it responsive with percentages.

SVG authoring

Convert an existing path d string into a clip-path declaration with validation.

Shape modes

ModeOutput
Polygonpolygon(x% y%, …) with any number of points.
Circlecircle(radius at x y).
Ellipseellipse(rx ry at x y).
Insetinset(top right bottom left round radius).
Pathpath('…') from an SVG d string; pixel coordinates only.

Prefixing with -webkit-clip-path is optional; modern browsers use the unprefixed property.

Common mistakes

Mistake:Using percentages inside path().

Fix:path() takes pixel coordinates; the validator rejects % and suggests polygon mode for responsive shapes.

Mistake:Assuming polygon animation works with different point counts.

Fix:The pure module exposes an animation helper that refuses mismatched counts — keep point counts equal for interpolation.

Mistake:Editing a two-point polygon and wondering why nothing is visible.

Fix:At least three points are required to enclose an area; the editor flags this explicitly.

Mistake:Expecting a raster mask export.

Fix:This tool emits CSS only. A separate image-shape-masker is needed to bake shapes into pixels.

Mistake:Forgetting the hover target follows the clipped shape.

Fix:Clip-path changes hit-testing too; keep an unclipped wrapper if you need a larger interaction area.

Frequently asked questions

Why do my clip-path points break on mobile?

Pixel coordinates are tied to one fixed size. Keep the default percentage units: each point resolves against the element's border box, so the shape scales with the layout.

How do I animate between two clip-path shapes?

Both polygons must have the same number of points. The pure module provides an animation helper that emits @keyframes and refuses mismatched point counts; this avoids the browser snapping between shapes.

Must polygon point counts match for transitions?

Yes. A browser can only interpolate between compatible shape functions with matching point lists. Use Add point on the shorter shape until the counts match.

Which browsers support path()?

Modern Chromium, Safari and Firefox releases support path() with pixel-based SVG d strings. Older Safari needs the -webkit-clip-path prefix, which the generator can include.

Can I use my own image?

This version ships a built-in gradient stage and does not accept uploads. Its purpose is geometry and CSS output; use a raster masker if you need to bake a shape into an image file.

How do I edit points with a keyboard?

Tab to a point in the SVG overlay and use the arrow keys to move it 1%; hold Shift for 5% steps. Add point and Remove point are regular buttons.

Why is path() rejected when I paste percentages?

The CSS path() function uses pixel units, so percentages are invalid. The validator stops the paste with an explanation and suggests polygon mode for a responsive version of the same shape.

References & standards