Border Radius Preview
Generated CSS

CSS Border Radius Generator

The border-radius property rounds the corners of an HTML element's border box. It is one of the most widely used CSS properties — from subtle 4px card corners to full pill buttons and organic blob shapes. This generator lets you visually control all four corners, switch between px and % units, and build elliptical shapes using the advanced / syntax. Copy the result as clean, production-ready CSS instantly.

Whether you are building a design system, styling a button, or creating a unique UI shape, this tool removes the guesswork and shows you the result in real time across different element shapes and background colours.

How to Use This Border Radius Generator

  1. Choose a preset — click any tile in the Presets row to instantly load common values like card (16px), pill (999px), tab corners, or an organic blob shape.
  2. Pick a mode — Uniform applies the same radius to all four corners. Individual lets you control each corner with its own slider. Elliptical uses the / syntax for oval shapes.
  3. Toggle px vs % — px gives a fixed corner independent of element size. % is relative to element dimensions and scales responsively.
  4. Switch preview shapes — test your radius on a rectangle, wide banner, or square to see how it looks across different aspect ratios.
  5. Change the background — use the colour swatches in the top-right of the preview to test against light, dark, and white backgrounds.
  6. Copy the CSS — click Copy Code to get the shorthand CSS declaration ready to paste into your stylesheet.

border-radius Syntax

The shorthand property follows the same clockwise order as margin and padding — top-left, top-right, bottom-right, bottom-left. The browser collapses the value automatically when corners match, so you rarely need to write all four.

/* One value — all four corners equal */
border-radius: 16px;

/* Two values — top-left+bottom-right / top-right+bottom-left */
border-radius: 16px 8px;

/* Three values — top-left / top-right+bottom-left / bottom-right */
border-radius: 16px 8px 4px;

/* Four values — TL TR BR BL (clockwise from top-left) */
border-radius: 8px 16px 24px 4px;

Longhand Properties

Each corner can be set individually using longhand properties. These are useful when you want to override a single corner within a component without touching the others, or when building design tokens.

border-top-left-radius: 16px;
border-top-right-radius: 16px;
border-bottom-right-radius: 0;
border-bottom-left-radius: 0;
/* Same as: border-radius: 16px 16px 0 0; (tab shape) */

Elliptical Corners with the / Syntax

A slash separates horizontal radii from vertical radii, allowing each corner to be an ellipse rather than a circle. Values before the slash set the horizontal radius of each corner; values after set the vertical radius. This unlocks a much wider range of organic shapes.

/* Perfect circle on a square element */
border-radius: 50%;

/* Ellipse — flatter horizontally */
border-radius: 50% / 25%;

/* Organic blob — all different */
border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%;

/* Pill / capsule — fully rounded ends */
border-radius: 999px;

Common Design Recipes

These are the most used border-radius patterns across UI design systems. Copy and adapt them directly.

/* Card — modern SaaS style */
.card { border-radius: 16px; }

/* Button — subtle rounding */
.btn { border-radius: 8px; }

/* Pill button */
.btn-pill { border-radius: 999px; }

/* Avatar / profile image circle */
.avatar { border-radius: 50%; }

/* Tab — rounded top only */
.tab { border-radius: 10px 10px 0 0; }

/* Badge / chip */
.badge { border-radius: 6px; }

/* Input field */
.input { border-radius: 8px; }

/* Modal dialog */
.modal { border-radius: 20px; }

Animating border-radius

border-radius is fully animatable via CSS transitions and animations. It is relatively cheap to animate because it only triggers a repaint, not a layout reflow. This makes it suitable for hover effects and morphing shapes.

/* Hover morph from card to circle */
.shape {
  width: 120px;
  height: 120px;
  border-radius: 16px;
  transition: border-radius 0.4s ease;
}
.shape:hover {
  border-radius: 50%;
}

/* Pulsing blob animation */
@keyframes blob {
  0%, 100% { border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%; }
  50%       { border-radius: 30% 60% 70% 40% / 50% 60% 30% 60%; }
}
.blob {
  animation: blob 6s ease-in-out infinite;
}

Browser Support

border-radius has been universally supported since 2011. No vendor prefixes or fallbacks are required in any modern project. The elliptical / syntax, longhand properties, and percentage values are all equally well supported.

FeatureChromeFirefoxSafariEdge
border-radius (basic)4+4+5+12+
Elliptical / syntax4+4+5+12+
Longhand properties4+4+5+12+
% values4+4+5+12+
CSS transition26+16+7+12+

Frequently Asked Questions

What is the difference between px and % for border-radius?

px gives a fixed corner size regardless of element dimensions — a 16px radius is always 16px no matter how big or small the element is. % is relative to the element's width and height — 50% on a square element always produces a perfect circle, and the radius scales automatically as the element resizes. Use px for fixed UI components like buttons and cards; use % for shapes that need to maintain a circular or elliptical form at any size.

How do I make a perfect circle with CSS?

Set border-radius: 50% on an element with equal width and height. The 50% value calculates to exactly half the element's width and height, producing a circle. Example: width: 80px; height: 80px; border-radius: 50%;. If the element is not square, the same value produces an ellipse instead.

How do I round only two corners?

Use the four-value shorthand and set the other corners to 0. To round only the top two corners (tab shape): border-radius: 12px 12px 0 0. To round only the left side (for side panels): border-radius: 12px 0 0 12px. You can also use the longhand properties individually: border-top-left-radius, border-top-right-radius, border-bottom-right-radius, border-bottom-left-radius.

What is the pill or capsule shape in CSS?

Use a very large px value such as 999px or 9999px. Browsers cap the corner radius at half the element's shortest dimension, so an excessively large value always produces fully rounded ends regardless of the element's size. This is more robust than 50% on non-square elements, where 50% produces an ellipse rather than a pill shape.

Does border-radius clip child elements?

Not automatically. border-radius clips the background and border of the element but child elements can overflow outside the rounded corners. To force children to respect the rounded shape, add overflow: hidden to the parent container. This is especially important for images inside rounded cards.

How do I create an organic blob shape with CSS?

Use the elliptical / syntax with different values for each corner. A classic blob: border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%. Combine this with a CSS @keyframes animation that morphs between different blob values for a fluid animated effect — see the Animating border-radius section above.

Can I use border-radius with border-image?

No — border-image replaces the standard border rendering, which overrides border-radius. If you need both a gradient border and rounded corners, use the outline or background gradient technique instead. Our Gradient Border Generator implements this pattern correctly.

Is border-radius affected by box-sizing?

No. border-radius applies to the outer edge of the element's border box regardless of whether you use box-sizing: content-box or box-sizing: border-box. The radius is always calculated from the border edge.

Related CSS Tools

border-radius works closely with other CSS properties. These tools on CSSTools.io help you build the complete effect:

Tool last updated: