Rounded corners are the default look of the modern web, and their values cause a quiet confusion. One designer writes border-radius: 12px, another writes border-radius: 50%, and the two behave nothing alike: the first stays the same on a thumbnail and on a banner, the second grows and shrinks with the element. Until that difference clicks, radius values feel like guesswork.
One fact deserves stating plainly: the free Border Radius Generator on Ovatly works in percentages only. Each corner has its own slider, every value is a percentage of the element's own size, and the declaration contains no pixel values at all. This guide explains both units.
Contents
- Quick answer
- Two units, two different behaviors
- What a percentage actually measures
- Why the generator sticks to percentages
- Fancy mode: two radii per corner
- The pill shape is the 50% rule at its limit
- How to build a radius, step by step
- Worked example: a blob and a circle
- Limitations and honest tradeoffs
- Common mistakes
- FAQs
- Conclusion
- References
Quick answer
Use pixels when the corner must stay a fixed size regardless of the element, and percentages when the corner should scale with the element. A percentage measures the element itself: horizontal radius as a share of the width, vertical as a share of the height. The Border Radius Generator works entirely in percentages, with a Fancy mode for elliptical corners. If you need pixels, copy the declaration and replace the percentage with px as a starting point. The pill appears when the radius reaches half the element's height: 50% on the short axis.
Two units, two different behaviors
A pixel radius is an absolute measurement. border-radius: 12px rounds a corner by the same 12 pixels on a 40 pixel chip and on a 1200 pixel banner: a generous curve on the first, barely a softening on the second.
A percentage radius is relative. border-radius: 12% asks how big the element is first, then takes its share. Double the element and the corner doubles with it. Percentages therefore suit responsive layouts and elements shown at several sizes, while pixels suit fixed details, such as a small badge corner that must look identical everywhere.
What a percentage actually measures
A corner radius is really two radii: horizontal and vertical. With a single percentage value, CSS takes the horizontal radius from the element's width and the vertical radius from its height. On a square, width and height are equal, so the corner is a neat quarter circle. On a wide, short button, the same percentage makes a corner that is wide and flat, because 20% of a long width far exceeds 20% of a short height.
This is why 50% is such a useful landmark. At 50%, the horizontal radius is half the width and the vertical radius half the height, so neighbouring curves meet in the middle of each edge. On a square, every corner at 50% gives a circle. On a rectangle, it gives fully rounded ends: the pill shape covered below.
Why the generator sticks to percentages
The Border Radius Generator gives each of the four corners its own slider, so corners can match or differ on purpose, and every slider works in percentages of the element's own size. Design once, and the same declaration behaves sensibly at any size, the common case for cards and buttons.
The tool's own answer to the pixel question is a bridge, not a conversion feature: take the declaration, replace a percentage with the same number in px, and adjust. border-radius: 20% becomes border-radius: 20px as a first draft. The number will rarely be final, because the units differ, but it lands in the right neighbourhood.
Fancy mode: two radii per corner
Ordinary corners are circular: one radius, the same horizontally and vertically. Fancy mode splits each corner into a horizontal and a vertical radius, and the declaration writes them in two groups separated by a slash: horizontal values first, then vertical ones. Unequal radii make elliptical corners, and elliptical corners build organic, hand-drawn shapes.
The corner order never changes: top left, top right, bottom right, bottom left, in each group. A long declaration is just four corners described twice, once per axis.
The pill shape is the 50% rule at its limit
A pill is a rectangle whose short ends are complete semicircles. That happens when the vertical radius equals half the element's height: the curves from the top and bottom corners meet in the middle of the short edge, leaving no straight segment.
In percentage terms, half the height is a vertical radius of 50%, so a wide, short element with every corner at 50% becomes a pill. There is no pill preset in the generator, and none is needed: the pill is just the 50% rule applied to an element much wider than it is tall. The same 50% on a square gives a circle instead: the element's proportions decide the result.
How to build a radius, step by step
- Open the Border Radius Generator: a preview element with one slider per corner.
- Decide the job: a shared radius, different corners for a shaped element, or Fancy mode for elliptical corners.
- Move the sliders and watch the preview, thinking in shares of the element rather than fixed sizes.
- For a circle, set every corner to 50% and use the declaration on a square element. For a pill, set 50% on a wide, short element.
- Copy the single
border-radiusdeclaration into your CSS. If the design calls for pixels, swap the percentage for px and adjust by eye.
Worked example: a blob and a circle
Turn on Fancy mode and enter these values, in corner order: horizontal 30, 70, 70, 30; vertical 30, 30, 70, 70. The generator produces:
border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%;
On a square element, those lopsided elliptical corners produce an organic blob. No corner matches its neighbour, which is exactly the point.
Now turn Fancy mode off and set all four sliders to 50%. The declaration reads 50% for every corner, and on a square element the result is a perfect circle.
Limitations and honest tradeoffs
The generator emits percentages only. If your design system is specified in pixels, the replace-with-px bridge gets you a starting value, but the final tuning happens in your own CSS.
Percentages tie the corner to the element's proportions: a feature on responsive layouts, a surprise when the aspect ratio changes. The same declaration gives a round corner on a square card and a flat, wide corner on a banner. Where proportions vary wildly, a fixed pixel radius may be the better choice.
Finally, the declaration is all you get: one line of CSS. Applying it remains your stylesheet's job.
Common mistakes
- Expecting a percentage to stay put. A 20% corner grows with its element. If the corner must not change, use pixels.
- Reading the values in the wrong order. The order is top left, top right, bottom right, bottom left. Misread it and rounding lands on the wrong corners.
- Hunting for a pill preset. There is none. Set every corner to 50% on a wide, short element and the pill appears.
- Using 50% on a rectangle and expecting a circle. On a rectangle, 50% makes an ellipse or a pill, never a circle.
- Typing pixel values into a percentage tool. The sliders are percentages. Judge the preview by proportion, not fixed size.
FAQs
Does the Border Radius Generator output pixel values? No. It works in percentages of the element's own size and outputs a single border-radius declaration in percentages. If you need pixels, replace the percentage with a px value as a starting point and adjust.
What does a border-radius percentage refer to? The horizontal radius is a percentage of the element's width and the vertical radius is a percentage of its height. On a square the two match, which is why 50% on every corner of a square gives a perfect circle.
How do I make a pill shape? Push the radius to half of the element's height. In percentage terms that is 50% on the short axis, so a wide, short element with every corner at 50% gets fully rounded ends: a pill. There is no pill preset; the shape falls out of the 50% rule.
What is Fancy mode for? Fancy mode gives each corner separate horizontal and vertical radii, written with slash syntax. It produces elliptical corners and organic shapes such as blobs, instead of circular corners.
Is anything uploaded when I use the generator? No. The generator runs entirely in your browser and produces one CSS declaration to copy; nothing about your design leaves your device.
Conclusion
Radius values stop being guesswork once the units are clear: pixels are fixed, percentages are a share of the element, and the circle and pill are the 50% rule meeting different proportions. The Border Radius Generator keeps you in percentages, and the px swap covers fixed values when genuinely needed. When a design calls for rounding on only part of an element, our guide to rounding only two corners of an element covers the per-corner technique. For more guides in this series, see our Website and Webmaster Tools guides.
References
- MDN Web Docs, on the border-radius property and how percentages resolve: https://developer.mozilla.org/en-US/docs/Web/CSS/border-radius
- W3C CSS Backgrounds and Borders Module, on corner rounding: https://www.w3.org/TR/css-backgrounds-3/#border-radius