Skip to main content

Border Radius Generator

Create CSS border-radius with a visual corner editor.

Reviewed by · Last reviewed

12px
12px
12px
12px
CSS
border-radius: 12px;

Working with the Border Radius Generator

  1. Start linked. With the "Linked" toggle on, moving any corner slider adjusts all four evenly - fastest way to block out a pill, a circle, or a standard card.
  2. Switch to unlinked when you need asymmetry. Each of the four sliders maps to top-left, top-right, bottom-right, bottom-left - the same order the CSS shorthand uses.
  3. Flip units between px and %. Pixels stay constant as the element resizes; percentages track the box dimensions and produce elliptical corners on non-square elements.
  4. Try the preset shapes - squircle, blob, pill, circle - as a starting point before you fine-tune.
  5. Copy the CSS. The output uses the four-value shorthand border-radius: a b c d, which is copy-ready for any stylesheet or Tailwind rounded-[var] arbitrary value.

How border-radius is actually drawn

CSS border-radius produces a quarter-ellipse at each corner of the element\'s border box. The horizontal radius clips the top/bottom edges; the vertical radius clips the left/right edges. When you write a single value like 12px, both radii are equal and you get a circular arc. When you use the slash form 12px / 24px, the horizontal and vertical radii differ and you get a true elliptical corner - the shape designers sometimes call a "squircle-ish" bulge.

The browser rasterizes these arcs using the same anti-aliased path rendering that handles SVG, so rounded corners remain crisp at any devicePixelRatio. Backgrounds, borders, box-shadow, and any overflow: hidden clipping all respect the rounded outline automatically. One subtle consequence: border-radius applies to the border box, so a thick border visually ends up with a tighter inner curve than outer curve, which is mathematically correct but can look off on icon buttons. The CSS Backgrounds and Borders Module Level 3 specifies this rendering, and every modern browser matches the spec pixel-for-pixel.

Real situations where you need it

  • Card components at 8-16px radius - the dominant look across shadcn/ui, Material, and iOS.
  • Avatars at 50% for a perfect circle as long as the element is square.
  • Pill-shaped buttons using border-radius: 9999px - the huge value caps out at half the shorter side, giving a fully rounded end no matter the aspect ratio.
  • Asymmetric cards like chat bubbles where one corner is squared and the others rounded.
  • Organic "blob" decorations using the eight-value a b c d / e f g h slash form to give each corner a unique elliptical shape.
  • Image masks where rounded corners plus overflow: hidden clips the content without needing SVG.

Edge cases that trip people up

  • Percentage on non-square elements. border-radius: 50% on a 200x100 box makes an ellipse, not a circle. Use 9999px for a guaranteed pill and equal width/height for a guaranteed circle.
  • Radii larger than the box. The browser automatically scales them so adjacent corners never overlap - border-radius: 500px on a 40px button gives the same visual result as 20px. There\'s no need to clamp it yourself, but be aware the literal number you see in DevTools may not render.
  • Inner vs outer curve on borders. With a 4px border and an 8px radius, the outside curve has a 8px radius and the inside has a 4px one. Add padding plus a smaller inset box-shadow if you want both curves to match.
  • Transparent backgrounds plus background-image. An image set with background-image clips to the rounded corners; but <img> tags inside an element don\'t - you\'ll need overflow: hidden on the wrapper.
  • Focus outlines. Many browsers now draw the :focus-visible outline following the radius (per CSS UI Level 4), but older builds still drew a rectangle - if you need a rounded focus ring everywhere, apply outline-offset plus a custom box-shadow.
  • True iOS-style "squircles". CSS arcs are circular, not the superellipse Apple uses. To match iOS app icons you need the CSS Houdini Paint API or an SVG shape.

The spec and history behind it

Rounded corners were one of the most requested CSS features of the 2000s - before support landed, developers used nested rounded-PNG corners, image sprites, or JavaScript canvas hacks. border-radius appeared in Firefox 1.0 (2004) with the -moz- prefix, then -webkit-, and finally unprefixed in all major browsers around 2011 with IE9. It is now defined in CSS Backgrounds and Borders Module Level 3 along with the extended per-corner properties (border-top-left-radius, etc.) and the elliptical slash syntax. Every value in the shorthand accepts any <length> or <percentage>, and logical-property variants like border-start-end-radius are specified in CSS Logical Properties Level 1 for RTL-friendly layouts.

Generator vs writing it by hand

For a single border-radius: 8px you absolutely do not need a tool. Where this generator earns its keep is when you need asymmetric or elliptical corners - the eight-value syntax 40px 20px 40px 20px / 20px 40px 20px 40px is genuinely hard to visualize without a live preview. Figma and Sketch output the same property via plugins, but they don\'t let you experiment with CSS-specific quirks like the border-radius scaling rule or how percentages behave on fluid containers. Compared to Tailwind\'s rounded-* utilities, this tool shows you what numeric pixel value each class maps to, which is useful when you need one-off values outside the scale. For design-system work, the best workflow is: prototype here, pick three to five values that cover your needs, and then codify them as tokens.

Frequently Asked Questions

What exactly does border-radius round?

It rounds each of the four corners of the element's border box using a quarter-ellipse. The background, the border itself, any <code>box-shadow</code>, and any <code>overflow: hidden</code> clipping all follow the rounded outline automatically. Child elements do not - an <code>&lt;img&gt;</code> inside a rounded <code>&lt;div&gt;</code> will still render square unless the parent has <code>overflow: hidden</code> or the image gets its own <code>border-radius</code>.

Why does my "perfect circle" look like an oval?

Because <code>border-radius: 50%</code> uses percentages relative to the element's width and height independently. On a 200x100 box that produces a 100px horizontal radius and a 50px vertical radius - a squashed ellipse. For a true circle, set equal <code>width</code> and <code>height</code>, give the element <code>aspect-ratio: 1</code>, or use a huge pixel value like <code>9999px</code> combined with a square element.

What is the difference between the four-value and eight-value syntax?

The four-value form <code>border-radius: a b c d</code> sets a single radius for each corner (circular arcs). The eight-value form <code>border-radius: a b c d / e f g h</code> splits each corner into a horizontal radius and a vertical radius, producing elliptical arcs. Use the eight-value form when you want corners that bulge more on one axis than the other - common in organic "blob" shapes.

What happens if I set a border-radius larger than the element?

The CSS Backgrounds Level 3 spec says the browser must proportionally scale all corner radii so that adjacent corners never overlap. The effective maximum is half the shorter side of the element. This is why <code>border-radius: 9999px</code> safely produces a pill shape on any button without breaking if the button gets wider - the value is clamped at runtime.

Can I animate border-radius?

Absolutely, and it interpolates smoothly between lengths and percentages as long as the unit is consistent across keyframes. Animating <code>border-radius</code> triggers a repaint but not a reflow, so it is cheap on modern browsers. For the popular "morphing blob" look, animate the eight-value syntax - each sub-radius can have its own keyframe curve, which is what gives the organic feel.

Do my border-radius values get sent anywhere?

No. All four slider positions live in local Preact component state, the CSS string is built with plain template literals, and the preview is rendered with an inline <code>style</code> attribute. There is no server call, no remote rendering, no WebSocket. You can verify by opening DevTools, switching to the Network tab, and dragging the sliders.

How do I get an iOS-style squircle shape?

You cannot, not exactly. iOS uses a continuous superellipse where curvature transitions gradually into the straight edge. CSS <code>border-radius</code> produces a circular or elliptical arc that meets the edge at a right angle, which is mathematically different. To match iOS precisely you need an SVG clip-path with a Bezier approximation, or the CSS Houdini Paint API. Visually, 20-25% radius comes close enough for most cases.

Is browser support for border-radius complete?

Yes - the unprefixed <code>border-radius</code> property is supported in every browser dating back to IE9, Android 2.1, and iOS 4, with 100% compatibility on caniuse.com. The only subtlety is that some older mobile WebViews pre-Android 5 had minor rendering glitches at very large percentage values, which are effectively non-issues on today's web. No prefixes or fallbacks are needed.

More CSS & Design