Pikkola clip-path, tool No. 95

Cut a box into a shape, then read the value.

Drag the corners of a polygon over a picture, tap an edge to add a point, or switch to a circle, an ellipse or an inset. The page writes the clip-path four ways, as a CSS rule, an inline style, a Tailwind value and an SVG clipPath, and it reads a value you paste back into vertices.

4
kinds of shape
16
outlines ready
0
uploads

The cutting table

Drag the outline

Every handle is a percentage of the box, so the shape holds at any size. The preview is drawn by the stylesheet: nothing is uploaded and nothing is stored.

pikkola A box, cut to a shape.

Shape
Vertices

Tap a dot on an edge to add a point.

Sixteen outlines

      

Three things a clip-path really is

It is not a mask, not a border radius and not an image edit. It is one shape the browser intersects with a box before it paints.

01

A string on one element

The value names a shape in the element's own box: a list of percentage pairs for a polygon, a centre and a size for a circle or an ellipse, four edges for an inset. The element still has the size the layout gave it. Only what is painted inside the shape survives.

02

Percentage pairs, not pixels

A corner at 50% 0% is the middle of the top edge at any width. A pixel value would cut a desktop card correctly and a phone card in half. That is why every handle here reports a share of the box, and why the area figure is a percentage too.

03

Four ways to carry it

A class in the stylesheet is the one to ship: it is cached, it can change at a breakpoint and a strict content policy does not block it. The inline form is for a one-off, the Tailwind form for a utility-first project, and the SVG form when the shape has to live in a file as an id.

What this table does, and what it leaves alone

A shape editor is easy to trust too much. These are the edges of this one.

Part What this page does What it will not do
Vertices Added on an edge, dragged, nudged with the arrow keys, removed with Delete Move a point outside the box, or invent a curve between two points
Modes polygon, circle, ellipse and inset, each with its own fields path(), shape-outside, or a mask with a gradient
Preview Three backgrounds drawn by the stylesheet: a scene, a gradient and a solid Upload your own picture, or fetch one from anywhere
Output A rule with the -webkit- line, an inline style, a Tailwind value and an SVG clipPath in objectBoundingBox units Write a style attribute into this page, which its own policy forbids
Paste Reads a polygon(...) value back into vertices, clamped to the box Read path(), or a value whose units are not percentages
Storage Nothing: a reload returns to the first sample Keep a shape, an account, a cookie, or make a request after the page loads

Self-intersecting polygons are not refused. CSS resolves an overlap by the nonzero winding rule, which is what the preview shows, and guessing at an intention would be worse than showing the browser's own answer.

Field guide

Percentages, four modes, and the one prefixed line Safari needs

A clip-path is a shape the browser intersects with an element's box before painting it. Get the units right, know what gets cut away with the shape, and one line of output is all a design needs.

What the browser does with the value

Layout runs first and gives the element its box. At paint time the browser builds the shape from the value and keeps only the pixels inside it. Nothing about the box changes: siblings sit where they always sat, the scroll height is the same, and text still wraps at the same widths. That is why a clipped card leaves a gap where its cut corner is rather than sliding into it.

Two consequences follow. A box-shadow and an outline drawn outside the box are painted outside the shape, so they disappear; a card that needs a shadow needs the clip on an inner element or a filter drop-shadow instead of a box-shadow. And hit testing follows the shape, so a cut corner does not respond to a tap while the rest of the card does.

polygon, and why the first point is not special

The list is closed automatically: the browser joins the last point back to the first. Direction matters only for overlaps: CSS resolves a self-intersecting polygon with the nonzero winding rule, so a loop drawn clockwise fills and a loop drawn against it can leave a hole. This page shows what the browser does rather than guessing at an intention, which is why it does not refuse a crossed outline.

Percentages resolve against the width for x and the height for y, so a shape on a wide box is stretched, not proportionally scaled. If a shape must keep its proportions on any box, either keep the box's aspect ratio with aspect-ratio or use the SVG form below, where a viewBox does the scaling for you.

circle, ellipse, inset and the round keyword

circle(35% at 50% 50%) takes a radius and a centre; ellipse(40% 30% at 50% 50%) takes two radii; inset(8% 12% 8% 12% round 18px) takes four edges in the order top, right, bottom, left and an optional corner radius. An inset with a round value is the shape most often talked about as a border radius: it is the only one that gives a straight edge with rounded corners without touching the element's own corners.

The radius in a circle may be a length (20px) or a percentage, and the percentage resolves against the square root of the box's area, not its width, which surprises people. A 50% radius on a 200 by 100 box gives an ellipse, not a circle; for a true circle use closest-side or a length tied to the shorter side.

The four forms, and the one that survives a strict policy

A class in the stylesheet is the form to ship. It is cached with the rest of the CSS, it can change at a breakpoint with a media query, and a content policy of style-src 'self' does not block it, because the rule is a file, not an attribute. The inline form is for a one-off: it is blocked under the same policy unless that policy explicitly allows inline style attributes, and this page's own policy is strict enough that it prints the inline form as text rather than using it.

The Tailwind form is an arbitrary value, so it is compiled at build time and cannot be assembled from a variable at run time. The SVG form puts the shape in a <clipPath> with clipPathUnits="objectBoundingBox", where coordinates run from 0 to 1, and an element refers to it with clip-path: url(#shape). That reference must resolve in the same document, and it survives a policy that forbids inline styles entirely, which is why it is the fallback for a page that cannot relax its policy.

What gets cut with it

Anything painted outside the shape: the shadow, the outline, a child positioned past the edge, a scrolled overflow. Text inside stays in the accessibility tree whether or not it is visible, so a heading moved under the cut is still announced, and a link in a cut corner is still reachable by Tab with no visible focus ring. That is the one accessibility trap worth testing for: turn the outline on, tab through the card, and watch whether focus vanishes.

When the shape must leave CSS and become a file, Pikkola SVG Studio writes it. When the shape should be filled with light rather than colour, Pikkola Gradient builds the background that sits inside it.

Questions

Does this change my image file?

No. Nothing is cut and no file is written. The preview is a div whose background the stylesheet draws, and clip-path changes only what the browser paints inside that box. The image you ship keeps every pixel; the cut happens at render time, on the visitor's machine.

Why is the shape flat in Safari or an older iOS?

clip-path without a prefix arrived late in WebKit. The CSS tab prints both lines, the -webkit-clip-path one first, so the same rule works in Safari 9 and in every current browser. If a shape still does not appear, check that the rule reaches the element: a child cannot clip itself out of a parent's overflow.

Can I animate the shape?

Between two polygons with the same number of points, yes: transition or animate clip-path and the browser interpolates point by point, which is why adding a point changes the animation. Between a polygon and a circle there is nothing to interpolate, so a browser switches at the halfway mark unless it can rewrite one as the other.

What happens to the shadow, the border and the focus ring?

They are cut too. A box-shadow is painted outside the box and the clip removes it, and an outline drawn outside the shape is gone as well. That is worth remembering for a button: a clipped button can lose its focus ring, so keep the ring inside a visible border or place the clip on a wrapper instead.

Is the clipped content still readable and clickable?

The text stays in the document, so a screen reader reads it as before, which is good. Hit testing follows the shape, so a clipped corner is not clickable while the rest is. Text that becomes invisible under a shape is still focusable, so a clipped card with a link in a cut corner is a keyboard trap waiting to happen. Test it with the outline on.