CSS border radius generator

Set the rounding for all corners at once or for each corner separately, in pixels or percent, and optionally elliptical with separate horizontal and vertical radii. The generator writes the value in its shortest valid form, lists the four longhand properties and works out which radii the browser actually uses at your box size.

Adjust the corners

border-radius: 24px 8px;
E.g. 12px, 50% or 40px 10px / 20px 5px
px
px
Your inputs are saved in this browser only.

Result

CSS declaration (shortest form)
border-radius: 24px 8px;
Longhand properties
PropertyValue
border-top-left-radius24px
border-top-right-radius8px
border-bottom-right-radius24px
border-bottom-left-radius8px
Used radii at this box size
Cornerhorizontalvertical
Top left24 px24 px
Top right8 px8 px
Bottom right24 px24 px
Bottom left8 px8 px

How it is calculated

How the browser reads border-radius

The shorthand takes one to four values in the order top left, top right, bottom right, bottom left – clockwise. Missing values are filled in just like margin:

ValueMeaning
12pxall four corners 12 px
24px 8pxtop left and bottom right 24 px, top right and bottom left 8 px
24px 8px 4pxtop left 24 px, top right and bottom left 8 px, bottom right 4 px
40px 10px / 20px 5pxelliptical: horizontal radii before the slash, vertical radii after it

The generator reduces every input to the shortest equivalent form: 10px 10px 10px 10px becomes 10px, and a slash with identical values is dropped.

Percentages: width and height separately

Percentages refer to the box width horizontally and to its height vertically. 50% therefore turns a square into a circle, but a 240 × 160 px rectangle into an ellipse with 120 px and 80 px radii. For a circle-shaped corner on a rectangle, use pixels.

When curves overlap

If two adjacent radii add up to more than the side they share, the W3C specification makes the browser scale all radii by the same factor f = min(side length ÷ sum of the two radii on that side).

Example “pill shape” border-radius: 9999px on a 200 × 40 px button: on the left and right, the sum is 9999 + 9999 = 19,998 px against a 40 px height, so f = 40 ÷ 19,998 ≈ 0.002. Each corner gets 9999 × f = 20 px – exactly half the height, so the ends are perfect semicircles. “Used radii” shows these values for your box.

Frequently asked questions

How do I make a circle with CSS?

Give a square element border-radius: 50%. On a rectangle, 50% produces an ellipse; for rounded ends (a pill shape), use a very large pixel value such as 9999px.

What does the slash in border-radius mean?

It separates horizontal from vertical radii. 40px / 20px rounds each corner as a quarter ellipse, 40 px wide and 20 px tall. With up to four values on each side, that makes eight values in total.

Why is the rounding smaller than what I set?

Because the curves would otherwise overlap. The browser then scales all radii down by the same ratio – including corners that would have fit on their own. The generator shows the factor and the radii actually used.

What order do the four values follow?

Top left, top right, bottom right, bottom left – clockwise from the top left. The longhand properties are border-top-left-radius, border-top-right-radius, border-bottom-right-radius and border-bottom-left-radius.

Sources and legal basis

As of:

Related tools