CSS Border-Radius Generator
Visually generate CSS `border-radius` by adjusting each corner, with an advanced 8-direction mode for blob shapes.
The four values before the slash determine the horizontal radius of each corner, and the four values after the slash determine the vertical radius (in %). Giving different values for horizontal and vertical radii will result in elliptical corners, creating an organic blob shape.
What is the CSS Border-Radius Generator?
The CSS `border-radius` property can do more than just round corners. With its lesser-known slash syntax, it can define up to eight values to create complex, organic blob shapes without using images. This generator makes that power accessible. Use "◻ Basic (4 corners)" mode to quickly round corners, or switch to "🫧 Advanced (8 directions)" to fine-tune the horizontal and vertical radii of each corner independently. Instantly see your changes in the preview, or hit "🎲 Random Blob" to generate unique shapes for your next landing page.
How to use
- In "◻ Basic (4 corners)" mode, adjust the sliders for each corner. Check "Adjust all four corners together" to sync them, and pick `px` or `%` from the "Unit" dropdown.
- Click a chip in the "Presets" section like 'Pill' or 'Speech bubble (left tail)' to instantly apply a common shape.
- For more control, switch to "🫧 Advanced (8 directions)" to set the horizontal and vertical radius for each corner independently, creating elliptical curves.
- Click the "🎲 Random Blob" button to generate a unique blob. Click it repeatedly until you find a shape you like.
- The final CSS appears in the "CSS Code" box. Click "Copy" to use it in your project.
CSS Border-Radius Generator guide
How this tool is used in real work, and what to watch out for.
For nested rounded corners, the inner radius must be smaller
Have you ever placed a rounded button or image inside a rounded card and felt something was off? It's usually because you've used the same border-radius for both the inner and outer elements.
For two curves to flow parallel to each other, the difference between the outer and inner radii must equal the space between them. If this relationship is broken, the gap between the two curves will widen or narrow at the corners, creating a visual disconnect.
- If the padding is greater than the outer radius, the inner radius should be 0 (a sharp corner). There's no such thing as a negative radius.
- If the padding is 0, the inner radius should be the same as the outer one. This is the case when an image completely fills a card.
- Following this rule might seem like a minor detail, but it makes your design look significantly more polished. Most well-crafted design systems adhere to it.
/* Inner radius = Outer radius - padding */
.card {
border-radius: 16px;
padding: 8px;
}
.card > img {
border-radius: 8px; /* 16 - 8 = 8 */
}
/* Lock in the relationship with CSS variables to avoid errors. */
.card {
--r: 16px;
--pad: 8px;
border-radius: var(--r);
padding: var(--pad);
}
.card > img {
border-radius: calc(var(--r) - var(--pad));
}
Create pill shapes with a large pixel value, like 999px
When creating a pill shape—a rectangle with fully rounded ends—you shouldn't use `50%`. The percentage unit is relative to the element's width and height. On a long button, a 50% radius will result in stretched, elliptical ends, not perfect semicircles.
The solution is almost laughably simple: use a pixel value that is guaranteed to be larger than half the element's height. The browser will automatically cap the radius to create a perfect semicircle. That's why using a large value like `999px` ensures a perfect pill shape, regardless of the button's height.
| Desired Shape | Value | Notes |
|---|---|---|
| Pill (for long buttons) | 999px | 9999px or 100vmax also work. |
| Circle (for avatars, icons) | 50% | Only when width = height. Otherwise, it becomes an ellipse. |
| Dynamic-sized circle | 50% + aspect-ratio: 1 | Remains a circle even as size changes with content. |
| Rounded rectangle | 8–16px | A good default for cards and modals. |
The slash (/) syntax: What the eight values mean
The `border-radius` property can accept up to eight values. The four values before the slash define the horizontal radius of each corner, and the four values after the slash define the vertical radius. When the horizontal and vertical radii for a corner differ, the corner becomes elliptical rather than circular.
The order is clockwise: top-left → top-right → bottom-right → bottom-left. This is easy to confuse with other four-value CSS properties like `margin`, which start at the top (top → right → bottom → left), not the top-left.
/* If all four values are the same, you can shorten it to one */
border-radius: 16px;
/* Different values per corner (clockwise: top-left, top-right, bottom-right, bottom-left) */
border-radius: 18px 18px 18px 2px; /* Sharper bottom-left corner = speech bubble tail */
/* The slash syntax: first 4 are horizontal radii, last 4 are vertical */
border-radius: 60% 40% 30% 70% / 30% 60% 70% 40%;
What are blobs used for?
Organic, fluid shapes (or "blobs") became a major trend on landing pages around 2020 and are still common today. Their main appeal is that they can be created with a single line of CSS, no SVG or images required.
However, you should avoid using blobs as content containers. The extreme corner rounding can cause text to be clipped or create awkward internal spacing. In practice, blobs are almost always used for background decoration.
- Color splotches in a hero section background. Fill one with a gradient, apply a heavy blur filter, and place it behind other content for a modern SaaS landing page feel.
- A mask for a profile picture. Applying a blob-like radius to a square photo can create a softer, more approachable look.
- A background accent behind an icon to make it stand out from a plain background.
- A decorative element to separate sections, often by placing a large blob partially off-screen.
/* Hero background decoration — place behind and blur */
.blob {
position: absolute;
width: 420px; height: 420px;
border-radius: 60% 40% 30% 70% / 30% 60% 70% 40%;
background: linear-gradient(135deg, #667eea, #764ba2);
filter: blur(60px);
opacity: .35;
z-index: -1;
pointer-events: none;
}
When border-radius gets ignored or clipped
- A child element overflows a parent with default overflow. Even if you set a radius on the parent, a child image will stick out of the corners. You must also add `overflow: hidden` to the parent.
- On `table` elements. `border-radius` has no effect on tables with `border-collapse: collapse`. Change it to `separate` or apply the radius to a wrapping `div` instead.
- The radius is larger than the element's size. The browser automatically scales it down proportionally. This is not an error but defined behavior, and it's the principle that makes the `999px` pill-shape trick work.
- Default `input` and `button` styles. Safari on iOS forcibly applies its own default radius. You need to add `-webkit-appearance: none` for your own styles to apply.
- When used with a shadow. `box-shadow` follows `border-radius` automatically, so no extra work is needed. However, if you create a shadow using a pseudo-element (::after), don't forget to add `border-radius: inherit`.
Frequently asked questions
When should I use px vs % units?
Use `px` for fixed-size elements like buttons. Use `%` for responsive shapes that scale with element size. `50%` on a rectangle creates an ellipse—the basis for blob shapes.
What does the slash (/) in the CSS value mean?
The values before the slash (`/`) define the horizontal radii for the four corners; the values after define the vertical radii. This creates elliptical, organic shapes.
Why does my 50% radius look like an ellipse?
`border-radius: 50%` only creates a perfect circle on a perfect square. On a rectangle, it creates an ellipse. For a circle, ensure width and height are equal.
What are CSS blob shapes used for?
They're often used as decorative background elements, profile picture masks, or unique section dividers. They are lightweight, using only CSS and no image files.