CSS Border Radius Generator
WM-109Set one radius for all corners or a different radius for each, in pixels, percent or rem. The CSS is written in the shortest correct form and the preview uses exactly that rule.
Runs in your browser. Nothing is uploaded.
Corners
Preview and CSS
| border-radius | 24px |
|---|
CSS
.box {
border-radius: 24px;
} How to use it
- Choose All the same or Each corner, and pick a unit.
- Enter the radius, or the four corner values.
- Watch the preview box change.
- Press Copy to take the border-radius rule.
The shortest border-radius form
The border-radius shorthand takes up to four values in the order top-left, top-right, bottom-right, bottom-left. When all four match, one value is enough. When opposite corners match, two values are enough: the first is top-left and bottom-right, the second is top-right and bottom-left. Three values mean the top-right and bottom-left are equal. This tool writes the shortest form that still means the same thing.
px, percent and rem
Pixels give a fixed curve. Percent is relative to the box, so 50 percent on a square gives a circle and on a rectangle gives an ellipse. Rem scales with the root font size. A radius larger than half the side is reduced by the browser, so very large values look the same as half of the shortest side. Elliptical corners written with a slash are not covered here.
Error messages and what to do
| Message | What it means | Fix |
|---|---|---|
Radius must be between 0 and 100. | A percent radius above 100 was entered. | Use 100 or less, or switch the unit to px. |
Questions people ask
How do I make a perfect circle with CSS?
Use a square element and set the border radius to 50 percent. With px, any value of at least half the side also works, because the browser reduces an oversized radius to fit.
In which order are the four corners written?
Clockwise from the top-left: top-left, top-right, bottom-right, bottom-left. The Each corner mode here uses the same order, and the results show the shorthand built from them.
Why did my four values become two?
When the top-left equals the bottom-right and the top-right equals the bottom-left, two values mean the same thing and are shorter. The tool always writes the shortest equivalent form.
Should I use px or rem for border radius?
Use px for a fixed curve that should not change, and rem when the curve should scale with the text size setting. Percent is best for circles, pills and shapes that follow the box.
How do I round only one corner?
Choose Each corner, set that corner to your radius and the other three to 0. A zero radius is written as 0 with no unit, which is valid CSS.
Does border-radius clip the content inside?
Not by default. Backgrounds and borders follow the curve, but overflowing content such as an image is only clipped if you also set overflow: hidden on the element.
About this tool
Writes one border-radius declaration in the shortest equivalent form: one value when all corners match, two when opposite corners match, three or four otherwise. The order is top-left, top-right, bottom-right, bottom-left. Percent radii are limited to 100, rem to 60 and px to 1000. A radius larger than half the box is reduced by the browser, so very large values look the same as half the side. Elliptical corners written with a slash are not covered. The preview uses exactly the CSS shown.