Saved

Press the star next to a tool's name to save it.

All my tools

Border Radius Generator

This border radius generator lets you round each corner of a box with sliders, in pixels or percent, with elliptical corners, and copy the shortest CSS for it.

Untick Same radius for all corners to set each corner on its own. The CSS uses the shortest form of border-radius that gives the same shape.

Preview and CSS

A border radius generator lets you round the corners of a box visually and copy the CSS. Move the sliders for each corner, switch between pixels and percent, or turn on elliptical corners, and this border radius generator shows the shape live and writes the shortest border-radius declaration that produces it. Start from a preset such as Rounded, Pill, Leaf or Tab, adjust it, and paste the CSS into your stylesheet.

How to use the border radius generator

  1. Pick a preset, or start from the default rounded box.
  2. Choose pixels or percent. Percent is relative to the box's size.
  3. Move the corner sliders. With Same radius for all corners ticked, they move together; untick it to set each corner on its own.
  4. Tick Elliptical corners to set separate vertical radii.
  5. Change the preview size and colors to match your design.
  6. Press Copy CSS and paste it into your stylesheet.

What border-radius does

MDN describes border-radius as a CSS shorthand property that rounds the corners of an element's outer border edge. One radius per corner gives circular corners; two radii, a horizontal and a vertical one, give elliptical corners. It's shorthand for four properties: border-top-left-radius, border-top-right-radius, border-bottom-right-radius and border-bottom-left-radius. It works on any element with a box, whether or not it has a visible border, so it rounds backgrounds, images and shadows too.

The shorthand, value by value

border-radius takes one to four values, which apply to the corners in this order: top-left, top-right, bottom-right, bottom-left, going clockwise from the top-left.

ValuesMeaningExample
OneAll four cornersborder-radius: 12px;
TwoTop-left and bottom-right, then top-right and bottom-leftborder-radius: 0 40px;
ThreeTop-left, then top-right and bottom-left, then bottom-rightborder-radius: 10px 20px 30px;
FourTop-left, top-right, bottom-right, bottom-leftborder-radius: 60px 40px 70px 30px;

The generator always writes the shortest form: if all corners match it uses one value, if opposite corners match it uses two, and so on.

Elliptical corners

After the horizontal radii you can add a slash and up to four vertical radii. border-radius: 50px / 25px makes every corner an ellipse 50 pixels wide and 25 pixels tall. With Elliptical corners ticked, the tool shows a second set of sliders for the vertical radii and adds the part after the slash. When the vertical radii match the horizontal ones, the slash isn't needed, so it's left out.

Pixels or percent?

A pixel radius stays the same size whatever the box size, which suits buttons, cards and inputs. A percentage is measured against the box itself: the horizontal radius against its width and the vertical radius against its height. So border-radius: 50% on a square makes a circle, and on a rectangle it makes an ellipse. The percent sliders stop at 50%, because larger values on all corners give the same shape.

Worked examples

  • Card: all corners at 12px gives border-radius: 12px;
  • Pill button: a large radius such as 999px on every corner gives fully rounded ends whatever the button's width.
  • Tab: 16px on the top corners and 0 on the bottom gives border-radius: 16px 16px 0 0;
  • Leaf: 0 and 40px on opposite corners gives border-radius: 0 40px;
  • Avatar: 50% on a square image gives a circle.

Tips

  • Match nested radii. For a rounded box inside a rounded box, make the inner radius the outer radius minus the gap, so the curves look parallel.
  • Clip content with overflow: hidden when an image or child element pokes out of the rounded corners.
  • Keep a scale. Use a few radius sizes across a site, such as 4, 8 and 16 pixels, for a consistent look.

Browser support

MDN marks border-radius as Baseline and widely available, so the CSS from this tool works in all current browsers without prefixes.

Corners and shadows together

A box shadow follows the shape of the border radius, so rounded cards get rounded shadows automatically. Design the corners here, then add a shadow with the CSS box shadow generator using the same radius in its preview, and the two will match. Outlines follow the rounded shape in current browsers too, which keeps focus rings neat on rounded buttons and inputs.

When radii are too large

If the radii on one side add up to more than the length of that side, the browser scales all of them down proportionally until they fit. That's why a radius of 999px on a 40px-tall button doesn't break anything: the browser reduces it so the ends become perfect semicircles. It also means two adjacent corners can't overlap, however large you set them. Watch the preview as you drag the sliders to see this happen, especially in pixel mode on a small box.

Common mistakes

  • Mixing up the corner order. It's clockwise from top-left.
  • Using 50% for a pill on a wide button, which gives an oval; use a large pixel value.
  • Forgetting overflow: hidden on images inside rounded boxes.
  • Expecting a slash to mean division. It separates horizontal and vertical radii.

What next

Use this often? Add Border Radiu to your Home screen.

Frequently asked questions

What does the border radius generator do?

It lets you round each corner of a box with sliders, previews the shape, and writes the shortest border-radius CSS for it.

What order do border-radius values go in?

Clockwise from the top-left: top-left, top-right, bottom-right, bottom-left.

How do I make a circle with border-radius?

Set border-radius: 50% on an element whose width and height are equal.

What does the slash in border-radius mean?

Values after the slash are the vertical radii, which make elliptical corners. Values before it are the horizontal radii.

Should I use pixels or percent?

Pixels keep the same curve on any size of box. Percent scales with the box, which suits circles and ellipses.

What went wrong?

We only receive the reason you pick, never what you typed into the tool.

Thanks for your feedback.

More Developer Tools