# CSS Border Radius Generator

URL: https://hifreetools.com/developer/border-radius-generator

> Set the radius of each corner of a box independently in pixels or percent, watch a live preview update as you type, and copy ready-to-paste CSS that collapses to the shortest valid border-radius shorthand.

## Quick answer

To generate a CSS border-radius, enter a value for each corner (top-left, top-right, bottom-right, bottom-left) in px or %, or toggle 'Link all corners' to round them equally. The tool renders a live preview and outputs CSS like border-radius: 10px 20px 30px 40px;, automatically shortening it to fewer values when corners repeat. Everything runs locally in your browser.

CSS border-radius accepts up to four values applied clockwise from the top-left: top-left, top-right, bottom-right, bottom-left. When values repeat, the property can be written more compactly. If the bottom-left equals the top-right, the fourth value is dropped, leaving three values (top-left, top-right, bottom-right). If the bottom-right then also equals the top-left, the third value is dropped, leaving two values (top-left/bottom-right, top-right/bottom-left). If all four corners are equal, a single value is used. This tool reads your four inputs, attaches the chosen unit (px or %), then collapses the list using exactly those rules so the output is always the shortest equivalent CSS. The same string is applied to a preview box via the element's borderRadius style, so what you see is precisely what the CSS produces. Percent radii are relative to the box dimensions, which is why 50% on a square yields a perfect circle. Any negative or non-numeric corner produces a friendly message instead of broken CSS.

## Examples

- Four different corners: TL 10, TR 20, BR 30, BL 40 (px) → border-radius: 10px 20px 30px 40px;
- All corners equal: TL 12, TR 12, BR 12, BL 12 (px), or just link all to 12 → border-radius: 12px;
- Perfect circle with percent: All corners 50 (%) → border-radius: 50%;
- Diagonal symmetry collapses to two values: TL 10, TR 25, BR 10, BL 25 (px) → border-radius: 10px 25px;

## FAQ

**What order are the four border-radius values in?**
Top-left, top-right, bottom-right, bottom-left — clockwise starting from the top-left corner. So border-radius: 10px 20px 30px 40px; rounds the top-left by 10px, top-right by 20px, bottom-right by 30px, and bottom-left by 40px.

**Why does the generated CSS sometimes have fewer than four values?**
CSS lets you omit values that repeat. If the bottom-left matches the top-right it can be dropped (three values); if the bottom-right also matches the top-left, that drops too (two values); and if all corners are equal you only need one value. The tool always outputs the shortest equivalent form.

**How do I make a perfect circle?**
Set all four corners to 50% on a square element (equal width and height). Percent radii are measured against the box size, so 50% curves each side into a full circle. On a non-square box, 50% gives an ellipse instead.

**Should I use px or % for border-radius?**
Use px for a fixed, consistent corner regardless of element size — ideal for buttons and cards. Use % when you want the rounding to scale with the element, such as circles (50%); for pills, a very large px value (e.g. 9999px) works best.

**Can border-radius values be negative?**
No. The CSS spec treats negative border-radius as invalid, and browsers ignore the whole declaration. This generator ignores negative or non-numeric input and shows a prompt to enter a valid number instead.

**Does this tool send my values anywhere?**
No. The preview and CSS are computed entirely in your browser with JavaScript. Nothing is uploaded, stored, or sent to a server, so it works offline once the page has loaded.


## Sources

- [MDN Web Docs — border-radius](https://developer.mozilla.org/en-US/docs/Web/CSS/border-radius)
- [W3C CSS Backgrounds and Borders Module Level 3 — border-radius](https://www.w3.org/TR/css-backgrounds-3/#border-radius)

Runs in the browser; nothing is uploaded. Cite as: HIFreeTools, "CSS Border Radius Generator", https://hifreetools.com/developer/border-radius-generator
