Rounded corners are so common that it is easy to forget there is a whole geometry system behind them. The same property that softens a button can turn a square photo into a circle, make a pill-shaped tag, shape a chat bubble with one sharp corner, or produce an organic blob for a hero illustration without a single SVG file.
This guide explains how border-radius works, why 50% and 999px give different results, what the mysterious slash in some values means, and how to design shapes visually and copy the CSS. It also covers the rendering quirks that catch people out.
What border-radius actually does
Each corner of an element is replaced by a quarter of an ellipse. The radius values set how big that ellipse is:
.card { border-radius: 16px; }
That gives every corner a circular arc with a 16-pixel radius. Backgrounds, borders, shadows and images inside the element (with overflow: hidden) all follow the curve.
Shorthand order
Like margin, the shorthand accepts one to four values, starting at the top left and going clockwise:
border-radius: 24px; /* all corners */
border-radius: 24px 0; /* top-left & bottom-right, then the other two */
border-radius: 24px 24px 24px 0; /* speech bubble: sharp bottom-left */
The longhand properties are border-top-left-radius, border-top-right-radius, border-bottom-right-radius and border-bottom-left-radius.
Pixels versus percentages
A pixel radius is the same on every element. A percentage is relative to the element's size: horizontal radii use the width, vertical radii use the height.
border-radius: 50%on a square makes a circle.border-radius: 50%on a rectangle makes an ellipse, not a pill.- For a pill shape, use a very large pixel value, such as
999px. The browser scales overlapping radii down until they fit, which leaves perfectly semicircular ends at any width.
The slash: elliptical corners
Each corner can have separate horizontal and vertical radii. In the shorthand, horizontal values come before a slash and vertical values after it:
border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%;
Mixing different horizontal and vertical percentages on each corner is how CSS "blob" shapes are made.
Design corners visually
Picturing eight separate radii in your head is hard. The Border Radius Generator shows the shape live as you adjust it.
- Open the Border Radius Generator.
- Choose the unit with the px or % buttons. Switching unit keeps the current numbers where they fit, capping them at 50% or 200px, so re-check the shape afterwards.
- Click Link all corners if you want one slider to control every corner; the button then reads All corners linked. Click again to edit Top left, Top right, Bottom right and Bottom left separately.
- For blobs and eggs, switch on Advanced: elliptical corners (separate horizontal and vertical radius). Each corner then gets Horizontal and Vertical sliders.
- Try the Presets: Rounded, Pill, Circle, Leaf, Speech, Blob, Egg and Tab.
- In Live preview, set the Preview colour, Width and Height. Changing the size is the best way to see how percentage radii stretch compared with pixel radii.
- Copy the result from CSS code. When all four corners are equal, the shorthand collapses to a single value. Reset returns to the Rounded preset.
Other ways to round corners
Utility frameworks
Tailwind classes such as rounded-lg, rounded-full and rounded-tl-none cover everyday cases and keep radii consistent across a project. For unusual shapes you still need arbitrary values, which is where a generator helps.
Design tools
Figma and similar tools let you set per-corner radii, and some offer "corner smoothing" for the squircle look used by app icons. Note that smoothing is not the same as border-radius, so exported CSS will look slightly different.
SVG and clip-path
For shapes that border-radius cannot draw, such as stars, arrows or true squircles, use clip-path or an SVG. The clip-path generator handles polygon shapes. Keep in mind that clip-path also clips shadows, whereas border-radius does not.
Tips and pitfalls
Images inside rounded containers
A rounded card does not automatically round the image inside it. Either put border-radius on the image as well, or add overflow: hidden to the container.
Nested corners
When a rounded element sits inside another with padding, matching corners look best if the inner radius equals the outer radius minus the padding. An outer card at 24px with 8px padding looks right with a 16px inner radius.
Borders change the curve
The inner edge of a thick border has a smaller radius than the outer edge. Very large borders on small radii can end up with square inner corners; that is expected behaviour.
Radii that are too large get scaled
If the radii on one side add up to more than the side's length, the browser reduces all radii proportionally. This is what makes the 999px pill trick work, but it can also flatten a carefully tuned blob when the element becomes narrow. Test shapes at the sizes they will actually appear.
Email clients
Many email clients support border-radius, but some desktop email programs ignore it and show square corners. Design email buttons so they still look acceptable when square.
Finishing touches
Rounded shapes are often combined with a soft shadow from the box shadow generator and a background from the CSS gradient generator. For round profile photos made as image files rather than CSS, see how to make a round profile picture.
Frequently asked questions
How do I make a perfect circle in CSS?
Give the element equal width and height and set border-radius: 50%. If the width and height differ, you will get an ellipse instead.
Why does 50% not make a pill shape?
Percentages are relative to each dimension, so on a wide rectangle 50% creates elliptical corners that meet in the middle. Use a large pixel value like 999px for semicircular ends.
What does the slash in border-radius mean?
Values before the slash are horizontal radii and values after it are vertical radii, which lets each corner be elliptical rather than circular.
Can I round only one corner?
Yes. Use the longhand, such as border-top-left-radius: 16px, or the four-value shorthand with zeros for the other corners.
Does border-radius affect click areas?
The element still occupies its full rectangle in the layout, so neighbouring elements are positioned as if the corners were square. Make sure small rounded buttons still have a comfortably large tap area.