Border-radius generator
Builds a ready border-radius line for all four corners in pixels or percent. Shows when you get a pill and when the browser shrinks the radii itself.
Input
The clockwise order starts here.
Report a problem
How to read border-radius
Four numbers, clockwise
border-radius: 12px 0 24px 8px means the top left, top right, bottom right and bottom left corners. The order is fixed and starts at the top left. If all four are equal, write one number.
Two numbers and three numbers
Shorthands work too. Two numbers mean "top left with bottom right" and "top right with bottom left". Three mean top left, then the diagonal pair, then bottom right. In practice one number or all four is easier to read.
Percent is not the same as pixels
Percent is measured separately across and down. So 50% on a square gives a circle, but on a 320 × 200 rectangle it gives an ellipse: 160 pixels across, 100 down. Pixels don't do this – they are the same both ways.
When the browser shrinks the radii itself
If two radii on one side are longer than the side together, the browser works out a factor and shrinks all four corners by it, not just one. That's why a card with radius 200 at height 200 looks different from what you expected: the shape stays in proportion, but the numbers are no longer the ones you wrote.
Pill
Once the radius reaches half of the shorter side, the corner becomes a half circle and stops changing. Hence the usual border-radius: 999px trick for a pill button: any number that is too large gives the same result.
Common questions about rounded corners
How do I make a round avatar?
A square element and border-radius: 50%. A non-square one gives an ellipse – make the sides equal first or add aspect-ratio: 1.
Why is the rounding not visible on the image inside?
A child does not inherit the parent's shape. Either give the image its own radius or add overflow: hidden to the parent.
999px or 50% for a button?
999px. Percent on a wide button makes the corners elliptical and the shape drifts; the browser trims a pixel radius that is too large down to a half circle.
Can the radius differ across and down?
Yes, with a slash: border-radius: 40px / 20px – the first value is across, the second down. This page builds the simple form without a slash.
Rounding with a border and a shadow
Both follow the shape automatically: the border runs along the rounded edge, and so does the shadow. Nothing needs to be synced.