ximg.es

Clip-path generator

Pick a shape or drag the points over the photo to clip it however you like. The full photo stays behind, faded, so you can see what gets hidden.

Sample photo clipped to the chosen shape

Drag the points to change the shape. With the keyboard: Tab to pick a point and the arrow keys to move it (Shift to go faster).

CSS code

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

Sample photo: /random/960x640.jpg?seed=ximg-clip

Shape
Polygons

What clip-path does

clip-path clips an element to a shape: whatever falls outside isn’t painted and doesn’t receive clicks. It works on any element, not just images, and doesn’t change the space it takes up on the page, so the rest of the layout stays put. It’s the modern way to make hexagonal avatars, headers with a slanted edge or speech-bubble cards without exporting a single image.

The four basic shapes

Animating a clip-path

Two polygons with the same number of points can be animated with transition: the browser moves each point towards its partner. That’s why “reveal” effects usually start from a polygon with all its points squashed into a line. If the number of points doesn’t match, the change is instant.

Tips

Frequently asked questions

What’s the difference between clip-path and mask?

clip-path clips with a hard edge: every point is either in or out. mask uses an image or a gradient and allows partial transparency, for example to fade out an edge.

How do I crop an image into a circle?

With clip-path: circle(50%), or with border-radius: 50%, which also works with box-shadow and outline.

Does clip-path affect clicks?

Yes: the clipped area doesn’t receive mouse events, so a hexagon-shaped link only responds inside the hexagon.

Can clip-path be animated?

Yes, between shapes of the same type and, for polygons, with the same number of points. Use transition: clip-path .4s and change the shape on :hover.

Which browsers support it?

Every current browser supports the basic shapes without a prefix. Only very old Safari needed -webkit-clip-path.

Why does my shadow disappear with clip-path?

Because box-shadow is painted outside the element and gets clipped. Wrap the element and apply filter: drop-shadow() to the wrapper.

More tools

See all tools · Placeholder image generator