Border Radius Cheatsheet: Interactive Visual Guide

October 16, 2026  |  Cheatsheet  |  CSS

By Syed · Frontend Engineer & Creator of UITweak

Rounded corners show up in almost every component, from pill buttons to avatars to cards. The shorthand is short but easy to misread, so every section below is interactive: drag the corner sliders, pick a preset, and copy the CSS.

Prefer building over reading? Open the Button Studio →

Interactive radius builder

Dragging a corner slider changes that corner's radius, and the browser rounds the element by sweeping a quarter-ellipse of the given radius along the border edge. Percentage values resolve against the border box dimensions, so the same 50% traces a different curve on a square than on a rectangle. Because the radius is a paint-level property, each slider movement triggers a repaint of the element rather than a full layout pass.

preview
.box {
  border-radius: 24px 24px 24px 24px;
}

border-radius syntax order

The four values map to corners clockwise starting at the top-left: top-left, top-right, bottom-right, bottom-left. With fewer than four values the pattern folds the same way margin and padding shorthand do, so border-radius: 24px 8px puts 24px on the top-left and bottom-right and 8px on the other pair. The longhands such as border-top-left-radius exist for overriding a single corner without restating the whole shorthand.

Click each slot to see what it does:

4 values

Four values go clockwise from the top-left: top-left, top-right, bottom-right, bottom-left. This is how you build asymmetric shapes like the leaf preset above.

1 value

16px

2 values

24px 8px

4 values

24px 4px 24px 4px

slash

32px / 12px

/* clockwise from top-left */
border-radius: 12px;              /* all four */
border-radius: 12px 4px;          /* tl+br, tr+bl */
border-radius: 12px 4px 8px;      /* tl, tr+bl, br */
border-radius: 12px 4px 8px 2px;  /* tl, tr, br, bl */

/* elliptical corners: horizontal / vertical */
border-radius: 24px / 12px;

/* one corner only */
border-top-left-radius: 16px;

Tailwind rounded utilities

Utilities like rounded, rounded-lg, and rounded-full compile down to plain border-radius declarations, so there is no rendering difference between the utility and the equivalent hand-written CSS value. rounded-full is 9999px, which is exactly why it produces a pill on rectangles instead of a true circle. The scale moves in fixed steps, so any value between two steps still needs an arbitrary value or custom CSS.

rounded-none

0px

rounded-sm

0.125rem (2px)

rounded

0.25rem (4px)

rounded-md

0.375rem (6px)

rounded-lg

0.5rem (8px)

rounded-xl

0.75rem (12px)

rounded-2xl

1rem (16px)

rounded-3xl

1.5rem (24px)

rounded-full

9999px

Corner-specific utilities follow the same scale: rounded-t-lg rounds the top two corners, rounded-tl-full rounds only the top-left. For any other value, use an arbitrary value like rounded-[10px].

<div class="rounded-2xl">card</div>
<div class="rounded-full">pill or circle</div>
<div class="rounded-t-xl">top corners only</div>
<div class="rounded-[10px]">custom value</div>

Common recipes

Every recipe on the page is a composition of the same four corner longhands, which means each pill, card, and avatar is just one particular arrangement of corner radii. That keeps the mental model small: once you understand per-corner control, the slash syntax, and the clipping rule, you can reconstruct any recipe instead of memorizing it. Treat this section as a pattern library rather than a list of one-off tricks.

1. Pill button

2. Circle avatar

A

3. Card with image-style top

Card title

rounded-2xl, image clipped by overflow-hidden

4. Squircle-ish (large radius)

True squircles need more than border-radius, but a radius around 30 to 40 percent of the size gets you close for icons and tiles.

<!-- pill button -->
<button class="rounded-full bg-indigo-600 px-6 py-2.5">
  Get started
</button>

<!-- circle avatar -->
<div class="w-16 h-16 rounded-full">A</div>

<!-- card -->
<div class="rounded-2xl overflow-hidden">...</div>

/* squircle-ish */
.icon { border-radius: 32px; }

Demo Deepening

Common Production Bugs & Fixes

Bug: `border-radius: 50% 30%` is not the same as `border-radius: 50% / 30%`

What goes wrong: you want elliptical corners with a horizontal radius of 50% and a vertical radius of 30%, but you write the values without the slash and get an asymmetric rounded rectangle instead. Why: without the slash, both values are horizontal radii mapped onto corners, so 50% lands on the top-left and bottom-right while 30% lands on the other pair. The slash separates the horizontal set from the vertical set, making 50% / 30% apply 50% of the width horizontally and 30% of the height vertically to every corner. The fix is to keep the slash whenever you mean horizontal versus vertical.

/* wrong: asymmetric corners, no vertical control */
.card { border-radius: 50% 30%; }

/* right: elliptical corners, 50% horizontal / 30% vertical */
.card { border-radius: 50% / 30%; }

Bug: rounded card, square child image corners

What goes wrong: you set border-radius: 24px on a card, but the image inside still sticks out with square corners. Why: border-radius rounds the element's own border and background; it does not clip descendant content, which paints inside the padding box. The fix is to clip at the rounded boundary, most commonly with overflow: hidden, or with overflow: clip when you want clipping without creating a scroll container.

.card {
  border-radius: 24px;
  overflow: hidden; /* or overflow: clip */
}
.card img {
  display: block;
  width: 100%;
}

Bug: `border-radius: 50%` draws an ellipse, not a circle

What goes wrong: you apply 50% to a rectangular badge expecting a circle and get an ellipse that touches all four edges. Why: percentages resolve per axis, so 50% of the width horizontally and 50% of the height vertically traces an ellipse on any non-square box. If you want a stadium-shaped pill on a rectangle, use a very large length such as 9999px; the spec clamps each radius to half the side, so it degrades into a perfect pill. Reserve 50% for boxes that are actually square.

/* ellipse on a non-square box */
.badge { border-radius: 50%; }

/* pill on a rectangle of any width */
.pill {
  border-radius: 9999px;
  padding: 0.5rem 1.5rem;
}

Bug: a huge radius on a tiny element silently shrinks

What goes wrong: you set border-radius: 24px on a 20px-tall chip and the corners render like a plain small rounding, with no warning in DevTools. Why: the CSS backgrounds spec requires that when the summed radii along one side exceed the side's length, the browser scales all of them down proportionally until the curve fits. Nothing is invalid, so the value is simply reduced. The fix is to size radii relative to the element, for example with em units, so the rounding tracks the element's own dimensions.

/* gets silently clamped on a 20px-tall chip */
.chip { height: 20px; border-radius: 24px; }

/* rounding that tracks the element size */
.chip { height: 20px; border-radius: 1em; }

Real-World Recipes

Recipe: circular avatar that survives any photo

Set an explicit width, then let aspect-ratio: 1 / 1 force the box to stay square no matter how the layout width changes. With a square box, border-radius: 50% traces a true circle, and object-fit: cover crops the photo to fill it instead of stretching it. Because the radius is on the image element itself, its own pixels are rounded and no clipping wrapper is needed.

.avatar {
  width: 96px;
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  object-fit: cover;
}

Recipe: pill button that never breaks

Let the padding define the button's size and let the radius define only the shape. A huge fixed radius clamps to half the button's height, so the ends are always perfect semicircles whether the label is short or long. The border follows the same curve automatically, and the button keeps its pill shape at any width without a media query.

.btn-pill {
  display: inline-block;
  padding: 0.75rem 2rem;
  border-radius: 9999px;
  border: 1px solid currentColor;
}

Recipe: leaf-corner card

Use the two-value shorthand so the top-left and bottom-right corners get the large radius while the other pair stays nearly square. The asymmetric pairing reads as a leaf or arch motif and works well for feature cards. Pair it with overflow: hidden so a top image follows the same corner pattern, and finish with a soft shadow for depth.

.card-leaf {
  border-radius: 32px 8px;
  overflow: hidden;
  background: #ffffff;
  box-shadow: 0 8px 24px rgb(0 0 0 / 0.08);
}

FAQ

Why does border-radius: 50% on my div produce an ellipse instead of a circle?

Percentages for the horizontal radius resolve against the width of the border box, and percentages for the vertical radius resolve against the height. On a 200 by 100 box, 50% means 100px horizontally and 50px vertically, which is an ellipse by definition. A circle needs equal radii on both axes, so either make the box square or use equal lengths such as border-radius: 60px.

Is overflow: hidden the only way to clip children to rounded corners?

It is the most common, but not the only one. overflow: clip performs the same clipping without establishing a scroll container, which avoids scroll-related side effects. You can also apply the radius to the child element itself, or mask the whole subtree with clip-path. In practice overflow: hidden remains the simplest choice for cards and media wrappers.

Does animating border-radius hurt performance?

Changing the radius does not trigger layout, but it forces the element to repaint on every frame of the animation, which gets expensive on large elements or when many of them animate at once. Prefer animating transform and opacity, which the browser can composite without repainting. If a radius animation is truly needed, keep the element small and the duration short.

What happens when the radii of two adjacent corners overlap?

The spec's corner-overlap rule scales them down together. If the top-left and top-right radii combined are wider than the box, the browser reduces both proportionally until they fit exactly, preserving their ratio. This is why very large radii on small elements never break the layout; they just shrink while keeping their relative proportions.

Share this guide