CSS Border Radius Generator
This generator will help you create the CSS code necessary to style elements with rounded corners using the border-radius property on your webpages. With this tool, you can choose to apply a uniform radius to all corners, or customize each corner individually for more complex shapes.
New in this updated version: You can now also use the modern corner-shape property to create a variety of corner styles such as round, scoop, bevel, notch, square, squircle, and superellipse. This allows for more advanced and visually distinctive corner effects that go beyond the traditional border-radius options. You can apply the same corner style to all corners or customize each corner separately.
With the generator, you can instantly preview your selected corner styles in the live demo pane and copy the corresponding CSS code for use in your projects.
CSS Border Radius Generator
Border Radius Property
The CSS property border-radius allows you to make a rounded border or round the corners of an element. The value of the property determines the radius of the circle. When using the property, instead of drawing the usual right corners of the element, a rounded frame with rounded corners will be used according to an arc of a circle with a given radius:
The CSS property border-radius can contain from one to four values, separated by spaces. The number of values determines how the corner rounding radii are set. If more than one value is specified, corner rounding is set starting at the top left corner:
1 Value:
• The first value - Sets the radius for all corners of the block.
2 Values:
• First value - Sets the radius for the top left and bottom right corners of the block.
• Second value - Sets the radius for the top right and bottom left corners of the block.
3 Values:
• First value - Sets the radius of the rounding of the top left corner of the block.
• Second value - Simultaneously sets the radius for the top right and bottom left corners of the block.
• Third value - Sets the radius of the bottom right corner of the block.
4 Values:
• First value - Sets the radius of the top left corner of the block.
• Second value - Sets the radius of the top right corner of the block.
• Third value - Sets the radius of the bottom right corner of the block.
• The fourth value - Sets the radius of the bottom left corner of the block.
In addition to the border-radius property, you can also set theradius of each corner of the block separately using the following CSS propeties:
- border-top-left-radius - Rounds the top-left corner of an element.
- border-top-right-radius - Rounds the top-right corner of an element.
- border-bottom-left-radius - Rounds the bottom left corner of an element.
- border-bottom-right-radius - Rounds the bottom right corner of an element.
The border-radius property also allows you to round off corners as an oval arc rather than a circle:
To define an oval, a combination of two values is used, separated by an / symbol:
border-radius: 20px / 35px;
The value to the left of the slash defines the horizontal radius and the value to the right defines the vertical radius.
Each of the two parts (before and after the slash) follows the same rules as when creating round radius. This means that each part can contain from one to four values, separated by spaces. And the number of specified values will determine how the corner radii are set. For example, the four values before the symbol / represent the horizontal radii for the top-left, top-right, bottom-right, and bottom-left corners. The values after the symbol / respectively represent the vertical radii for the same corners.
• First value - Sets the radius of the horizontal radius of each corner of the block.
• Second value - Sets the radius of the vertical radius of each corner of the block.
Frequently Asked Questions
What is the CSS border-radius property?
border-radius is a CSS property that rounds the corners of an element's outer border edge.
Instead of the default sharp right-angle corners, the browser draws an arc based on the radius value you supply.
A single value like border-radius: 10px applies the same rounding to all four corners, while multiple values let you control each corner independently.
How do I make a perfect circle with CSS border-radius?
Set border-radius: 50% on an element that has equal width and height.
Using a percentage value means the radius is calculated as half the element's dimensions, producing a perfect circle regardless of the element's size.
For example: width: 100px; height: 100px; border-radius: 50%; will render a circle.
If the element is not square, the same rule produces an ellipse instead.
How do I round only specific corners with border-radius?
You can either use the shorthand with multiple values or the individual corner properties.
With the shorthand, values are applied clockwise from the top-left: border-radius: 10px 20px 5px 40px sets top-left, top-right, bottom-right, and bottom-left respectively.
Alternatively, use the individual properties: border-top-left-radius, border-top-right-radius, border-bottom-right-radius, and border-bottom-left-radius to target specific corners directly.
What is the difference between px and % values in border-radius?
A px value sets an absolute radius that stays fixed regardless of the element's size - useful when you want consistent rounding at a known size, such as a 4px radius on a button.
A % value is relative to the element's dimensions: for the horizontal radius it is a percentage of the element's width, and for the vertical radius it is a percentage of the height.
This means 50% always produces a perfect circle or ellipse no matter how the element is sized, making it the preferred approach for responsive designs.
How do I create an elliptical corner with border-radius?
Use the slash syntax to specify separate horizontal and vertical radii: border-radius: 20px / 35px.
The value before the slash sets the horizontal radius for all corners and the value after sets the vertical radius, producing an oval arc rather than a circular one.
Both sides of the slash follow the same one-to-four value rules as the standard shorthand, so you can combine them to set elliptical radii on individual corners independently.
What does border-radius: 10px 20px mean (two values)?
When two values are supplied, the first sets the radius for the top-left and bottom-right corners, and the second sets the radius for the top-right and bottom-left corners.
So border-radius: 10px 20px gives you two pairs of diagonally opposite corners with different rounding - a common technique for creating distinctive card or badge shapes.
What is the corner-shape property and how does it differ from border-radius?
corner-shape is a newer, experimental CSS property that works alongside border-radius to change the type of curve used at each corner, rather than just its size.
While border-radius controls how large the rounded area is, corner-shape controls its geometry - options include round (the classic arc), scoop (a concave curve cutting inward), bevel (a straight diagonal cut), notch (a sharp right-angle cut inward), squircle, and superellipse.
Because it is still experimental, browser support is limited and it should be used with a fallback.
Can I animate border-radius with CSS?
Yes. border-radius is an animatable property, so it works with both CSS transitions and CSS animations.
For example, you can smoothly transition a square button to a pill shape on hover: transition: border-radius 0.3s ease; combined with a :hover rule that changes the radius value.
The browser interpolates between the start and end radius values, including complex multi-value and slash-syntax declarations.
How do I make a pill or capsule shape with CSS?
Set border-radius to a value that is at least half the element's height.
A common shortcut is to use a very large value like border-radius: 9999px - the browser caps the radius at the maximum possible for the element's dimensions, which always produces fully rounded ends regardless of the element's width.
This works on buttons, tags, badges, and any other element where you want a true pill or capsule appearance.
Does border-radius affect the element's clickable area or layout?
No. border-radius is purely visual - it clips the painted appearance of the element but does not change its box model, so the element's width, height, margin, and padding are completely unaffected.
However, the clipped corners do affect overflow: content or child elements that extend into a rounded corner will be clipped if overflow: hidden is set on the parent.
The clickable hit area also remains rectangular, matching the element's full bounding box rather than the visible rounded shape.
CSS References Used
- CSS Property
- corner-shape
- CSS Property
- border-radius
- CSS Property
- border-top-left-radius
- CSS Property
- border-top-right-radius
- CSS Property
- border-bottom-left-radius
- CSS Property
- border-bottom-right-radius
- CSS Property
- border
- CSS Data Type
- <color>
- CSS Data Type
- <length>
