Border Radius Generator
Generate CSS border-radius code with visual preview for rounded corners and organic shapes. Enter values for instant results with step-by-step formulas.
Reviewed for accuracy by Daniel Agrici, Founder & Lead Developer
Border Radius Generator
Calculator
Adjust values & calculateEnter your values below. Every result is computed in your browser โ no data is sent to any server.
Formula: border-radius: TL TR BR BL
Worked example โ CSS: border-radius: 12px; โ uniform rounded corners for a polished card look.
Formula
border-radius: TL TR BR BL
The border-radius shorthand accepts one to four values in clockwise order: top-left, top-right, bottom-right, bottom-left. When fewer values are given, they follow the same pairing rules as margin and padding.
Worked Examples
Example 1: Rounded Card Component
Problem:You need a card with 12px rounded corners on all sides for a dashboard UI component.
Solution:Set all four corner values to 12px. border-radius: 12px; This applies a uniform 12px circular arc to each corner. The shorthand uses a single value since all corners are identical. Result: A clean, modern card with consistent rounding.
Result:CSS: border-radius: 12px; โ uniform rounded corners for a polished card look.
Example 2: Organic Blob Shape
Problem:Create an organic-looking shape for a decorative background element using asymmetric border-radius values.
Solution:Use different values for each corner to break symmetry. Top-left: 30px, Top-right: 70px, Bottom-right: 70px, Bottom-left: 30px border-radius: 30px 70px 70px 30px; Diagonal corners share values for a balanced but organic feel. The shape looks natural while maintaining visual harmony.
Result:CSS: border-radius: 30px 70px 70px 30px; โ an organic blob perfect for decorative elements.
Frequently Asked Questions
What is CSS border-radius and how does it work?
CSS border-radius is a property that allows you to round the corners of an element. It accepts one to four values that correspond to the top-left, top-right, bottom-right, and bottom-left corners respectively. When a single value is provided, all four corners receive the same radius. The radius value determines the size of the circular arc used to round each corner, with larger values creating more pronounced curves. You can use pixels, percentages, em units, or rem units to specify the radius. A value of 50% on a square element creates a perfect circle, while different values on each corner can produce organic, asymmetric shapes that add visual interest to your web design.
How do I create a perfect circle with border-radius?
To create a perfect circle using CSS border-radius, you need two things: a square element (equal width and height) and a border-radius of 50% or a pixel value equal to half the width. For example, if your element is 200px by 200px, you can use border-radius: 50% or border-radius: 100px. Using 50% is preferred because it scales with the element size and works regardless of the actual dimensions. If your element is not square but rectangular, applying border-radius: 50% will produce an ellipse instead. For a pill-shaped button, you can use a very large value like border-radius: 9999px, which ensures full rounding on the shorter axis regardless of the element dimensions.
What is the difference between px and % for border-radius?
Pixel values and percentage values produce different results with border-radius, especially on rectangular elements. A pixel value creates a corner arc with a fixed radius regardless of the element size, so border-radius: 20px always creates the same curve. Percentages, however, are relative to the element dimensions, with horizontal radii calculated from the width and vertical radii from the height. On a 200x100 rectangle, border-radius: 50% creates an ellipse because 50% of 200px and 50% of 100px yield different horizontal and vertical radii. Pixel values are more predictable for design consistency, while percentages are useful for responsive designs where you want corners to scale proportionally with the element.
Can border-radius values exceed the element size?
Yes, you can set border-radius values larger than the element dimensions, but the browser will automatically clamp them to prevent overlapping corners. According to the CSS specification, when the sum of adjacent border radii exceeds the size of the border box, the browser uniformly reduces all values proportionally until they fit. This means setting border-radius: 9999px on a 200px square element effectively produces the same result as border-radius: 100px, creating a perfect circle. This clamping behavior is actually useful for creating pill-shaped buttons because you can use an arbitrarily large value and the browser handles the math, ensuring the element always looks correct regardless of its actual dimensions.
How do I create organic blob shapes with border-radius?
Organic blob shapes are created by using different border-radius values for each corner, often combined with the slash syntax for elliptical corners. The basic approach is to set four different values like border-radius: 30% 70% 70% 30%. For more complex shapes, CSS supports the eight-value syntax with a slash: border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%, where values before the slash set horizontal radii and values after set vertical radii. This creates asymmetric, organic-looking shapes popular in modern web design. Combining these shapes with CSS animations that transition between different radius values can create fluid morphing effects. Many designers use blob generators to find the perfect values for their creative projects.
What is the shorthand syntax for border-radius in CSS?
The border-radius shorthand follows a pattern similar to margin and padding. With one value, all four corners are equal. With two values, the first applies to top-left and bottom-right, while the second applies to top-right and bottom-left (diagonal pairs). With three values, the first is top-left, the second is top-right and bottom-left, and the third is bottom-right. With four values, they go clockwise: top-left, top-right, bottom-right, bottom-left. You can also use individual properties like border-top-left-radius for specific corners. The longhand properties also accept two values for elliptical corners, such as border-top-left-radius: 20px 40px, where the first value is the horizontal radius and the second is the vertical radius.
Is border-radius supported in all modern browsers?
Border-radius has excellent browser support and has been widely supported since around 2012. All modern browsers including Chrome, Firefox, Safari, Edge, and Opera fully support the property without any vendor prefixes. The older prefixed versions like -webkit-border-radius and -moz-border-radius are no longer necessary unless you need to support very old browsers like Internet Explorer 8 or earlier Android browsers. Even Internet Explorer 9 and above support the standard unprefixed property. The only minor inconsistency across browsers relates to how border-radius interacts with certain other properties like outline or complex gradients, but for standard use cases, you can rely on consistent behavior across all platforms without any compatibility concerns.
How does border-radius interact with overflow and clipping?
Border-radius creates a visual rounding effect, but by default it does not clip child content that extends beyond the rounded corners. To ensure child elements are clipped to match the rounded parent, you need to add overflow: hidden to the parent element. This is particularly important when using border-radius on containers with background images, videos, or child elements that fill the entire space. Without overflow hidden, a child with a solid background color will display sharp corners that extend beyond the parent rounded corners. This combination of border-radius and overflow hidden is extremely common in card components, image containers, and modal dialogs in modern web applications and component libraries.
Can I animate border-radius with CSS transitions?
Yes, border-radius is fully animatable with both CSS transitions and CSS keyframe animations. You can smoothly transition between different radius values by adding a transition property like transition: border-radius 0.3s ease. This works for all forms of the property including individual corner values and the shorthand. A popular effect is morphing a square into a circle on hover by transitioning from border-radius: 0 to border-radius: 50%. You can also create continuously morphing blob animations using keyframes that cycle through different asymmetric radius values. Performance-wise, animating border-radius can trigger repaints, so for complex or frequently animating elements, consider using will-change: border-radius to hint to the browser for optimization.
What are common border-radius values used in design systems?
Most modern design systems define a consistent scale of border-radius tokens. Tailwind CSS, for example, uses rounded-sm (2px), rounded (4px), rounded-md (6px), rounded-lg (8px), rounded-xl (12px), rounded-2xl (16px), rounded-3xl (24px), and rounded-full (9999px). Material Design uses 4px for small components and 8-16px for cards and dialogs. Apple Human Interface Guidelines tend to use larger radii around 10-20px for a softer feel. The general principle is that smaller components like badges and chips use smaller radii (2-4px), medium components like buttons and inputs use moderate radii (6-8px), and larger components like cards and modals use larger radii (12-24px). Consistency within a project is more important than the specific values chosen.
References
Background & Theory
History
Reviewed for accuracy by Daniel Agrici, Founder & Lead Developer ยท Editorial policy
Related Calculators
๐งฎColor Palette Generator
Generate harmonious color palettes using complementary, analogous, triadic, and split schemes.
๐งฎGradient Generator
Create CSS gradient code from color stops with linear, radial, and conic options.
๐งฎBox Shadow Generator
Generate CSS box-shadow code with visual preview for drop shadows, inset, and layered effects.
๐งฎDepth of Field Calculator
Calculate depth of field with interactive inputs and clear steps.
๐งฎHyperfocal Distance Calculator
Calculate hyperfocal distance with interactive inputs and clear steps.
๐งฎField of View Calculator (camera)
Calculate field of view (camera) with interactive inputs and clear steps.
๐งฎShutter Speed to Freeze Motion Calculator
Calculate shutter speed to stop motion with interactive inputs and clear steps.
๐งฎExposure Value (ev) Calculator
Calculate exposure value (ev) with interactive inputs and clear steps.