Skip to main content
CalcChef

CSS Clip Path Generator

Write clip-path circle(), ellipse(), inset() or polygon() code from sliders, typed points or points you drag, then copy it as CSS, SCSS, React or Tailwind. How it works

Use the CSS Clip Path Generator

The photo is shown on this page only; it is not uploaded.

CSS
clip-path: circle(50% at 50% 50%);

About the CSS Clip Path Generator

clip-path: circle(50% at 50% 50%) shows a circle centered in the element and hides everything outside it; on a square element it touches all four edges. This clip-path generator writes circle(), ellipse(), inset() and polygon() from sliders, typed percentages, points dragged on the preview and seven polygon presets, shows the shape on a gradient, solid or checkerboard preview or on your own photo, and copies it as CSS, SCSS, a React style or a Tailwind class. It can also load a clip-path you paste and write the even-odd fill rule.

Polygon presets and their points

PresetPointspolygon() value
Triangle3polygon(50% 0%, 0% 100%, 100% 100%)
Trapezoid4polygon(20% 0%, 80% 0%, 100% 100%, 0% 100%)
Parallelogram4polygon(25% 0%, 100% 0%, 75% 100%, 0% 100%)
Rhombus4polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%)
Pentagon5polygon(50% 0%, 100% 38%, 82% 100%, 18% 100%, 0% 38%)
Hexagon6polygon(25% 0%, 75% 0%, 100% 50%, 75% 100%, 25% 100%, 0% 50%)
Star10polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%)

Each value is what the preset button puts in the Custom Points box, checked by the same rule that checks typed points. Every point is measured from the top-left corner of the element.

What the Custom Points box does with typed text

Typed pointsResult
50% 0%, 0% 100%, 100% 100%Accepted as 50% 0%, 0% 100%, 100% 100%
50% 0%, 100% 100%A polygon needs at least three points.
50 0, 10% 10%, 1% 1%Point 1 must be an x and a y, both in percent, such as 50% 0%.
50% 0%,, 1% 1%A point is empty. Separate points with commas.
-10% 0%, 110% 0%, 50% 100%Accepted as -10% 0%, 110% 0%, 50% 100%

When the text is refused, the preview and the code keep the last valid points.

How to use this tool

  1. Pick circle, ellipse, inset or polygon.
  2. Move the sliders or type a number from 0 to 100 (rounding from 0 to 50). A number outside its range shows a message and changes nothing.
  3. For a polygon, choose a preset, set a point count from 3 to 12, type points as percentages, such as 50% 0%, 100% 100%, 0% 100%, or drag the points on the preview.
  4. To change a clip-path you already have, paste it into Load an existing clip-path and press Load into controls: clip-path: inset(10% round 20%); sets all four insets to 10% and the rounding to 20%.
  5. Pick CSS, SCSS, React or Tailwind and copy the code.

Frequently asked questions

How do I make a hexagon with CSS clip-path?
Use polygon() with six points: clip-path: polygon(25% 0%, 75% 0%, 100% 50%, 75% 100%, 25% 100%, 0% 50%). The Hexagon preset on the polygon tab writes it, and the Triangle, Trapezoid, Parallelogram, Rhombus, Pentagon and Star presets write theirs the same way.
What do the numbers in a clip-path polygon mean?
Each pair is an x and a y measured from the top-left corner of the reference box, which is the border box when none is named (MDN, CSS Shapes). So 0% 0% is the top-left corner and 100% 100% the bottom-right. This tool takes percentages only, at least three points, and allows minus signs and decimals, so -10% 0% is accepted and puts a point outside the box. Where the outline crosses itself, the Fill rule decides what is filled: Nonzero (the CSS default) keeps a crossed star solid, and Even-odd writes polygon(evenodd, ...) and leaves the crossed middle empty.
What do circle(), ellipse() and inset() take?
circle(R% at X% Y%) takes a radius and a center, ellipse(RX% RY% at X% Y%) two radii and a center, and inset(T% R% B% L% round r%) the distance each edge moves in, with an optional corner radius. The tool starts at circle(50% at 50% 50%), ellipse(25% 50% at 50% 50%) and inset(10% 10% 10% 10% round 0%). Its fields run from 0 to 100%, and rounding from 0 to 50%. Individual corner rounding writes four values in the order top left, top right, bottom right, bottom left.
How do I use clip-path in Tailwind CSS?
Pick the Tailwind format. It writes an arbitrary property, [clip-path:circle(50%_at_50%_50%)], where each underscore stands for a space (Tailwind docs). The class keeps the shape function you chose, so a circle stays a circle() and an inset stays an inset().
Can I drag the polygon points?
Yes. Drag a point on the preview (hold Shift for tenths of a percent), or focus it and press the arrow keys to move it 1%, or 10% with Shift. Delete removes the focused point, down to three. Click the small dot in the middle of an edge to add a point there, up to 24: on the Triangle, the dot between the first two points gives 50% 0%, 25% 50%, 0% 100%, 100% 100%. Every change is written back to the Custom Points box.
Does the Animate switch put an animation in my CSS?
No. Animate adds a 500 ms transition to the preview only, so the shape glides as you move a slider. The copied code holds the clip-path declaration and nothing else. MDN lists clip-path as animatable between basic shapes, but you write the transition yourself.

Related Tools

View all tools