CSS design
How to generate CSS border radius
The border-radius property rounds an element’s corners. One value rounds every corner, while CSS shorthand lets you control each corner clockwise.
Open the CSS border radius generatorStart with one radius
Apply the same radius to all four corners with one value:
border-radius: 16px;
A small value creates a subtle curve. A larger value creates a softer shape. The visible result also depends on the element’s width and height, so 16px looks stronger on a compact button than on a large panel.
Set each corner with shorthand
Four values follow the corners clockwise, starting at the top left:
border-radius: 24px 8px 24px 8px;
Order: top left, top right, bottom right, bottom left
Two values alternate diagonal corners. Three values set the top left, both opposing corners, and the bottom right. Using four explicit values is often easiest to review when every corner matters.
| Declaration | Meaning |
|---|---|
12px | All four corners |
12px 4px | Top-left and bottom-right; top-right and bottom-left |
12px 8px 4px | Top-left; opposing pair; bottom-right |
12px 10px 8px 6px | Each corner clockwise |
Pixels and percentages behave differently
Pixel radii are fixed CSS lengths. Percentage radii are calculated against the element’s dimensions. border-radius: 50% produces a circle only when the box is square; on a rectangle it produces an ellipse.
For a pill-shaped control, a very large fixed radius such as 9999px is common. The browser limits overlapping radii so they fit the box. This makes the ends fully rounded without requiring the element’s exact height.
Generate and test the declaration
- Choose pixels for fixed curves or percentages for shape-relative curves.
- Set the top-left, top-right, bottom-right, and bottom-left values.
- Preview the result on a box with proportions similar to your real element.
- Copy the declaration into the target CSS rule.
- Test at responsive sizes, especially if the element changes shape.
Border radius clips the background, but child content may still overflow unless the layout also uses an appropriate overflow value. Focus outlines should remain visible and should not be replaced with border radius alone.
Use the ToolPixels generator
The free CSS Border Radius Generator lets you set all four corners in pixels or percentages and preview the shape before copying the CSS.