Skip to content

CSS Border Radius Generator

Drag the handles to round each corner, or type the values: one radius, four corners, or all eight for elliptical and blob shapes. Set the element's real size to see what percentages and very large values actually draw, then copy the shortest border-radius.

Drag a handle

280×160px box. Cyan handles set the curve across, purple handles the curve down; dashed ellipses show each corner's curve.

.box {
  border-radius: 16px;
}

Corner order and the slash

border-radius lists corners clockwise from the top left. That is not the same starting point as margin or border-width, which start at the top edge, so a value copied between them lands on different places. Missing values copy the diagonally opposite corner.

How border-radius values map to corners
You writeTop leftTop rightBottom rightBottom left
12px12px12px12px12px
12px 4px12px4px12px4px
12px 4px 012px4px04px
18px 18px 18px 4px18px18px18px4px
40px / 16px40 × 1640 × 1640 × 1640 × 16

Each corner is really a quarter of an ellipse with a horizontal and a vertical radius. Values before the slash are the horizontal radii, values after it the vertical ones, each set in the same corner order. 40px / 16px gives every corner a curve 40px across and 16px down, which reads as a flatter, stretched rounding.

When corners overlap: the scaling rule

If two corners on the same side ask for more than the side's length, the browser does not just clip them. It works out, for each of the four sides, the side length divided by the two radii on it, takes the smallest of those ratios, and multiplies every radius by it.

f = min(side length ÷ sum of the two radii on that side), if below 1

That is why border-radius: 9999px makes a pill. On a 200×48 button the short sides give 48 ÷ (9999 + 9999) = 0.0024, and 9999 × 0.0024 = 24px, exactly half the height, whatever the button's size.

It also explains a surprise. On a 280×160 box with the top left at 200px and the rest at 0, the left side gives 160 ÷ 200 = 0.8, so the top-left corner is drawn at 160px. Add a 100px top right and the top side gives 280 ÷ 300 = 0.93, so the 0.8 still wins and the top right is drawn at 80px, not 100px, even though it never touched anything. The tool shows these drawn values when scaling kicks in.

Percentages, circles and pills

What common border-radius values draw on square and rectangular boxes
ValueOn a squareOn a 200×48 rectangle
50%CircleOval (100px across, 24px down per corner)
9999pxCirclePill with fully round ends
24pxRounded squarePill only while the height stays 48px
100% / 50%Lens shape: 100% across overlaps, so every corner is halved to 50% / 25%Lens: corners 100px across, 12px down

A percentage across is a share of the width, a percentage down a share of the height, so 50% only draws a circle on a square. For round ends on a box whose size can change, a very large pixel value is the reliable choice; for an avatar, make the element square first (aspect-ratio: 1) and then use 50%.

Rounding nested boxes

When a rounded box sits inside another with a gap around it, using the same radius on both makes the gap look thicker at the corners. For corners that look parallel, the inner radius should be the outer radius minus the gap:

inner radius = outer radius − padding (and border) between them
24px card, 8px padding → 16px image or button inside

If the gap is as large as the outer radius, the inner corners can be square.

Clipping images and children

border-radius rounds the element's own background and border. A child that reaches the edge, such as a full-width image at the top of a card, still has square corners and pokes out. Either give the child its own radius, or clip on the parent:

  • overflow: clip cuts off anything outside the rounded shape without making the card a scroll container (Chrome 90, Firefox 81, Safari 16).
  • overflow: hidden does the same in older browsers but turns the element into a scroll container, which can break position: sticky inside it.

Either way, dropdown menus, tooltips and focus outlines that extend outside the card are cut off too, so check those after adding it.

Squircles and corner-shape

Standard rounding joins a straight edge to a circular arc, and the change of curvature at the join is visible on large radii. The newer corner-shape property, from the CSS Borders and Box Decorations Level 4 draft, keeps the same border-radius sizes but changes the curve: squircle blends smoothly into the edges (the look of app icons), bevel cuts straight across, scoop curves inwards and notch makes a square cut-out.

It shipped in Chrome and Edge 139; Firefox and Safari have it only in preview builds at the time of writing. Because browsers ignore properties they do not know, adding it is safe: everyone else gets normal rounded corners from the border-radius line.

When the rounding does not show

Common border-radius problems
SymptomCauseFix
Image corners stay squareThe child is not clipped by the parent's radiusoverflow: clip on the parent, or a radius on the image
Table corners stay squareborder-collapse: collapse ignores border-radiusborder-collapse: separate; border-spacing: 0
Gradient border has sharp cornersborder-image ignores border-radiusUse the background-clip method
Radius smaller than writtenAdjacent corners overlap and are scaledSee the scaling rule above
Oval instead of circle50% on a box that is not squareaspect-ratio: 1, or equal width and height

Frequently asked questions

How do I round only the top corners?

Give the bottom two corners 0: border-radius: 12px 12px 0 0. The Tab preset does exactly that.

Should I use px, rem or % for border-radius?

px or rem for a fixed softness that should look the same on any size of box; % when the curve should grow with the element, as in circles, ovals and blob shapes.

Can I animate border-radius?

Yes. It transitions smoothly between any two values, including eight-value blob shapes, which is how "morphing blob" backgrounds are made. Keep the number of values the same at both ends.

Does border-radius affect the box shadow and outline?

Yes. box-shadow follows the rounded shape, and so does outline in current browsers.

Is there a maximum value?

No. Any non-negative value is valid; when corners would overlap, the browser scales them down evenly, as described above. Negative values are invalid and the line is ignored.

border-radius or clip-path?

border-radius rounds the box and keeps borders, shadows and outlines following the shape. clip-path can cut any shape, but it also cuts off shadows and outlines and leaves the clickable area to the clipped shape only. Use border-radius whenever corners are all you need.

Sources