Border Radius in CSS: Rounded Corners, Pills, Circles and Blob Shapes
Rounded corners are one of the most visible design decisions in an interface. Sharp corners feel precise and formal; soft corners feel friendly; fully rounded pills feel playful. In CSS it all comes down to one property, border-radius, which is more capable than most people realise.
The basics
border-radius: 12px;This rounds all four corners with a 12px radius: imagine a circle with a 12px radius tucked into each corner. The shorthand accepts up to four values, in clockwise order starting top-left:
border-radius: top-left top-right bottom-right bottom-left;With two values, the first applies to top-left and bottom-right, the second to top-right and bottom-left. With three, the middle value covers top-right and bottom-left. You can also set corners individually with properties like border-top-left-radius.
Pixels versus percentages
| Unit | Behaviour | Best for |
|---|---|---|
| px or rem | Same corner size regardless of element size | Buttons, cards, inputs, consistent UI |
| % | Relative to the element’s width (horizontal radius) and height (vertical radius) | Circles, ellipses, organic shapes |
| Very large px (e.g. 999px) | Clamped to make a perfect pill | Pill buttons and tags |
Percentages are relative to each dimension separately. On a square, border-radius: 50% makes a circle. On a rectangle, 50% makes an ellipse, because the horizontal radius is half the width and the vertical radius is half the height.
Pills: why 999px works
When the radii of adjacent corners add up to more than the side length, the browser scales all radii down proportionally until they fit. So border-radius: 999px on a 40px-tall button becomes a 20px radius: a perfect pill, at any width. This is more reliable than 50%, which would create an ellipse on a wide button.
Elliptical corners: the slash syntax
Each corner can have different horizontal and vertical radii. Write horizontal values, a slash, then vertical values:
border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%;This produces organic, blob-like shapes using only CSS. Designers sometimes call this “fancy border radius”. It is lighter than an SVG for simple decorative shapes, though for more complex organic shapes an SVG blob generator gives smoother and more controllable results.
The nested radius rule
When a rounded element sits inside another rounded element with padding, using the same radius for both looks wrong: the inner corners appear too round and the gap between them looks uneven. The fix is simple math:
inner radius = outer radius − padding
A card with a 24px radius and 8px padding should contain an image with a 16px radius. If the padding is larger than the outer radius, the inner element should have a radius of 0 or a small value. Apple’s rounded app icons and many hardware designs follow this rule, which is why their nested shapes look so clean.
Clipping content
border-radius rounds the element’s background and border, but child elements can still stick out of the corners. Add overflow: hidden (or overflow: clip) to the container to clip images and other children to the rounded shape. This is the standard way to round the top corners of an image inside a card.
Corner radius and brand personality
| Radius | Feel | Examples of where it fits |
|---|---|---|
| 0–2px | Precise, serious, technical | Finance, enterprise tools, editorial |
| 4–8px | Neutral, modern default | Most web apps and SaaS products |
| 12–20px | Friendly, approachable | Consumer apps, mobile-first products |
| Pill / full | Playful, soft | Tags, chips, buttons in casual brands |
Consistency matters more than the exact value. Pick two or three radius tokens, for example small (inputs and tags), medium (buttons) and large (cards and modals), and use them everywhere.
Squircles and smooth corners
A standard CSS rounded corner is a circular arc that meets the straight edge abruptly. Apple’s icons and some hardware use “continuous” or superellipse corners, where the curvature changes gradually, so the corner looks smoother. CSS is gaining a corner-shape property that can draw squircles, but browser support is still limited. Until it is widespread, an SVG mask or clip-path is the most reliable way to get a true squircle.
Images with rounded corners
There are two ways to show a rounded image:
- CSS: apply
border-radiusto the<img>. Easy to change later, no file editing, and the original stays usable elsewhere. - Baked into the file: export the image with transparent corners using a tool like our rounded corners tool. Needed for places that don’t support CSS, like email clients, presentations, documents and social media.
We compare both approaches in rounded corners: CSS versus baked-in images.
Accessibility and usability notes
Rounded corners don’t affect accessibility directly, but heavily rounded buttons with low-contrast backgrounds can look like tags or labels rather than actions. Make sure interactive elements still look interactive, and check focus outlines: outline follows border-radius in all current browsers, so focus rings look neat on rounded buttons.
Common shapes and their values
- Circle: equal width and height,
border-radius: 50% - Pill:
border-radius: 999px - Rounded top only:
border-radius: 12px 12px 0 0 - Leaf:
border-radius: 0 50% - Nested: inner = outer − padding
Experiment with every corner and unit in the border radius generator above, then save your final values as tokens so the whole interface shares one corner style.