{"id":142,"date":"2026-10-18T21:10:28","date_gmt":"2026-10-18T21:10:28","guid":{"rendered":"https:\/\/refracttools.com\/blog\/?p=142"},"modified":"2026-10-18T21:10:28","modified_gmt":"2026-10-18T21:10:28","slug":"css-image-shapes","status":"publish","type":"post","link":"https:\/\/refracttools.com\/blog\/css-techniques\/css-image-shapes\/","title":{"rendered":"Shape images with CSS: arches, blobs and clip-path"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">You can give an image a shape in CSS three ways: <code>border-radius<\/code> for rounded shapes like arches, pills and circles; <code>clip-path: polygon()<\/code> for straight-edged shapes like diagonals and hexagons; and <code>mask<\/code> with an SVG for anything curvy, such as blobs, waves and squircles. In every case the image stays a normal <code>&lt;img&gt;<\/code> with its alt text, and <code>aspect-ratio<\/code> with <code>object-fit: cover<\/code> keeps a row of mixed photos the same shape.<\/p>\n\n\n\n<div class=\"wp-block-group is-style-refract-takeaways is-layout-constrained wp-block-group-is-layout-constrained\">\n<h3 class=\"wp-block-heading\">Key takeaways<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Use the simplest method that gives the shape: <code>border-radius<\/code>, then <code>clip-path<\/code>, then <code>mask<\/code>.<\/li>\n\n\n<li>Set <code>aspect-ratio<\/code> and <code>object-fit: cover<\/code> so every image fills the shape without stretching.<\/li>\n\n\n<li><code>box-shadow<\/code> follows the original rectangle. Use <code>filter: drop-shadow()<\/code> on a parent for a shadow that follows the shape.<\/li>\n\n\n<li>The image stays accessible and indexable because only its visible outline changes.<\/li>\n<\/ul>\n<\/div>\n\n\n\n<h2 class=\"wp-block-heading\">Which CSS method should you use for each shape?<\/h2>\n\n\n\n<figure class=\"wp-block-table\"><div class=\"table-scroll\" tabindex=\"0\" role=\"region\" aria-label=\"Scrollable table\"><table><thead><tr><th>Shape<\/th><th>Method<\/th><th>Notes<\/th><\/tr><\/thead><tbody><tr><td>Circle, pill, rounded<\/td><td><code>border-radius<\/code><\/td><td>Fastest and simplest; works everywhere<\/td><\/tr><tr><td>Arch<\/td><td><code>border-radius<\/code> on the top corners<\/td><td>A huge radius on the top corners becomes a semicircle<\/td><\/tr><tr><td>Diagonal cut, hexagon, triangle<\/td><td><code>clip-path: polygon()<\/code><\/td><td>Percentage points scale with the image<\/td><\/tr><tr><td>Blob, wave edge, leaf<\/td><td><code>mask<\/code> with an SVG<\/td><td>Any shape at all; the SVG stretches to the image<\/td><\/tr><tr><td>Squircle<\/td><td><code>mask<\/code> or <code>corner-shape<\/code><\/td><td>See our guide to <a href=\"\/blog\/ui-design\/css-squircle\/\">CSS squircles<\/a><\/td><\/tr><\/tbody><\/table><\/div><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">How do you make an arch-shaped image?<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>.arch {\n  aspect-ratio: 3 \/ 4;\n  width: 100%;\n  object-fit: cover;\n  border-radius: 9999px 9999px 0 0;\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Browsers scale down radii that are too large to fit, so a very large value on the two top corners becomes exactly half the width: a perfect semicircle. Change the aspect ratio for a taller or squatter arch. This is the shape behind many current portfolio and wellness-brand layouts.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">How do you cut an image with clip-path?<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>\/* Diagonal bottom edge *\/\n.diagonal { clip-path: polygon(0 0, 100% 0, 100% 85%, 0 100%); }\n\n\/* Hexagon *\/\n.hexagon {\n  aspect-ratio: 1;\n  object-fit: cover;\n  clip-path: polygon(25% 0, 75% 0, 100% 50%, 75% 100%, 25% 100%, 0 50%);\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Each pair is an x and y position, as a percentage of the element. Because the points are percentages, the shape scales with the image. A diagonal edge on a hero image is a quick way to break up a page of rectangles.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">How do you make a blob or wavy image?<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Curved, organic outlines need a mask. You draw the shape as an SVG, and the browser shows only the parts of the image inside it:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>.blob {\n  aspect-ratio: 1;\n  object-fit: cover;\n  -webkit-mask: url(\"blob.svg\") center \/ 100% 100% no-repeat;\n          mask: url(\"blob.svg\") center \/ 100% 100% no-repeat;\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The SVG can be a separate file or an inline data URI; the <a href=\"https:\/\/refracttools.com\/svg-to-css\/\">SVG to CSS converter<\/a> turns an SVG into a URL-encoded string you can paste into the <code>url()<\/code>. With <code>100% 100%<\/code> sizing, the mask stretches to fit, so keep the aspect ratio close to the SVG&#8217;s own proportions.<\/p>\n\n\n<aside class=\"tool-card tool-card--inline\"><span class=\"swatch\" style=\"background:linear-gradient(160deg,#1e3a8a,#f59e0b)\" aria-hidden=\"true\"><\/span><div class=\"tool-card__body\"><p class=\"tool-card__eyebrow\">Free tool<\/p><p class=\"tool-card__name\">Image shape mask generator<\/p><p class=\"tool-card__blurb\">Arch, blob, wave and squircle shapes for any image.<\/p><\/div><a class=\"btn primary\" href=\"https:\/\/refracttools.com\/image-shape-masks\/\">Try it free <span aria-hidden=\"true\">\u2192<\/span><\/a><\/aside>\n\n\n\n<h2 class=\"wp-block-heading\">Keeping a gallery of shaped images consistent<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Organic shapes look best when every image in a set has the same proportions. Photos arrive in all sizes, so set the shape&#8217;s proportions on the image and let it crop:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>aspect-ratio: 4 \/ 5<\/code> (or whatever ratio you choose) fixes the shape.<\/li>\n\n\n<li><code>object-fit: cover<\/code> fills it without stretching.<\/li>\n\n\n<li><code>object-position<\/code> moves the crop, for example <code>center 30%<\/code> to keep faces in frame.<\/li>\n<\/ul>\n\n\n\n<div class=\"wp-block-group is-style-refract-callout is-layout-constrained wp-block-group-is-layout-constrained\">\n<p class=\"wp-block-paragraph\"><strong>Shadows:<\/strong> A <code>box-shadow<\/code> on a clipped or masked image is cut off along with everything else outside the shape. Wrap the image and put <code>filter: drop-shadow(0 12px 24px rgb(0 0 0 \/ .25))<\/code> on the wrapper. Drop shadows follow the visible pixels, so they trace the arch or blob.<\/p>\n<\/div>\n\n\n\n<h2 class=\"wp-block-heading\">Can you animate an image shape on hover?<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Yes. Browsers can transition between two <code>border-radius<\/code> values, and between two <code>clip-path: polygon()<\/code> values as long as both polygons have the same number of points. A diagonal edge that straightens on hover, or an arch that softens into a rounded rectangle, makes a subtle interactive card:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>.diagonal {\n  clip-path: polygon(0 0, 100% 0, 100% 85%, 0 100%);\n  transition: clip-path .4s ease;\n}\n.diagonal:hover {\n  clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%);\n}\n\n@media (prefers-reduced-motion: reduce) {\n  .diagonal { transition: none; }\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">SVG masks can&#8217;t morph smoothly between two different files, so keep blob and wave shapes static, or animate the image inside them instead, for example with a slight scale on hover.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Are shaped images bad for SEO or accessibility?<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">No. CSS only changes what is painted on screen. The <code>&lt;img&gt;<\/code> element, its <code>src<\/code>, its <code>alt<\/code> text and its dimensions are untouched, so screen readers announce it normally and search engines index it as an image. That is a big advantage over exporting pre-shaped PNGs, which also need re-exporting every time the photo changes. Keep serving the image at sensible sizes with <a href=\"\/blog\/performance\/srcset-sizes-explained\/\">srcset and sizes<\/a>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Using image shapes in Elementor, Divi and WordPress<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The <a href=\"https:\/\/refracttools.com\/image-shape-masks\/\">image shape generator<\/a> has a &#8220;Paste into&#8221; menu that targets the image inside Elementor&#8217;s Image widget, Divi&#8217;s Image module, Bricks, Breakdance or a WordPress Image block, with steps for where to paste the CSS. Try it on your own photo first; the image stays on your device.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Shape your images<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Pick an arch, circle, pill, squircle, blob, wave edge, diagonal, hexagon or leaf in the <a href=\"https:\/\/refracttools.com\/image-shape-masks\/\">image shape mask generator<\/a>, set the proportions and copy the CSS. For a decorative blob behind an image rather than a mask on it, try the <a href=\"https:\/\/refracttools.com\/blob-generator\/\">CSS blob generator<\/a>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><em>Last checked: October 2026.<\/em><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><em>Sources: <a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/CSS\/clip-path\" rel=\"noopener\" target=\"_blank\">MDN: clip-path<\/a>, <a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/CSS\/mask\" rel=\"noopener\" target=\"_blank\">MDN: mask<\/a>, <a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/CSS\/object-fit\" rel=\"noopener\" target=\"_blank\">MDN: object-fit<\/a>.<\/em><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Arches, hexagons, diagonals, blobs and waves: how to shape images with border-radius, clip-path and mask, keep a gallery consistent, and add a shadow that follows the shape.<\/p>\n","protected":false},"author":1,"featured_media":141,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_refract_tool":"image-shape-masks","footnotes":""},"categories":[8],"tags":[4,5,13],"class_list":["post-142","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-css-techniques","tag-css-generators","tag-image-tools","tag-ui-design"],"_links":{"self":[{"href":"https:\/\/refracttools.com\/blog\/wp-json\/wp\/v2\/posts\/142","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/refracttools.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/refracttools.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/refracttools.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/refracttools.com\/blog\/wp-json\/wp\/v2\/comments?post=142"}],"version-history":[{"count":1,"href":"https:\/\/refracttools.com\/blog\/wp-json\/wp\/v2\/posts\/142\/revisions"}],"predecessor-version":[{"id":167,"href":"https:\/\/refracttools.com\/blog\/wp-json\/wp\/v2\/posts\/142\/revisions\/167"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/refracttools.com\/blog\/wp-json\/wp\/v2\/media\/141"}],"wp:attachment":[{"href":"https:\/\/refracttools.com\/blog\/wp-json\/wp\/v2\/media?parent=142"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/refracttools.com\/blog\/wp-json\/wp\/v2\/categories?post=142"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/refracttools.com\/blog\/wp-json\/wp\/v2\/tags?post=142"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}