CSS clip-path Property

Beginner
⏱️ 7 min read
📚 Updated: Jun 2026
🎯 4 Examples
Visual Effects

What You’ll Learn

The clip-path property clips elements to custom shapes — circles, polygons, inset boxes, and SVG paths — for creative layouts and visual effects.

01

Custom Shapes

Clip to any region.

02

circle()

Round avatars.

03

polygon()

Triangles, stars.

04

inset()

Rounded crops.

05

none Default

No clipping.

06

SVG url()

Complex paths.

Definition and Usage

The clip-path CSS property is a powerful tool that lets you create complex shapes and clip an element to a specific region. You can hide parts of an element or create interesting visual effects by defining its visible area.

You can use basic shapes like circle(), ellipse(), polygon(), and inset(), or reference custom SVG paths. Unlike the legacy clip property, clip-path works on most elements without requiring absolute positioning.

💡
Beginner Tip

Start with clip-path: circle(50%) for profile photos, then try polygon() for triangles and diagonal sections.

📝 Syntax

The syntax for clip-path varies depending on the shape or path you want to use:

syntax.css
selector {
  clip-path: shape | url(svg-path) | none;
}

Basic Example

clip-path-circle.css
.clip-circle {
  width: 200px;
  height: 200px;
  clip-path: circle(50%);
}

Syntax Rules

  • The initial value is none (no clipping).
  • Shape functions: circle(), ellipse(), polygon(), inset(), path().
  • url(#id) references an SVG <clipPath> element in the document.
  • Coordinates in polygon() are pairs of x y percentages or lengths.
  • Works on block elements, images, and pseudo-elements in modern browsers.

⚡ Quick Reference

QuestionAnswer
Initial valuenone
Applies toAll elements (creates a clipping region when not none)
InheritedNo
AnimatableYes, between compatible shapes
Common useAvatar circles, diagonal hero sections, creative card shapes

💎 Property Values

The clip-path property accepts shape functions, SVG references, or none.

ValueExampleMeaning
shapeclip-path: circle(50%);Defines a basic shape: circle(), ellipse(), polygon(), or inset().
url(svg-path)clip-path: url(#myClip);References an SVG <clipPath> element in an SVG file or HTML document.
noneclip-path: none;No clipping is applied. The entire element is visible.
circle() ellipse() polygon() inset() path() url() none

Common Shape Functions

FunctionExampleUse case
circle()circle(50% at 50% 50%)Round profile images and circular thumbnails
ellipse()ellipse(40% 50% at 50% 50%)Oval crops with different horizontal and vertical radii
polygon()polygon(50% 0%, 100% 100%, 0% 100%)Triangles, diamonds, arrows, and custom multi-point shapes
inset()inset(10% 20% round 8px)Rectangular crops with optional rounded corners

👀 Live Preview

The same gradient block clipped three different ways — circle, triangle polygon, and inset with rounded corners.

circle(50%)
polygon(triangle)
inset(... round)

Examples Gallery

Try a circular clip, triangle polygon, inset crop, and ellipse shape on gradient blocks.

⬡ Basic Shapes

Start with the reference example — clip an element to a circle using circle(50%).

Example 1 — Image Clipped to a Circle

Clip an element to a circle shape — perfect for avatars and round thumbnails.

clip-path-circle.html
<style>
  .clip-circle {
    width: 200px;
    height: 200px;
    clip-path: circle(50%);
    background: linear-gradient(135deg, #f97316, #ec4899);
  }
</style>

<div class="clip-circle"></div>
Try It Yourself

How It Works

circle(50%) creates a circle whose radius is half the element size, centered by default.

Example 2 — Triangle with polygon()

Use polygon() with coordinate pairs to clip an element to a triangle.

clip-path-polygon.html
<style>
  .triangle {
    width: 160px;
    height: 140px;
    clip-path: polygon(50% 0%, 100% 100%, 0% 100%);
    background: #6366f1;
  }
</style>

<div class="triangle"></div>
Try It Yourself

How It Works

Each pair in polygon() is a corner point. Three points create a triangle; add more points for complex shapes.

🛠 Advanced Clipping

Use inset() and ellipse() for rounded crops and oval masks.

Example 3 — Rounded Crop with inset()

Clip with inset() to create a smaller visible area with rounded corners.

clip-path-inset.html
<style>
  .inset-card {
    width: 200px;
    height: 140px;
    clip-path: inset(10% 15% round 12px);
    background: linear-gradient(90deg, #0ea5e9, #8b5cf6);
  }
</style>

<div class="inset-card"></div>
Try It Yourself

How It Works

inset() trims from top, right, bottom, and left. The round keyword adds border-radius to the clipped shape.

Example 4 — Oval Shape with ellipse()

Create an oval clip with different horizontal and vertical radii.

clip-path-ellipse.html
<style>
  .oval {
    width: 220px;
    height: 140px;
    clip-path: ellipse(45% 50% at 50% 50%);
    background: linear-gradient(135deg, #16a34a, #059669);
  }
</style>

<div class="oval"></div>
Try It Yourself

How It Works

ellipse(45% 50% at 50% 50%) sets horizontal radius, vertical radius, and center position for an oval clip.

clip-path vs clip

Featureclip-pathclip (legacy)
ShapesCircle, ellipse, polygon, inset, path, SVGRectangle only (rect())
PositioningWorks on most elementsRequires absolute/fixed positioning
StatusModern, recommendedDeprecated
AnimationSupported between compatible shapesNot practical

🧠 How clip-path Works

1

You choose a clipping shape

Pick a function like circle(), polygon(), or an SVG url() reference.

Shape definition
2

Browser builds a clip region

The shape becomes a clipping path relative to the element’s bounding box.

Rendering
3

Content outside is hidden

Only pixels inside the clip region are painted. The rest of the element is invisible.

Masking
=

Custom-shaped visible element

Your box, image, or card appears in the exact shape you defined — circle, triangle, oval, or more.

Modern Browser Support

The clip-path property is supported in most modern browsers, including Chrome, Firefox, Safari, Edge, and Opera. Test across browsers when using complex shapes or animations.

Baseline · Modern browsers

Shape clipping in today’s browsers

All major browsers support basic shape functions. SVG url() references and animations may vary slightly.

97% Modern browser support
Google Chrome 55+ · Desktop & Mobile
Full support
Mozilla Firefox 54+ · Desktop & Mobile
Full support
Apple Safari 9.1+ · macOS & iOS
Full support
Microsoft Edge 79+ · Chromium
Full support
Opera 42+ · Modern versions
Full support
clip-path property 97% supported

Bottom line: Use clip-path freely for circles, polygons, and inset shapes. Test SVG url() clips and animations in your target browsers.

Conclusion

The clip-path property is a versatile tool for creating unique and visually appealing designs. By clipping elements to various shapes and paths, you can achieve creative layouts and effects that enhance the user experience.

Experiment with different shapes and clipping paths — from simple circles to complex polygons — to see how this property can transform your web projects.

💡 Best Practices

✅ Do

  • Use clip-path: circle(50%) for round avatars and thumbnails
  • Try polygon() for diagonal hero sections and creative cards
  • Prefer clip-path over legacy clip for new projects
  • Test clipped interactive elements — clicks may still hit hidden areas
  • Use inset() with round for soft rectangular crops

❌ Don’t

  • Hide essential text or controls with clipping — users cannot see clipped content
  • Assume clipped-away areas block pointer events by default
  • Overuse complex polygons without testing on mobile performance
  • Forget accessibility — provide alt text for clipped images
  • Rely on clipping alone when border-radius or SVG masks are simpler

Key Takeaways

Knowledge Unlocked

Five things to remember about clip-path

Use these points when shaping elements with CSS.

5
Core concepts
02

none Default

No clipping applied.

Default
03

Shape functions

circle, polygon, inset.

Values
🖼 04

SVG url()

Complex path clips.

Advanced
🛸 05

Modern choice

Replaces legacy clip.

Compare

❓ Frequently Asked Questions

clip-path clips an element to a custom visible region. You can use basic shapes like circles and polygons or SVG paths to hide parts of an element and create creative visual effects.
The initial value is none, which means no clipping is applied and the entire element remains visible.
clip only supports rectangular regions with rect() on positioned elements. clip-path supports circles, ellipses, polygons, inset(), and SVG paths on most elements — it is the modern choice.
Common functions include circle(), ellipse(), polygon(), inset(), and path(). You can also reference an SVG clipPath element with url().
Yes. clip-path can transition between compatible shapes in supporting browsers, which enables smooth morphing effects for hover states and animations.

Practice in the Live Editor

Open the HTML editor, apply clip-path: circle(50%) or polygon(), and preview shapes instantly.

HTML Editor →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

5 people found this page helpful