~/css/border-radius-generator
CSS Border Radius Generator
Set the rounding of each corner separately or all four together, in pixels or percent, and watch the shape change. Push the values high in percent and you get pills, circles, leaves and organic blob shapes.
Using the CSS Border Radius Generator
The shorthand order
border-radius with four values runs clockwise from the top left: top left, top right, bottom right, bottom left. One value rounds all corners equally. The generator writes the shortest correct form.
Pixels or percent
Pixel values keep the same rounding whatever the size, the right choice for buttons and cards. Percent values scale with the element: 50% on a square makes a circle, and on a rectangle an ellipse. Large unequal percentages give soft, organic blob shapes.
Pills and circles
For a pill-shaped button, use a radius larger than half the height, such as 999px; the browser caps it so the ends are perfectly round. For a circle, give a square element 50%.
Rounding and overflow
Rounded corners clip the element's background and border, but not its children. Add overflow: hidden to the parent if an image inside should follow the rounded corners.
Radius and design consistency
Pick two or three radius values for a whole interface, for example 6px for small controls, 12px for cards and 999px for pills, and reuse them everywhere. Nested elements look best when the inner radius equals the outer radius minus the padding between them, so corners stay parallel.
How do I round only the top corners?
Set the top-left and top-right values and leave the bottom ones at zero, or use the longhand properties border-top-left-radius and border-top-right-radius. This is common for cards with an image at the top and for tabs that sit on a panel.
Worked example: a card and its image
If a card has border-radius: 12px and an image at the top, the image's square corners will poke out. Either give the card overflow: hidden so the image is clipped to the rounded shape, or give the image the same top radius. Use the same radius on related elements, such as cards, buttons and inputs, so the interface looks consistent.
Frequently asked questions
Can I make elliptical corners?
Yes, with the slash syntax: border-radius: 40px / 20px sets horizontal and vertical radii separately. Percent values on a rectangle also give elliptical corners.
Does border-radius affect performance?
No, it is cheap to render. Animating it on many elements can cost a little, so prefer transforms for motion.
Can I clip images to other shapes?
Yes. For triangles, stars and polygons use the CSS clip-path generator.
What is the difference between 50% and a large pixel value?
50% on a square makes a circle, and on a rectangle makes an ellipse. A very large pixel value, such as 9999px, makes a pill shape with straight sides on any rectangle, which is why it is used for rounded buttons and tags.
Does border-radius round the outline too?
In current browsers, yes: outlines follow the rounded corners. Older browsers drew square outlines, which is one reason some sites used box-shadow for focus rings.