CSS border-radius Property

Beginner
⏱️ 5 min read
📚 Updated: Jun 2026
🎯 4 Examples
Box Model & Borders

What You’ll Learn

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.

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.

📝 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.

syntax.css
selector {
  border-radius: <length> | <percentage>;
}

Basic Example

border-radius.css
.rounded-box {
  width: 200px;
  height: 100px;
  background: lightblue;
  border-radius: 15px;
}

Syntax Rules

  • One value — Applies to all four 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.

⚡ Quick Reference

QuestionAnswer
Initial value0
Applies toAll four corners of an element’s border box
InheritedNo
AnimatableYes, as a length or percentage
Common useCards, buttons, avatars, images, and UI containers

Default Value

The default value of border-radius is 0, which means the element has sharp, right-angled corners with no rounding.

💎 Property Values

The border-radius property accepts length values, percentages, and shorthand combinations of one to four values.

ValueDescription
<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
initialSets the property to its default value (0)
inheritInherits the property value from its parent element
0 (default)
8px
15px
50%
999px (pill)
12px 0 12px 0

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;

2 values — border-radius: 12px 24px;

3 values — border-radius: 12px 24px 8px;

4 values — border-radius: 12px 24px 8px 4px;

border-radius vs Corner Longhands

PropertyTargetsBest for
border-radiusAll four corners with 1–4 shorthand valuesCards, buttons, and uniform rounding
border-top-left-radiusTop-left corner onlyAsymmetric designs with one custom corner
border-top-right-radiusTop-right corner onlyTab shapes and directional accents
border-bottom-right-radiusBottom-right corner onlySpeech bubbles and notch effects
border-bottom-left-radiusBottom-left corner onlyCustom card corners and layered UI

👀 Live Preview

A box with 15px rounded corners, matching the reference example:

Uses width: 200px;, height: 100px;, background: lightblue;, and border-radius: 15px;.

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.

border-radius-15px.html
<style>
  .rounded-box {
    width: 200px;
    height: 100px;
    background: lightblue;
    border-radius: 15px;
  }
</style>
<div class="rounded-box"></div>
Try It Yourself

How It Works

One value applies the same 15px curve to all four corners, creating a softly rounded rectangle.

Example 2 — 50% Circle

When width and height are equal, border-radius: 50% creates a perfect circle.

border-radius-circle.css
.avatar {
  width: 80px;
  height: 80px;
  background: #2563eb;
  border-radius: 50%;
}
Try It Yourself

How It Works

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.

border-radius-pill.css
.pill-btn {
  padding: 0.5rem 1.25rem;
  background: #16a34a;
  color: #fff;
  border: none;
  border-radius: 999px;
  font-weight: 600;
}
Try It Yourself

How It Works

A radius larger than half the element’s height caps at fully rounded ends. 999px is a common convention that works regardless of button size.

Example 4 — Four Corner Values

Use four values to round only the top-left and bottom-right corners, leaving the others square.

border-radius-four-corners.css
.diagonal-corners {
  width: 180px;
  height: 80px;
  background: #fef3c7;
  border: 2px solid #f59e0b;
  border-radius: 12px 0 12px 0;
}
Try It Yourself

How It Works

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.

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 property 99% supported

Bottom line: Use border-radius freely in any project. It works consistently across all modern browsers.

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.

💡 Best Practices

✅ Do

  • 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

Key Takeaways

Knowledge Unlocked

Five things to remember about border-radius

Use these points when rounding corners in your layouts.

5
Core concepts
⚙️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.

Practice in the Live Editor

Open the HTML editor, try border-radius, and preview rounded corners instantly.

HTML Editor →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

5 people found this page helpful