Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4791 pages

Free tool · Developer tools

CSS border radius generator

Set the radius of each corner, watch the box change and copy the CSS. The default of 24px on the top left and bottom right and 8px on the other two corners becomes border-radius: 24px 8px;, the shortest way to write it.

  • Free
  • No sign-up
  • Runs in your browser

By Maaz Zindani · Updated

Corner radius
CSS
border-radius: 24px 8px;
  • 2 values in the shorthand
  • Round corners
In the 200 by 140 px preview
Fits: no scaling
Each corner
CornerHorizontalVertical
Top left24px24px
Top right8px8px
Bottom right24px24px
Bottom left8px8px

Values go in the order top left, top right, bottom right, bottom left. A value after a slash is the vertical radius.

How to use the CSS Border Radius Generator

  1. Pick a Unit (px, % or rem), or choose a ready shape under Start from a shape.
  2. Type a radius for each corner under Corner radius. An empty box counts as 0.
  3. Tick Different vertical radius to give every corner its own vertical value and make elliptical corners.
  4. Press Copy CSS and paste the line into your stylesheet. The table lists each corner with its two radii.

How does the border-radius shorthand work?

The values go in the order top left, top right, bottom right, bottom left, clockwise from the top left. With four values every corner has its own radius. With fewer values the missing corners copy another one: a missing bottom left copies the top right, a missing bottom right copies the top left, and a missing top right copies the top left. That is why the generator writes the shortest form that means the same thing.

With the default radii of 24, 8, 24 and 8 pixels the two diagonal pairs match, so two values are enough: 24px 8px. If only the top right and bottom left match, as with 24, 8, 4 and 8 pixels, three values are used: 24px 8px 4px. When all four differ, such as a chat bubble with a sharp bottom left corner, the result is 20px 20px 20px 0. A radius of zero is written without a unit.

How do I make elliptical corners with a slash?

A circle uses one number per corner. An ellipse needs two: a horizontal and a vertical radius. The shorthand lists the horizontal radii first, then a slash, then the vertical radii. The blob preset uses percentages for both: 60% 40% 30% 70% / 60% 30% 70% 40%. Percentages refer to the width of the box for the horizontal radius and to the height for the vertical one, so the same percent gives a different curve on a wide box than on a tall one.

Tick the vertical box to type separate values. When every vertical radius equals its horizontal twin the generator drops the slash, because the two forms are identical. A 50% radius on all four corners gives a circle on a square box and an ellipse on any other box.

Ready shapes and the CSS they give
ShapeCSS
Rounded boxborder-radius: 12px;
Pillborder-radius: 999px;
Circle or ellipseborder-radius: 50%;
Tab (top corners)border-radius: 16px 16px 0 0;
Chat bubbleborder-radius: 20px 20px 20px 0;
Leafborder-radius: 0 100px;
Blobborder-radius: 60% 40% 30% 70% / 60% 30% 70% 40%;

Why does a very large radius still look right?

Two neighbouring radii cannot add up to more than the side they share. When they do, the browser reduces all four radii by one factor, the smallest ratio of a side length to the sum of its two radii, until nothing overlaps. In the 200 by 140 pixel preview the pill preset of 999px has top and bottom sums of 1998px against 200px and side sums of 1998px against 140px. The smallest ratio is 140 divided by 1998, so every radius shrinks to about 70px, half the height, and the ends are fully round. The result card reads scaled to 7% for this case.

The same rule shows with percentages. Two top corners of 60% each add up to 120% of the width, so the preview reads scaled to 83.3%, which is 100 divided by 120. Keep neighbouring percentages at 50% or less if you want the exact numbers to apply. The tab shape, border-radius: 16px 16px 0 0;, never overlaps, because its bottom radii are 0.

Which unit should I use for border radius?

Pixels give a fixed curve that stays the same when the box grows. Percentages scale with the box, which suits circles, ovals and organic shapes. Rem units follow the root font size, so the corners grow with text zoom, and the overlap check in this page counts 1rem as 16 pixels. For buttons and cards, a few pixels or a rem value is usual. For avatars, 50% is the common choice.

Related generators on this site handle the other parts of a card: the box shadow generator for depth and the px to rem converter for turning pixel radii into rem values.

Use it with

Questions

What is the order of values in border-radius?

Top left, top right, bottom right, bottom left. Leave values out and the missing corners copy a neighbour: bottom left copies top right, bottom right copies top left.

How do I make a circle with border-radius?

Use 50% on a box that is as wide as it is tall. On any other box the same 50% gives an ellipse.

What does the slash in border-radius mean?

The values before the slash are the horizontal radii and the values after it are the vertical radii, as in 60% 40% 30% 70% / 60% 30% 70% 40%.

How do I make a pill shape?

Use a radius larger than half the height, such as 999px. The browser scales all radii down to fit, so the ends are fully round, as in the preview here.

Can border-radius be negative?

No. Negative values are not valid, and the generator reports them as an error.

Does the page keep what I type?

No. The radius values are handled in the page and not sent anywhere.

The tool's results are computed in your browser by the code on this page, using the sources listed above; the explanations are checked against the tool's own output.