The border-radius property creates rounded corners on elements. It is one of the most common CSS properties for modern UI design — from soft card corners to circles and pill-shaped buttons.
01
Rounded Corners
Soften sharp edges.
02
Length Values
px, em, rem units.
03
Percentage
Relative to element size.
04
Shorthand
1 to 4 corner values.
05
Circles & Pills
50% and 999px tricks.
06
Default 0
Square corners by default.
Fundamentals
Definition and Usage
The border-radius CSS property is used to create rounded corners on elements. It defines how much rounding you want on each corner, which can be applied to all corners uniformly or individually. Rounded corners add a softer, more modern look to your design.
You can use border-radius on boxes, buttons, images, cards, avatars, and any block-level or inline-block element. Combined with background colors and borders, it is one of the easiest ways to improve visual polish.
💡
Beginner Tip
Start with one value like border-radius: 8px; to round all four corners equally. Increase the value for more rounding, or use 50% on a square element to make a circle.
Foundation
📝 Syntax
The syntax for border-radius is simple and flexible. You can specify one, two, three, or four values to define the rounding of the corners.
Two values — The first value applies to the top-left and bottom-right corners, and the second value applies to the top-right and bottom-left corners.
Three values — The first value applies to the top-left corner, the second to the top-right and bottom-left corners, and the third to the bottom-right corner.
Four values — Each value applies to a different corner in the order: top-left, top-right, bottom-right, and bottom-left.
Values can be lengths like px, em, or rem, or percentages relative to the element’s size.
Cheat Sheet
⚡ Quick Reference
Question
Answer
Initial value
0
Applies to
All four corners of an element’s border box
Inherited
No
Animatable
Yes, as a length or percentage
Common use
Cards, buttons, avatars, images, and UI containers
Defaults
Default Value
The default value of border-radius is 0, which means the element has sharp, right-angled corners with no rounding.
Reference
💎 Property Values
The border-radius property accepts length values, percentages, and shorthand combinations of one to four values.
Value
Description
<length>
A specific radius using units like 10px, 5em, or 1rem
<percentage>
A radius relative to the element’s size, such as 50% for circles
Shorthand (1–4 values)
Control all corners or individual corners with one declaration
initial
Sets the property to its default value (0)
inherit
Inherits the property value from its parent element
0 (default)
8px
15px
50%
999px (pill)
12px 0 12px 0
Scope
Corner Shorthand: 1, 2, 3, and 4 Values
border-radius follows the same corner order as margin and padding shorthand. The diagrams below show which corner each value affects.
1 value — border-radius: 12px;
TL: 12pxTR: 12pxBL: 12pxBR: 12px
2 values — border-radius: 12px 24px;
TL: 12pxTR: 24pxBL: 24pxBR: 12px
3 values — border-radius: 12px 24px 8px;
TL: 12pxTR: 24pxBL: 24pxBR: 8px
4 values — border-radius: 12px 24px 8px 4px;
TL: 12pxTR: 24pxBL: 4pxBR: 8px
Compare
border-radius vs Corner Longhands
Property
Targets
Best for
border-radius
All four corners with 1–4 shorthand values
Cards, buttons, and uniform rounding
border-top-left-radius
Top-left corner only
Asymmetric designs with one custom corner
border-top-right-radius
Top-right corner only
Tab shapes and directional accents
border-bottom-right-radius
Bottom-right corner only
Speech bubbles and notch effects
border-bottom-left-radius
Bottom-left corner only
Custom card corners and layered UI
Preview
👀 Live Preview
A box with 15px rounded corners, matching the reference example:
Uses width: 200px;, height: 100px;, background: lightblue;, and border-radius: 15px;.
Hands-On
Examples Gallery
Try border-radius with rounded boxes, circles, pill buttons, and four-corner shorthand values.
📚 Basic Rounded Corners
Apply a single radius value to soften all four corners of a box.
Example 1 — 15px Rounded Box
Create a box with rounded corners using border-radius: 15px;, matching the reference tutorial.
Each corner radius becomes half the element’s width and height. On a square, the curves meet to form a circle — a common pattern for avatars and icon buttons.
🎨 Pills and Asymmetric Corners
Use large radius values for pill shapes, or four values for custom corner styling.
Example 3 — Pill Button
Use a very large radius like 999px to create a fully rounded pill-shaped button.
The four values map to top-left, top-right, bottom-right, and bottom-left. Here, 12px 0 12px 0 rounds opposite diagonal corners for an asymmetric look.
🧠 How border-radius Works
1
You set a radius value
Choose a length like 15px, a percentage like 50%, or a 1–4 value shorthand.
Radius rule
2
The browser curves each corner
Each corner gets an elliptical arc based on the radius. Larger values create more rounding.
Corner arcs
3
Background and border follow the curve
The element’s background, border, and clipped content all respect the rounded shape.
Rendering
=
◯
Rounded element
Your box, button, or image displays with smooth corners — from subtle rounding to full circles and pills.
Compatibility
Universal Browser Support
The border-radius property is supported in all modern browsers, including Chrome, Firefox, Safari, Edge, and Opera. It is a widely supported feature you can use safely in web projects.
✓ Baseline · Modern browsers
Reliable rounded corners on every platform
Chrome, Firefox, Safari, Edge, and Opera all support border-radius consistently in current versions.
99%Modern browser support
Google Chrome4+ · Desktop & Mobile
Full support
Mozilla Firefox4+ · Desktop & Mobile
Full support
Apple Safari5+ · macOS & iOS
Full support
Microsoft Edge12+ · All versions
Full support
Opera10.5+ · Modern versions
Full support
border-radius property99% supported
Bottom line: Use border-radius freely in any project. It works consistently across all modern browsers.
Wrap Up
Conclusion
The border-radius property is an essential tool in modern web design, enabling developers to create visually appealing elements with rounded corners. Whether you’re designing buttons, images, cards, or entire sections, rounded corners soften the look of your interface and make your design more inviting.
Experiment with different values and combinations — from a subtle 8px on cards to 50% circles and 999px pill buttons — to see how this property can enhance the aesthetics of your web pages.
Use consistent radius values across your design system (e.g. 4px, 8px, 12px)
Use 50% on square elements for circles and avatars
Use large values like 999px for pill-shaped buttons and tags
Store radius tokens in CSS variables for reusable theming
Combine with overflow: hidden when clipping images to rounded containers
❌ Don’t
Use extreme radius values on large containers without testing the visual result
Expect 50% to make a circle on non-square elements (it creates an ellipse)
Forget that percentage radii are relative to the element’s own dimensions
Overuse many different radius sizes in one interface
Ignore how rounded corners interact with box shadows and borders
Summary
Key Takeaways
Knowledge Unlocked
Five things to remember about border-radius
Use these points when rounding corners in your layouts.
5
Core concepts
◯01
Rounded Corners
Softens element edges.
Purpose
⚙️02
Default 0
Square corners by default.
Default
📏03
Length & %
px, em, rem, or 50%.
Values
📝04
1–4 Shorthand
Control each corner.
Syntax
🔴05
Circles & Pills
50% and 999px patterns.
Patterns
❓ Frequently Asked Questions
The border-radius property rounds the corners of an element by setting the radius of the border curve. It creates softer, more modern shapes instead of sharp right-angled corners.
The initial value is 0, which means corners are square with no rounding.
When an element has equal width and height, border-radius: 50% makes each corner curve into a perfect circle because the radius is half of the element's size.
One value rounds all four corners. Two values set top-left/bottom-right and top-right/bottom-left. Three values set top-left, top-right/bottom-left, and bottom-right. Four values set each corner in order: top-left, top-right, bottom-right, bottom-left.
border-radius is a shorthand that sets all four corners at once. Corner longhands like border-top-left-radius let you target one corner individually for finer control.