Frontend

CSS Shape Generator: Draw Rounded clip-path Shapes and Copy the CSS

Mayur Dabhi
Mayur Dabhi
November 19, 2026
10 min read

You need a hexagon badge with soft corners, or a speech bubble with a tail, and border-radius only gets you rounded rectangles. Writing clip-path: polygon() coordinates by hand is slow, and it still won't round a single corner. That's the gap a CSS shape generator fills: you draw the shape, tweak the corners and colors, and copy CSS you can paste straight into a stylesheet. I built a free one, ShapeForge, and this post shows how to use it and what the copied CSS really does.

Short answer

Open cssshapes.mayurdabhi.com, pick a shape, set the corner radius and fill, add a shadow or motion if you want, then press Copy CSS. Boxes export as border-radius. Every other shape exports as clip-path: path() with rounded corners baked in as arcs, plus a wrapper that carries filter: drop-shadow(), because clip-path hides a normal box-shadow. Use the SVG export when you need borders.

What CSS does a shape generator actually give you?

It depends on the shape. A good generator picks the simplest CSS that can draw it, and there are really only four options worth knowing.

TechniqueGood forRounded cornersCatch
border-radiusSquares, rectangles, circles, pillsYes, per cornerOnly works on boxes
clip-path: polygon()Triangles, arrows, starsNoSharp corners only
clip-path: path()Any outline, curves, rounded polygonsYes, as arcs in the pathLengths are pixels only
Inline SVGBorders on odd shapes, holes, gradient strokesYesMore markup to paste

ShapeForge uses that order. If your shape is a plain box, you get border-radius and a real box-shadow, which is the most boring and most reliable CSS there is. As soon as the outline stops being a box, it switches to clip-path: path(). MDN lists path() as Baseline widely available since July 2020, so it's safe in every current browser.

I skip polygon() on purpose. It can't round anything, and the moment someone asks for "the same hexagon but softer" you'd have to throw it away.

Making a CSS shape in ShapeForge, from blank canvas to copied code

The editor has three tabs on the left (Shape, Style, Motion) and an Info and export panel on the right. Everything runs in the browser. Nothing is uploaded, and your last project stays in local storage, so a refresh doesn't lose it.

1. Pick or draw the outline

The quick buttons cover the common ones: triangle, square, circle, hexagon, star, heart, cloud, speech bubble, burst, arrow, plus donut and gear. The type menu goes further, with regular polygons from 3 to 64 sides, parallelograms and trapezoids. There's also a "draw with lines and angles" mode where you type each side's length and the inside angle. The shape closes itself with a final line back to point A.

You can also drag any white handle on the canvas. Dragging turns the shape into a custom polygon, which is fine. The table on the right still shows every angle and side length, and editing a number there moves the next point for you.

2. Round the corners

The Corners section has one slider for all corners. Each corner also has its own radius field in the Points table, so a speech bubble can have soft corners on the body and a sharp tail. If a radius is too big for the sides next to it, the tool clamps it and outlines that field in yellow instead of drawing a broken shape.

3. Fill, then border and shadow

Fills can be solid, linear, radial or conic gradients (with up to 20 color stops), or an image. Uploaded images are resized to 1200px at most and embedded, so they never leave your machine. Borders and shadows live in the Style tab, and the Style looks menu at the top applies ready-made combinations like Glass, Neon outline or Clay.

4. Motion and animated backgrounds

The Motion tab has 14 motions (spin, pulse, float, bounce, swing, jelly, plus a few more) plus three extras you can stack on top: a rotating gradient, a marching dashed border and a hue cycle. The rotating gradient is the one people usually mean by "animated background". The preview background setting below it only changes the canvas, not your shape.

5. Copy the CSS

Press Copy CSS, or open "Show code" to see all four formats side by side (SVG, CSS, HTML, JSON). The CSS tab always comes with a two-div HTML snippet. The outer .sf-wrap matters, and the hands-on section shows why.

I scripted the editor and copied its CSS exports

I wanted the exports in this post to be exactly what the tool produces, not something I retyped. So I loaded the deployed editor files in jsdom 29.1.1 on Node v25.2.1 and clicked through the UI from a script: the same quick buttons, sliders, gradient presets a person would use. jsdom doesn't paint pixels, so this checks the generated code, not how it looks on screen.

lab.js
// lab.js: drive the ShapeForge editor in jsdom and print the CSS it exports
const fs = require('fs'), path = require('path');
const { JSDOM } = require('jsdom');
const ROOT = process.env.SITE; // folder with index.html and js/
const dom = new JSDOM(fs.readFileSync(path.join(ROOT, 'index.html'), 'utf8'), { runScripts: 'outside-only', pretendToBeVisual: true });
const w = dom.window, d = w.document;
w.ResizeObserver = class { observe() {} };
for (const f of ['geometry.js', 'vendor/polygon-clipping.umd.min.js', 'render.js', 'app.js']) w.eval(fs.readFileSync(path.join(ROOT, 'js', f), 'utf8'));

const click = (sel) => d.querySelector(sel).dispatchEvent(new w.MouseEvent('click', { bubbles: true }));
const set = (sel, v) => {
  const el = d.querySelector(sel); el.value = String(v);
  for (const t of ['input', 'change']) el.dispatchEvent(new w.Event(t, { bubbles: true }));
};
const exportCss = () => { d.querySelector('#codeDet').open = true; click('[data-exp="css"]'); return d.querySelector('#expText').value; };

if (process.argv[2] === 'square') {
  click('[data-act="quick"][data-n="Square"]');
  set('input[type=number][data-allr]', 24);         // all corners: 24px
  set('select[data-bind="fill.type"]', 'linear');
  click('[data-act="grad"][data-i="2"]');           // cyan to blue preset
  console.log(exportCss());
}
if (process.argv[2] === 'hexagon') {
  click('[data-act="quick"][data-n="Hexagon"]');
  set('input[type=number][data-allr]', 16);
  set('select[data-bind="fill.type"]', 'linear');
  click('[data-act="grad"][data-i="0"]');           // violet to pink preset
  set('select[data-bind="anim.type"]', 'spin');
  set('input[type=number][data-bind="anim.dur"]', 6);
  set('select[data-bind="anim.ease"]', 'linear');
  console.log(exportCss());
  console.log('Note in the panel: ' + d.querySelector('#expNote').textContent);
}

A rounded square: plain border-radius

First run: the Square quick button, 24 on the all-corners field and the cyan-to-blue gradient preset. The default soft shadow was still on.

Output
$ SITE=./public_html node lab.js square
/* ---- CSS ---- */
.sf-wrap {
  width: 200px;
  height: 200px;
}
.sf-shape {
  width: 200px;
  height: 200px;
  background: linear-gradient(135deg, #00f0ff 0%, #0066ff 100%);
  border-radius: 24px 24px 24px 24px;
  box-shadow: 0px 14px 28px 0px rgba(0,0,0,0.4);
}

/* ---- HTML ---- */
<div class="sf-wrap">
  <div class="sf-shape"></div>
</div>

No clip-path at all. The tool saw a box and wrote box CSS, with a normal box-shadow on the shape itself. The four-value border-radius looks redundant here, but it's there because each corner can differ. Change one corner in the Points table and only that value changes.

A rounded, spinning hexagon: clip-path: path()

Second run: Hexagon, 16px corners, the violet-to-pink gradient, then the spin motion at 6 seconds with linear easing.

Output
$ SITE=./public_html node lab.js hexagon
/* ---- CSS ---- */
@keyframes sf-spin{to{transform:rotate(360deg)}}
.sf-wrap {
  width: 220px;
  height: 190.526px;
  filter: drop-shadow(0px 14px 28px rgba(0,0,0,0.4));
}
.sf-shape {
  width: 220px;
  height: 190.526px;
  background: linear-gradient(135deg, #7c6cff 0%, #ff6fb1 100%);
  clip-path: path('M64.238 0L155.762 0A16 16 0 0 1 169.619 8L215.381 87.263A16 16 0 0 1 215.381 103.263L169.619 182.526A16 16 0 0 1 155.762 190.526L64.238 190.526A16 16 0 0 1 50.381 182.526L4.619 103.263A16 16 0 0 1 4.619 87.263L50.381 8A16 16 0 0 1 64.238 0Z');
  animation: sf-spin 6s linear 0s infinite normal;
  transform-origin: 50% 50%;
}

/* ---- HTML ---- */
<div class="sf-wrap">
  <div class="sf-shape"></div>
</div>
Note in the panel: Polygon via clip-path: path(). Outer shadows only; borders need the SVG export.

Three things in that output are worth reading closely.

Start with the A16 16 0 0 1 commands. Those are the corners. Each one is an SVG arc with a 16px radius, drawn between two straight sides. That's how a polygon gets rounded corners in CSS: you don't round the element, you round the outline.

Next, the shadow moved. On the square it sat on .sf-shape as a box-shadow. Here it's a filter: drop-shadow() on .sf-wrap, the parent. The next section explains why that move is required.

And the height is 190.526px, not a round number. A regular hexagon with 110px sides really is that tall. The tool keeps the real geometry instead of squashing the shape into a square box.

Why did my box-shadow disappear on a clip-path shape?

Because clip-path clips everything outside the outline, and that includes the element's own shadow. MDN's clip-path page puts it simply: parts inside the region are shown, while those outside are hidden. A box-shadow is drawn outside the box, so it's gone.

The fix is to put the shadow one level up. drop-shadow() works on the rendered pixels of the element and its children, following their alpha mask, while box-shadow always draws a rectangle behind the whole box. So the parent's drop-shadow follows the clipped hexagon, including the rounded corners. That's the whole reason the export gives you two divs.

Don't merge the two divs

A common cleanup is to delete the "extra" wrapper and move its filter onto .sf-shape. The shadow then gets clipped along with everything else and vanishes. Keep the filter on the parent. Inset shadows are the exception, and the CSS export leaves them out for polygons because they need SVG.

Borders hit the same wall. A CSS border on a clipped element follows the rectangle, not the hexagon, so the tool tells you "borders need the SVG export" instead of giving you CSS that looks wrong.

Animated backgrounds without JavaScript

You get each motion as one @keyframes rule plus one animation line, like the sf-spin above. There's no script to ship. If you want to tune the timing yourself, my post on CSS animations and transitions covers easing curves and which properties stay cheap to animate (transform and opacity, mostly).

What the export doesn't add is a reduced-motion fallback. Spinning or pulsing shapes can bother people with vestibular issues, so I add this next to any exported shape that moves:

CSS
@media (prefers-reduced-motion: reduce) {
  .sf-shape {
    animation: none;
  }
}

For gradient animation, the rotating-gradient extra is the safer choice for a hero background because it moves color, not the shape's position. If your site already themes colors with custom properties, you can swap the hex values in the exported gradient for your own variables. I wrote about that pattern in CSS variables for dynamic styling.

Making a clip-path: path() shape responsive

This is the gotcha most clip-path tutorials skip. MDN's path() page says every length in the path is implicitly in pixels and other units can't be used. Make .sf-shape 50% wide and the path stays 220px wide, so the shape gets cut off or leaves empty space.

There are three ways around it, and I'd pick them in this order.

Scale the whole thing. Keep the exported pixel sizes and scale the wrapper. Path, gradient, shadow: they all scale together because they're drawn at the original size first.

CSS
/* shrink the exported 220px hexagon on small screens */
@media (max-width: 480px) {
  .sf-wrap {
    transform: scale(0.6);
    transform-origin: top left;
  }
}

Transforms don't change layout size, so the element still takes its full 220px of space. Wrap it in a box with a fixed smaller size if that matters. If the shape lives inside a card that changes width, a container query is a better trigger than a viewport media query.

Use the SVG export. SVG has a viewBox, so it scales to any width with width: 100%; height: auto. For shapes that must stretch, this is the cleanest answer.

Wait for shape(), or use it now with a fallback. The newer shape() function accepts percentages, rem and calc(), which fixes the pixel problem. MDN marks it Baseline 2026, newly available since February 2026, which means older devices may not have it. ShapeForge exports path() today for that reason.

When I'd use the SVG export instead of CSS

CSS shapes are great for backgrounds and badges. I switch to the SVG export in four cases:

The SVG export is also the only one that supports every fill, border, shadow or animation at once. The PNG button renders that same SVG at up to 2x size, which is handy for a social image or a slide.

One more practical point: pick sizes close to what you'll use. Because path() works in pixels, designing a 220px shape and scaling it to 600px is fine visually, but the corner radius and shadow scale with it. If you want 16px corners at 600px, set the size to 600 in the editor and round the corners there. For layout around these shapes, the mobile-first responsive design basics still apply.

FAQ

Can I round only one corner of a clip-path polygon?

Yes. In ShapeForge, open the Points, angles and sides table in the Info panel and set the Radius field on just that corner. The exported clip-path then has an arc at that vertex and straight joins everywhere else. Plain clip-path: polygon() can't do this, which is why the tool exports path() instead.

Is the CSS shape generator free, and is my design uploaded anywhere?

It's free with no account. Everything runs in your browser. Projects are saved to your browser's local storage or downloaded as a .json file, and uploaded images are embedded locally. The only time your browser contacts another server is when you paste an image URL, because then it loads that image from its host.

Does clip-path: path() work in Safari?

Yes. MDN lists path() as Baseline widely available, working across browsers since July 2020, so current versions of all three engines (WebKit, Blink, Gecko) support it. The newer shape() function is the one to be careful with, since it only became Baseline in February 2026.

Why does my exported shape look blurry when I scale it up?

It usually isn't the shape. Clip-path edges stay sharp at any scale, but an embedded image fill was resized to 1200px at most, and a raster image scaled past its size gets soft. Use a larger source image by URL, or switch to a gradient fill, which stays crisp at any size.

Can I edit a shape again later?

Yes. Use File, then Save project to download a .json file, and Open project to load it back. The JSON keeps all of it: parts, corner radii, fills, motion. The last state is also kept in local storage, so closing the tab doesn't lose your work on the same browser.

CSS clip-path SVG Animations Tools
Mayur Dabhi

Mayur Dabhi

Full Stack Developer with 5+ years of experience building scalable web applications with Laravel, React, and Node.js.