How to Use CSS clip-path: Polygons, Circles, Insets and Animation

A practical guide to CSS clip-path shapes, how polygon coordinates work, animating between shapes, and fixing clipped shadows, borders and click areas.

Updated September 29, 2026 6 min read

Use the free CSS Clip-path GeneratorCut elements into triangles, stars, arrows and custom polygons

A designer hands over a hero section with a slanted bottom edge, hexagonal team photos and an arrow-shaped call-to-action. You could export each shape as an image, but then the photos cannot be swapped, the colours cannot be themed and the shapes cannot animate. CSS clip-path cuts any element into a shape directly in the browser, and it works on images, videos, gradients and whole sections of content.

This guide explains the shape functions clip-path accepts, how polygon coordinates work, how to animate between shapes, and how to deal with the side effects that surprise people, such as vanishing shadows.

What clip-path does

clip-path defines a region. Everything inside it is painted; everything outside is hidden. The element still takes up its full rectangular box in the layout, so surrounding content does not move. Only the visible part changes.

Two consequences are worth knowing from the start:

  • Anything drawn outside the region is cut off, including the element's own box-shadow, borders and outlines.
  • Pointer events follow the visible shape. Clicking a clipped-away corner does not hit the element, which is exactly what you want for shaped buttons.

The basic shape functions

inset()

Crops a rectangle inward from each edge, with optional rounded corners:

.cropped {
  clip-path: inset(10% 5% 10% 5% round 12px);
}

The four values follow the same top, right, bottom, left order as margin.

circle() and ellipse()

.avatar {
  clip-path: circle(50% at 50% 50%);
}

.pill-image {
  clip-path: ellipse(50% 35% at 50% 50%);
}

The first value is the radius (or radii for an ellipse) and at sets the centre. Percentages for a circle's radius are resolved against a normalised diagonal of the box, so on a non-square element circle(50%) does not exactly touch all four sides. For a simple round avatar on a square element, border-radius: 50% is often simpler.

polygon()

The most flexible option: a list of x/y points joined in order.

.triangle {
  clip-path: polygon(50% 0%, 100% 100%, 0% 100%);
}

.slanted-hero {
  clip-path: polygon(0 0, 100% 0, 100% 85%, 0 100%);
}

.hexagon {
  clip-path: polygon(25% 0%, 75% 0%, 100% 50%, 75% 100%, 25% 100%, 0% 50%);
}

How polygon coordinates work

Each point is x y measured from the top-left corner of the element's border box. 0% 0% is the top-left, 100% 0% the top-right, 100% 100% the bottom-right and 0% 100% the bottom-left. Y grows downwards, as everywhere in CSS.

Percentages scale with the element, so the same polygon works at any size. You can also mix units, which is useful when one part of the shape should stay fixed:

.ribbon {
  clip-path: polygon(0 0, 100% 0, calc(100% - 24px) 50%, 100% 100%, 0 100%);
}

Here the notch is always 24px deep, however wide the ribbon grows.

Points are joined in the order you list them, and the last connects back to the first. Listing points out of order produces crossed, bow-tie shapes.

Build a shape visually

Working out coordinates by hand is fine for a triangle, but a star or a speech bubble is easier to draw. The CSS Clip-path Generator lets you do that on a live preview.

  1. Open the CSS Clip-path Generator and pick a starting shape: Triangle, Trapezoid, Parallelogram, Rhombus, Pentagon, Hexagon, Octagon, Star, Arrow right, Chevron, Message, Cross, Circle, Ellipse or Inset.
  2. For polygons, drag the handles on the preview. The selected point also has Point X and Point Y sliders for precise values.
  3. Click Add point after #n to insert a new point, or Remove #n to delete one (a polygon keeps at least three).
  4. For circles and ellipses, adjust Radius (or Radius X and Radius Y) and Center X / Center Y. For inset, set Top, Right, Bottom, Left and Corner round.
  5. Change the Fill colour or switch on Gradient to preview on a more image-like fill, and turn on Show clipped area to see what is being cut away.
  6. Copy the CSS, which includes the standard property and a -webkit-clip-path line for older Safari versions.

Animating clip-path

clip-path can be transitioned and animated, which makes for reveal effects and morphing shapes:

.reveal {
  clip-path: inset(0 100% 0 0);
  transition: clip-path 0.6s ease-out;
}

.reveal.is-visible {
  clip-path: inset(0 0 0 0);
}

Rules for smooth animation:

  • The start and end shapes must use the same function. You cannot tween from circle() to polygon().
  • Polygons must have the same number of points. To morph a triangle into a square, give the triangle a fourth point that sits on top of another one.
  • Points move in straight lines between matching positions, so keep the point order consistent.

For keyframe-based sequences, the CSS animation generator handles timing and easing, and you can put clip-path values in the keyframes. Consider users who have asked for reduced motion with the prefers-reduced-motion media query.

Common problems and fixes

My box-shadow disappeared

The shadow is outside the clipped region, so it is clipped too. Wrap the element in a parent and put a filter: drop-shadow() on the parent. Drop shadows follow the visible shape of the child:

.shape-wrapper {
  filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.25));
}

.shape-wrapper > .hexagon {
  clip-path: polygon(25% 0%, 75% 0%, 100% 50%, 75% 100%, 25% 100%, 0% 50%);
}

The box shadow generator helps pick shadow values that you can reuse in drop-shadow().

Borders only show on some edges

Borders are drawn on the rectangular box, and clipping cuts them off on slanted edges. To get an outline that follows the shape, stack two clipped elements: a larger one in the border colour behind a slightly smaller one, or use an SVG shape with a stroke.

Text gets cut off

Clipping hides content without reflowing it. Add padding so text stays inside the visible region, especially near slanted edges and on small screens where percentages shrink.

Curved shapes look jagged

Polygons are straight lines only. For smooth curves, use circle(), ellipse(), inset(... round), or the path() function with SVG path data. Note that path() uses pixel coordinates, so it does not scale with the element; check current browser support for the newer shape() function if you need responsive curves.

clip-path compared with other techniques

  • border-radius is simpler and better for rounded rectangles and circles, and it keeps shadows and borders working. The border radius generator also creates organic blob shapes with eight-value radii.
  • mask-image uses an image or gradient's transparency to hide parts of an element, allowing soft, feathered edges that clip-path cannot do.
  • SVG is the right tool for complex illustrations or shapes that need strokes and multiple colours.
  • CSS gradients can fake angled section edges with no clipping at all; see the CSS gradient generator.

Frequently asked questions

Does clip-path affect layout?

No. The element keeps its full box in the layout. Only the painted area and the clickable area change.

Can I use clip-path on images?

Yes. It works on any element, including img, video and iframe, as well as elements with background images.

Why is my clip-path transition not animating?

Both states must use the same shape function and, for polygons, the same number of points. Otherwise the browser switches instantly.

Is -webkit-clip-path still needed?

Current browsers support the unprefixed property for basic shapes. The prefixed line is harmless and helps older Safari versions, so many generators include both.

How do I add a shadow to a clipped element?

Apply filter: drop-shadow() to a wrapper around the clipped element, because a normal box-shadow on the element itself is clipped away.

Try it now: CSS Clip-path Generator

Loading tool…